mirror of https://gitee.com/cf-fz/WebCAD.git
!1316 功能:检查没孔板件,命令CHECKNOHOLEBOARD 检查板件不排钻原因,命令CHECKDRAWHOLE
parent
704c125b89
commit
8889a86cad
@ -0,0 +1,31 @@
|
|||||||
|
import { Intent } from "@blueprintjs/core";
|
||||||
|
import { app } from "../../ApplicationServices/Application";
|
||||||
|
import { Board } from "../../DatabaseServices/Entity/Board";
|
||||||
|
import { Command } from "../../Editor/CommandMachine";
|
||||||
|
import { PromptStatus } from "../../Editor/PromptResult";
|
||||||
|
import { ShowLinesToaster } from "../../UI/Components/Toaster";
|
||||||
|
import { DrawDrillingTool } from "./DrawDrillingTool";
|
||||||
|
|
||||||
|
export class CheckDrawHole implements Command
|
||||||
|
{
|
||||||
|
async exec()
|
||||||
|
{
|
||||||
|
let ssRes = await app.Editor.GetSelection({
|
||||||
|
Msg: "选择需要检查的2块板件",
|
||||||
|
Filter: { filterTypes: [Board] }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ssRes.Status === PromptStatus.Cancel) return;
|
||||||
|
|
||||||
|
let brs = ssRes.SelectSet.SelectEntityList as Board[];
|
||||||
|
|
||||||
|
let tool = DrawDrillingTool.GetInstance() as DrawDrillingTool;
|
||||||
|
let result = await tool.Check(brs.slice(0, 2));
|
||||||
|
|
||||||
|
ShowLinesToaster(result.length === 0 ? ["没检查出无法排钻原因"] : result, {
|
||||||
|
timeout: result.length === 0 ? 3000 : 0,
|
||||||
|
intent: Intent.PRIMARY
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import { app } from "../../ApplicationServices/Application";
|
||||||
|
import { Log } from "../../Common/Log";
|
||||||
|
import { Board } from "../../DatabaseServices/Entity/Board";
|
||||||
|
import { Command } from "../../Editor/CommandMachine";
|
||||||
|
import { PromptStatus } from "../../Editor/PromptResult";
|
||||||
|
import { GetSealedBoardContour } from "../../GraphicsSystem/CalcEdgeSealing";
|
||||||
|
import { Production } from "../../Production/Product";
|
||||||
|
|
||||||
|
export class CheckHasHoleBoard implements Command
|
||||||
|
{
|
||||||
|
async exec()
|
||||||
|
{
|
||||||
|
let ssRes = await app.Editor.GetSelection({
|
||||||
|
Msg: "选择需要检查的板件",
|
||||||
|
Filter: {
|
||||||
|
filterTypes: [Board]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ssRes.Status === PromptStatus.Cancel) return;
|
||||||
|
|
||||||
|
let brs = ssRes.SelectSet.SelectEntityList as Board[];
|
||||||
|
|
||||||
|
const noHolesBoard: Board[] = [];
|
||||||
|
|
||||||
|
for (let br of brs)
|
||||||
|
{
|
||||||
|
let sealedContour = GetSealedBoardContour(br, true);
|
||||||
|
let outline = GetSealedBoardContour(br, false);
|
||||||
|
let offsetTanslation = outline.BoundingBox.min;
|
||||||
|
let info = Production.GetBoardHolesData(br, offsetTanslation, sealedContour);
|
||||||
|
if (info.frontBackHoles.length === 0 && info.sideHoles.length === 0)
|
||||||
|
noHolesBoard.push(br);
|
||||||
|
}
|
||||||
|
|
||||||
|
app.Viewer.OutlinePass.selectedObjects = noHolesBoard.map(e => e.DrawObject);
|
||||||
|
Log(`共${noHolesBoard.length}个板件没孔`);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue