diff --git a/modules/workbenches/modeler/features/loft/loft.operation.ts b/modules/workbenches/modeler/features/loft/loft.operation.ts new file mode 100644 index 00000000..c49146aa --- /dev/null +++ b/modules/workbenches/modeler/features/loft/loft.operation.ts @@ -0,0 +1,97 @@ +import { roundValueForPresentation as r } from 'cad/craft/operationHelper'; +import { MFace } from "cad/model/mface"; +import { ApplicationContext } from "context"; +import { EntityKind } from "cad/model/entities"; +import { BooleanDefinition } from "cad/craft/schema/common/BooleanDefinition"; +import { UnitVector } from "math/vector"; +import { OperationDescriptor } from "cad/craft/operationPlugin"; +import { negate } from 'cypress/types/lodash'; + + +interface LoftParams { + faces: MFace; + boolean: BooleanDefinition +} + +const LoftOperation: OperationDescriptor = { + id: 'loft', + label: 'Loft', + icon: 'img/cad/loft', + info: 'Lofts 2D sketch', + paramsInfo: ({ }) => `(${r()})`, + run: (params: LoftParams, ctx: ApplicationContext) => { + + let occ = ctx.occService; + const oci = occ.commandInterface; + + oci.polyline("w1", + "0", "0", "0", + "5", "0", "0", + "5", "5", "0", + "2", "3", "0", + "0", "0", "0", + ); + oci.polyline("w2", + "0", "1", "3", + "4", "1", "3", + "4", "4", "3", + "1", "3", "3", + "0", "1", "3", + ); + oci.polyline("w3", + "0", "0", "5", + "5", "0", "5", + "5", "5", "5", + "2", "3", "5", + "0", "0", "5", + ); + //# create the shape + var wires = []; + wires.push("w1"); + // wires.push("w2"); + // wires.push("w3"); + + console.log(params.faces); + + var itterator = 0; + + var myReturnWire = occ.io.sketchLoader.pushContourAsWire(params.faces.sketchLoops[0].contour, itterator, params.faces.csys ) + + wires.push(myReturnWire); + + + oci.thrusections("th", "1", "0", ...wires ); + + + + return { + created:[occ.io.getShell("th")], + consumed:[] + } + + }, + + + form: [ + { + type: 'selection', + name: 'faces', + capture: [EntityKind.FACE], + label: 'face', + multi: false, + defaultValue: { + usePreselection: true, + preselectionIndex: 0 + }, + }, + { + type: 'boolean', + name: 'boolean', + label: 'boolean', + optional: true, + } + + ], +} + +export default LoftOperation; \ No newline at end of file diff --git a/modules/workbenches/modeler/index.ts b/modules/workbenches/modeler/index.ts index e23e0381..776bcabd 100644 --- a/modules/workbenches/modeler/index.ts +++ b/modules/workbenches/modeler/index.ts @@ -9,6 +9,7 @@ import hole_tool from './features/hole_tool'; import fillet_tool from './features/fillet_tool'; import boolean_tool from './features/boolean_tool/boolean.operation'; import ShellOperation from './features/shell_tool/shell.operation'; +import loft from './features/loft/loft.operation' export default { @@ -25,5 +26,6 @@ export default { RevolveOperation, boolean_tool, ShellOperation, + loft, ] } \ No newline at end of file diff --git a/web/app/cad/part/uiConfigPlugin.js b/web/app/cad/part/uiConfigPlugin.js index 56f2ee12..aa16fa43 100644 --- a/web/app/cad/part/uiConfigPlugin.js +++ b/web/app/cad/part/uiConfigPlugin.js @@ -11,7 +11,7 @@ import {SelectionView} from "../dom/components/SelectionView"; import {GrSelect} from "react-icons/gr"; export const STANDARD_MODE_HEADS_UP_TOOLBAR = ['DATUM_CREATE', 'PLANE', 'EditFace', '-', "OCC_BOTTLE", '-', - "EXTRUDE", "Revolve", "-", "boolean_tool", "shell_tool", + "EXTRUDE", "Revolve", "loft","-", "boolean_tool", "shell_tool", "primitive_cylinder", "primitive_box", "primitive_cone", "primitive_sphere", "primitive_torus", "hole_tool", "fillet_tool"];