From 952b41e75d84e7c9f4c0f5fce67dc6374d2bba4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=89?= <940119273@qq.com> Date: Thu, 11 May 2023 02:22:35 +0000 Subject: [PATCH] =?UTF-8?q?!2208=20=E6=96=B0=E5=A2=9E:=E5=B9=B2=E6=B6=89?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=8A=9F=E8=83=BD=E5=A2=9E=E5=8A=A0=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E4=B8=8D=E6=8B=86=E5=8D=95=E7=9A=84=E6=9D=BF=E4=BB=B6?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Add-on/interfere.ts | 43 +++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/Add-on/interfere.ts b/src/Add-on/interfere.ts index 1f54c8036..28cd002ab 100644 --- a/src/Add-on/interfere.ts +++ b/src/Add-on/interfere.ts @@ -1,9 +1,9 @@ - import { Intent } from '@blueprintjs/core'; import { app } from '../ApplicationServices/Application'; import { ColorMaterial } from '../Common/ColorPalette'; import { DisposeThreeObj } from '../Common/Dispose'; import { CheckInterfereTool } from '../Common/InterfereUtil'; +import { Board } from '../DatabaseServices/Entity/Board'; import { ExtrudeSolid } from '../DatabaseServices/Entity/Extrude'; import { HardwareCompositeEntity } from '../DatabaseServices/Hardware/HardwareCompositeEntity'; import { PromptStatus } from '../Editor/PromptResult'; @@ -23,16 +23,39 @@ export class Interfere implements Command if (!this.checkInterfereTool) this.checkInterfereTool = new CheckInterfereTool(ColorMaterial.GetConceptualMaterial(1)); - let enRes = await app.Editor.GetSelection({ - Msg: "选择检查干涉的对象", - Filter: { - filterTypes: [HardwareCompositeEntity, ExtrudeSolid, SweepSolid] - } - }); + let filterChaiDanBoard = true; + let selectEnts: (HardwareCompositeEntity | ExtrudeSolid | SweepSolid)[] = []; - if (enRes.Status === PromptStatus.Cancel) return; - - let selectEnts = enRes.SelectSet.SelectEntityList as (HardwareCompositeEntity | ExtrudeSolid | SweepSolid)[]; + while (true) + { + let keyWordList = filterChaiDanBoard ? [{ msg: "不过滤不拆单的板件", key: "N" }] : [{ msg: "过滤不拆单的板件", key: "Y" }]; + let enRes = await app.Editor.GetSelection({ + Msg: `选择检查干涉的对象${filterChaiDanBoard ? "(过滤不拆单的板件)" : ""}`, + KeyWordList: keyWordList, + Filter: { + filterTypes: [HardwareCompositeEntity, ExtrudeSolid, SweepSolid], + filterFunction: (obj, ent) => + { + //过滤不拆单的板件 + if (filterChaiDanBoard && ent instanceof Board) + return ent.IsChaiDan; + return true; + } + } + }); + if (enRes.Status === PromptStatus.OK) + { + selectEnts = enRes.SelectSet.SelectEntityList as (HardwareCompositeEntity | ExtrudeSolid | SweepSolid)[]; + break; + } + else if (enRes.Status === PromptStatus.Keyword) + { + if (enRes.StringResult === "Y" || enRes.StringResult === "N") + filterChaiDanBoard = !filterChaiDanBoard; + } + else + return; + } //进度条 let down = DownPanelStore.GetInstance() as DownPanelStore;