From 22ea608629718e31fd2d890744da214b7e60428a Mon Sep 17 00:00:00 2001 From: Mike Molinari Date: Tue, 26 Jul 2022 23:05:13 +0000 Subject: [PATCH] fixed broken loft after rebase --- .../modeler/features/loft/loft.operation.ts | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/modules/workbenches/modeler/features/loft/loft.operation.ts b/modules/workbenches/modeler/features/loft/loft.operation.ts index f0359fac..6c9bc66f 100644 --- a/modules/workbenches/modeler/features/loft/loft.operation.ts +++ b/modules/workbenches/modeler/features/loft/loft.operation.ts @@ -19,33 +19,17 @@ export const LoftOperation: OperationDescriptor = { icon: 'img/cad/loft', info: 'Lofts 2D sketch', paramsInfo: ({ }) => `(${r()})`, - run:async (params: LoftParams, ctx: ApplicationContext) => { + run: async (params: LoftParams, ctx: ApplicationContext) => { let occ = ctx.occService; const oci = occ.commandInterface; - - - console.log(params.loops); - - let sketches = []; - - const wires = params.loops.map((loop, i) => { - const shapeName = "loop/" + i; - sketches.push(loop.parent); - - return occ.io.sketchLoader.pushContourAsWire(loop.contour, shapeName, loop.face.csys).wire - }); - - console.log("This is the info you are looking for", sketches); - let loftType = 0; if (params.loftType == "smooth") loftType = 0; if (params.loftType == "sharp") loftType = 1; //console.log(params.loops); -<<<<<<< HEAD let sketches = []; const wires = params.loops.map((loop, i) => { @@ -60,11 +44,22 @@ export const LoftOperation: OperationDescriptor = { let sweepSources = []; - sketches.forEach(await async function (item, index) { - console.log(item, index); - await sweepSources.concat(await occ.utils.sketchToFaces(ctx.sketchStorageService.readSketch(item.id), item.csys)) + let indexOfMostSegments = 0; + let longestPath = 0; + let primarySketch = {}; + + sketches.forEach(function (item, index) { + //console.log(item, index); + if(params.loops[index].contour.segments.length > longestPath){ + longestPath = params.loops[index].contour.segments.length; + + primarySketch = params.loops[index].parent; + } + const face = occ.utils.sketchToFaces(ctx.sketchStorageService.readSketch(item.id), item.csys); + sweepSources = face; }); + const productionAnalyzer = new FromSketchProductionAnalyzer(sweepSources); oci.thrusections("th", "1", loftType, ...wires); @@ -72,7 +67,7 @@ export const LoftOperation: OperationDescriptor = { let tools = []; tools.push(occ.io.getShell("th", productionAnalyzer)); - return occ.utils.applyBooleanModifier(tools, params.boolean, sketches, [],) + return occ.utils.applyBooleanModifier(tools, params.boolean, [], [],) }, @@ -105,4 +100,4 @@ export const LoftOperation: OperationDescriptor = { } ], -} +} \ No newline at end of file