|
|
|
@ -3,6 +3,8 @@ import { app } from '../ApplicationServices/Application';
|
|
|
|
|
import { Command } from '../Editor/CommandMachine';
|
|
|
|
|
import { JigUtils } from '../Editor/JigUtils';
|
|
|
|
|
import { PromptStatus } from '../Editor/PromptResult';
|
|
|
|
|
import { CylinderHole, GangDrillType } from '../DatabaseServices/3DSolid/CylinderHole';
|
|
|
|
|
import { Board } from '../DatabaseServices/Entity/Board';
|
|
|
|
|
|
|
|
|
|
export class Command_Move implements Command
|
|
|
|
|
{
|
|
|
|
@ -47,8 +49,34 @@ export class Command_Move implements Command
|
|
|
|
|
if (ptRes.Status === PromptStatus.OK)
|
|
|
|
|
{
|
|
|
|
|
moveMatrix.setPosition(ptRes.Point.clone().sub(ptBase));
|
|
|
|
|
|
|
|
|
|
//通孔移动后可能不再是通孔
|
|
|
|
|
let tks = app.Viewer.VisibleEntitys.filter(e => (e instanceof CylinderHole) && e.Type === GangDrillType.TK) as CylinderHole[];
|
|
|
|
|
|
|
|
|
|
let hasBoard = ens.some(en => en instanceof Board);
|
|
|
|
|
let cancelTks = new WeakSet<CylinderHole>();
|
|
|
|
|
|
|
|
|
|
for (let en of ens)
|
|
|
|
|
{
|
|
|
|
|
if (!hasBoard && en instanceof CylinderHole && en.Type === GangDrillType.TK)
|
|
|
|
|
{
|
|
|
|
|
for (let tk of tks)
|
|
|
|
|
{
|
|
|
|
|
if (cancelTks.has(tk)) continue;
|
|
|
|
|
|
|
|
|
|
if (en.BoundingBox.intersectsBox(tk.BoundingBox))
|
|
|
|
|
{
|
|
|
|
|
if (!ens.includes(tk))
|
|
|
|
|
{
|
|
|
|
|
cancelTks.add(tk);
|
|
|
|
|
en.Type = GangDrillType.Ymj;
|
|
|
|
|
tk.Type = GangDrillType.Ymj;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
en.ApplyMatrix(moveMatrix);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|