loft function non working first cut.

This commit is contained in:
Mike Molinari 2022-02-22 04:13:30 +00:00 committed by Val Erastov
parent 0d07817957
commit 4973879cd3
3 changed files with 100 additions and 1 deletions

View file

@ -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<LoftParams> = {
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;

View file

@ -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,
]
}

View file

@ -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"];