mirror of https://gitee.com/cf-fz/WebCAD.git
parent
6f9a3f9c45
commit
4443a7a9f7
@ -0,0 +1,34 @@
|
||||
import { app } from "../../ApplicationServices/Application";
|
||||
import { Board } from "../../DatabaseServices/Board";
|
||||
import { userConfig } from "../../Editor/UserConfig";
|
||||
import { NonAssociativeCutting } from "./NonAssociativeCutting";
|
||||
|
||||
export class AutoCuttingReactor
|
||||
{
|
||||
Enable = true;
|
||||
constructor()
|
||||
{
|
||||
this.Enable = userConfig.openAutoCuttingReactor;
|
||||
|
||||
app.m_CommandReactor.OnCommandEnd((cmdName, changeObjects, createObjects) =>
|
||||
{
|
||||
if (!this.Enable) return;
|
||||
|
||||
let brs = createObjects.filter(o => o instanceof Board) as Board[];
|
||||
if (brs.length > 0)
|
||||
this.StartReactor(brs);
|
||||
});
|
||||
}
|
||||
StartReactor(ents: Board[])
|
||||
{
|
||||
let nc = new NonAssociativeCutting();
|
||||
let brs: Board[] = [];
|
||||
for (let ent of app.m_Viewer.VisibleEntitys)
|
||||
{
|
||||
if (ent instanceof Board && !ents.includes(ent))
|
||||
brs.push(ent);
|
||||
}
|
||||
for (let br of brs)
|
||||
nc.CuttingBoard(br, ents);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue