diff --git a/modules/workbenches/sheetMetal/features/smTab/smTab.operation.ts b/modules/workbenches/sheetMetal/features/smTab/smTab.operation.ts index 45ebd189..8693f4db 100644 --- a/modules/workbenches/sheetMetal/features/smTab/smTab.operation.ts +++ b/modules/workbenches/sheetMetal/features/smTab/smTab.operation.ts @@ -55,12 +55,7 @@ export const smTabOperation: OperationDescriptor = { extrusionVector = dir.normalize()._multiply(params.thickness).negate(); } - - - - const productionAnalyzer = new FromSketchProductionAnalyzer(occFaces,"SM/FLAT/A", "SM/FLAT/B","SM/THICKNESS"); - console.log(productionAnalyzer); const tools = occFaces.map((faceRef, i) => { @@ -71,7 +66,19 @@ export const smTabOperation: OperationDescriptor = { }).map(shapeName => occ.io.getShell(shapeName, productionAnalyzer)); - return occ.utils.applyBooleanModifier(tools, params.boolean, face, [face]); + const operationResult = occ.utils.applyBooleanModifier(tools, params.boolean, face, [face]); + + operationResult.created.forEach(shell => { + shell.traverse(obj => { + if (obj.productionInfo?.role) { + obj.productionInfo.sheetMetal = { + kind: ROLE_TO_SM_KIND[obj.productionInfo.role] + } + } + }) + }); + + return operationResult; }, diff --git a/web/app/cad/craft/production/productionAnalyzer.ts b/web/app/cad/craft/production/productionAnalyzer.ts index 3eac18c9..990ac933 100644 --- a/web/app/cad/craft/production/productionAnalyzer.ts +++ b/web/app/cad/craft/production/productionAnalyzer.ts @@ -192,16 +192,10 @@ export class ExpectedOrderProductionAnalyzer extends BasicProductionAnalyzer { export class FromSketchProductionAnalyzer extends BasicProductionAnalyzer { profiles: FaceRef[]; - baseName: string; - sweepName: string; - lidName:string; - constructor(profiles: FaceRef[], baseName?: string, lidName?:string, sweepName?: string) { + constructor(profiles: FaceRef[]) { super(); this.profiles = profiles; - this.baseName = baseName ? baseName : "BASE"; - this.lidName = lidName ? lidName : "LID"; - this.sweepName = sweepName? sweepName: "SWEEP"; for (let originFace of this.profiles) { classifier.prepare(originFace.topoShape); } @@ -223,9 +217,9 @@ export class FromSketchProductionAnalyzer extends BasicProductionAnalyzer { if (faceToFaceClassification === Classification.EXACT) { base = createdFace; - base.data.id = `F:${this.baseName}[${wireId}]`; + base.data.id = `F:BASE[${wireId}]`; base.data.productionInfo = { - role: this.baseName, + role: 'base', originatingWire: wireId } break; @@ -239,55 +233,55 @@ export class FromSketchProductionAnalyzer extends BasicProductionAnalyzer { for (let createdEdge of createdShell.edges) { if (classifier.classifyEdgeToEdge(profileEdge, createdEdge) !== Classification.UNRELATED) { - createdEdge.data.id = `E:${this.baseName}[${seg.id}]`; + createdEdge.data.id = `E:BASE[${seg.id}]`; createdEdge.data.productionInfo = { - role: this.baseName, + role: 'base', originatingPrimitive: seg.id } let halfEdge = createdEdge.getHalfEdge(he => he?.loop?.face && he.loop.face !== base); if (halfEdge) { let face = halfEdge.loop.face; - face.data.id = `F:${this.sweepName}[${seg.id}]`; + face.data.id = `F:SWEEP[${seg.id}]`; face.data.productionInfo = { - role: this.sweepName, + role: 'sweep', originatingPrimitive: seg.id } - halfEdge.prev.edge.data.id = `E:${this.sweepName}[${seg.id}/A]`; + halfEdge.prev.edge.data.id = `E:SWEEP[${seg.id}/A]`; halfEdge.prev.edge.data.productionInfo = { - role: this.sweepName, + role: 'sweep', originatingPrimitive: seg.id + '/A' } - halfEdge.prev.vertexA.data.id = `V:${this.lidName}[${seg.id}/A]` + halfEdge.prev.vertexA.data.id = `V:LID[${seg.id}/A]` halfEdge.prev.vertexA.data.productionInfo = { - role: this.lidName, + role: 'lid', originatingPrimitive: seg.id + '/A' } - halfEdge.prev.vertexB.data.id = `V:${this.baseName}[${seg.id}/A]` + halfEdge.prev.vertexB.data.id = `V:BASE[${seg.id}/A]` halfEdge.prev.vertexB.data.productionInfo = { - role: this.baseName, + role: 'base', originatingPrimitive: seg.id + '/A' } //Extruded not closed wire if (!halfEdge.next.twin()) { - halfEdge.next.edge.data.id = `E:${this.sweepName}[${seg.id}/B]`; + halfEdge.next.edge.data.id = `E:SWEEP[${seg.id}/B]`; halfEdge.next.edge.data.productionInfo = { - role: this.sweepName, + role: 'sweep', originatingPrimitive: seg.id + '/B' } - halfEdge.next.vertexA.data.id = `V:${this.baseName}[${seg.id}/B]` + halfEdge.next.vertexA.data.id = `V:BASE[${seg.id}/B]` halfEdge.next.vertexA.data.productionInfo = { - role: this.baseName, + role: 'base', originatingPrimitive: seg.id + '/B' } - halfEdge.prev.vertexB.data.id = `V:${this.lidName}[${seg.id}/B]` + halfEdge.prev.vertexB.data.id = `V:LID[${seg.id}/B]` halfEdge.prev.vertexB.data.productionInfo = { - role: this.lidName, + role: 'lid', originatingPrimitive: seg.id + '/B' } } @@ -298,9 +292,9 @@ export class FromSketchProductionAnalyzer extends BasicProductionAnalyzer { for (let createdFace of createdShell.faces) { if (!createdFace.data.productionInfo) { - createdFace.data.id = `F:${this.lidName}[${wireId}]`; + createdFace.data.id = `F:LID[${wireId}]`; createdFace.data.productionInfo = { - role: this.lidName + role: 'lid' } break; } @@ -312,9 +306,9 @@ export class FromSketchProductionAnalyzer extends BasicProductionAnalyzer { const he = createdEdge.getHalfEdge(he => he?.loop?.face?.data?.productionInfo?.role === 'sweep'); if (he) { const originatingPrimitive = he.loop.face.data.productionInfo.originatingPrimitive; - createdEdge.data.id = `E:${this.lidName}[${originatingPrimitive}]`; + createdEdge.data.id = `E:LID[${originatingPrimitive}]`; createdEdge.data.productionInfo = { - role: this.lidName, + role: 'lid', originatingPrimitive } } diff --git a/web/app/cad/model/mobject.ts b/web/app/cad/model/mobject.ts index 6021958a..9d499dbf 100644 --- a/web/app/cad/model/mobject.ts +++ b/web/app/cad/model/mobject.ts @@ -48,7 +48,7 @@ export abstract class MObject { return null; } - get productionInfo(): any { + get productionInfo() { return this.topology?.data?.productionInfo; } }