diff --git a/src/Add-on/DrawBoard/DrawLayerBoard.ts b/src/Add-on/DrawBoard/DrawLayerBoard.ts index 37156438c..e3b03bf57 100644 --- a/src/Add-on/DrawBoard/DrawLayerBoard.ts +++ b/src/Add-on/DrawBoard/DrawLayerBoard.ts @@ -1,6 +1,8 @@ import { app } from '../../ApplicationServices/Application'; +import { Entity } from '../../DatabaseServices/Entity/Entity'; import { TemplateLayerBoard } from '../../DatabaseServices/Template/ProgramTempate/TemplateLayerBoard'; import { SetTemplatePositionAndSetParent } from '../../DatabaseServices/Template/TempateUtils'; +import { JigUtils } from '../../Editor/JigUtils'; import { LayerBoardStore } from '../../UI/Store/BoardStore'; import { LayerBoardOption } from "../../UI/Store/OptionInterface/IOptionInterface"; import { BuildLayerBoards } from './BuildBoardTool'; @@ -21,17 +23,25 @@ export class DrawLayerBoard extends DrawBoardTool temp.UseBoardProcessOption = this.store.BoardProcessOption.useBoardProcessOption; temp.BoardProcessOption = this.store.BoardProcessOption; + let effectBoards: Entity[]; if (this.store.m_Option.cuttingProtrudingPart) + { temp.IntersectSpaceEntitys = this.IntersectSpaceEntitys; - + effectBoards = Array.from(this.IntersectSpaceEntitys).map(objectId => objectId?.Object as Entity); + } app.Database.TemplateTable.Append(temp); - await SetTemplatePositionAndSetParent(this.space, temp); + await SetTemplatePositionAndSetParent(this.space, temp, true, undefined, effectBoards); } else { + //BuildLayerBoards()的时候cuttingProtrudingPart会被修改 + let cuttingProtrudingPart = this.store.m_Option.cuttingProtrudingPart; + let brs = await BuildLayerBoards(this.store.m_Option as LayerBoardOption, this.space); - if (this.store.m_Option.cuttingProtrudingPart) + if (cuttingProtrudingPart) CuttingProtrudingPart(this.IntersectSpaceEntitys, brs); + + brs.forEach(br => JigUtils.Draw(br)); } } } diff --git a/src/Add-on/DrawBoard/DrawVerticalBoard.ts b/src/Add-on/DrawBoard/DrawVerticalBoard.ts index 2f5bf9d96..600f36d89 100644 --- a/src/Add-on/DrawBoard/DrawVerticalBoard.ts +++ b/src/Add-on/DrawBoard/DrawVerticalBoard.ts @@ -1,7 +1,9 @@ import { app } from '../../ApplicationServices/Application'; import { BoardType } from '../../DatabaseServices/Entity/BoardInterface'; +import { Entity } from '../../DatabaseServices/Entity/Entity'; import { TemplateVerticalBoard } from '../../DatabaseServices/Template/ProgramTempate/TemplateVerticalBoard'; import { SetTemplatePositionAndSetParent } from '../../DatabaseServices/Template/TempateUtils'; +import { JigUtils } from '../../Editor/JigUtils'; import { VerticalBoardOption } from "../../UI/Store/OptionInterface/IOptionInterface"; import { BuildVerticalBoards } from './BuildBoardTool'; import { CuttingProtrudingPart } from './CuttingProtrudingPart'; @@ -20,18 +22,25 @@ export class DrawVerticalBoard extends DrawBoardTool temp.BoardProcessOption = this.store.BoardProcessOption; temp.GrooveOption = this.store.grooveOption; + let effectBoards: Entity[]; if (this.store.m_Option.cuttingProtrudingPart) + { temp.IntersectSpaceEntitys = this.IntersectSpaceEntitys; - + effectBoards = Array.from(this.IntersectSpaceEntitys).map(objectId => objectId?.Object as Entity); + } app.Database.TemplateTable.Append(temp); - await SetTemplatePositionAndSetParent(this.space, temp); + await SetTemplatePositionAndSetParent(this.space, temp, true, undefined, effectBoards); } else { + //BuildVerticalBoards()的时候cuttingProtrudingPart会被修改 + let cuttingProtrudingPart = this.store.m_Option.cuttingProtrudingPart; let brs = await BuildVerticalBoards(this.store.m_Option as VerticalBoardOption, this.space); - if (this.store.m_Option.cuttingProtrudingPart) + if (cuttingProtrudingPart) CuttingProtrudingPart(this.IntersectSpaceEntitys, brs); + + brs.forEach(br => JigUtils.Draw(br)); } } } diff --git a/src/Add-on/PasteClip.ts b/src/Add-on/PasteClip.ts index 12da5c861..8d5fb63eb 100644 --- a/src/Add-on/PasteClip.ts +++ b/src/Add-on/PasteClip.ts @@ -3,11 +3,11 @@ import { Box3, Matrix4, Vector3 } from "three"; import { app } from "../ApplicationServices/Application"; import { arrayLast } from "../Common/ArrayExt"; import { Draw } from "../Common/Draw"; -import { inflateBase64 } from "../Common/inflate"; import { KeyWord } from "../Common/InputState"; import { JigMoveEntity } from "../Common/JigMove"; import { UpdateDraw } from "../Common/Status"; import { readClipboardText } from "../Common/Utils"; +import { inflateBase64 } from "../Common/inflate"; import { CADFiler } from "../DatabaseServices/CADFiler"; import { Database } from "../DatabaseServices/Database"; import { Curve } from "../DatabaseServices/Entity/Curve"; diff --git a/src/DatabaseServices/Template/TempateUtils.ts b/src/DatabaseServices/Template/TempateUtils.ts index 3fafda056..1d4bce01f 100644 --- a/src/DatabaseServices/Template/TempateUtils.ts +++ b/src/DatabaseServices/Template/TempateUtils.ts @@ -1591,7 +1591,17 @@ function IsEqualBH(parent: TemplateRecord, target: TemplateRecord): boolean return bh2.value === bh1.value;//父节点已经计算出值 } -export async function SetTemplatePositionAndSetParent(spaceParse: ISpaceParse, template: TemplateRecord, isAddDeepNode = true, option?: IGetRoomInfo) +/** + * 分析设置模块空间层级关系 + * + * @export + * @param {ISpaceParse} spaceParse + * @param {TemplateRecord} template + * @param {boolean} [isAddDeepNode=true] + * @param {IGetRoomInfo} [option] + * @param {Entity[]} [effectBoards=[]] 绘制缺口单板时 分析切割缺口的实体 + */ +export async function SetTemplatePositionAndSetParent(spaceParse: ISpaceParse, template: TemplateRecord, isAddDeepNode = true, option?: IGetRoomInfo, effectBoards: Entity[] = []) { if (spaceParse instanceof ClampSpaceParse) { @@ -1603,7 +1613,7 @@ export async function SetTemplatePositionAndSetParent(spaceParse: ISpaceParse, t template.RYParam.expr = spaceParse.Rotation.y; template.RZParam.expr = spaceParse.Rotation.z; - let reqTemplates: TemplateRecord[] = GetDeepestTemplate(spaceParse.Boards); + let reqTemplates: TemplateRecord[] = GetDeepestTemplate(effectBoards.concat(spaceParse.Boards)); if (reqTemplates.length && isAddDeepNode) { let templateSource = reqTemplates[0];