added basic primitives commands
1
modules/3d-party/primitive_box/docs/index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
place holder
|
||||
BIN
modules/3d-party/primitive_box/icon32.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
modules/3d-party/primitive_box/icon96.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
56
modules/3d-party/primitive_box/index.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import { ApplicationContext } from 'context';
|
||||
import { MBrepShell } from '../../../web/app/cad/model/mshell';
|
||||
import { roundValueForPresentation as r } from '../../../web/app/cad/craft/operationHelper';
|
||||
import { occ2brep } from '../../../web/app/cad/occ/occ2models';
|
||||
|
||||
export const primitive_box = {
|
||||
id: 'primitive_box',
|
||||
label: 'primitive_box',
|
||||
icon: 'img/cad/extrude',
|
||||
info: 'primitive_box',
|
||||
mutualExclusiveFields: [],
|
||||
paramsInfo: ({ boxX, boxY, boxZ }) => `(${r(boxX)} ${r(boxY)}) ${r(boxZ)})`,
|
||||
run: ({ boxX, boxY, boxZ }, ctx: ApplicationContext) => {
|
||||
//const occObj = createCylinder(diameter, height, ctx.occService.occContext);
|
||||
const oc = ctx.occService.occContext;
|
||||
|
||||
//const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||
//const cylinderCenterline = oc.gp.DZ();
|
||||
//const cylinderOrientationAndLocation = new oc.gp_Ax2_3(myLocation, cylinderCenterline);
|
||||
console.log(boxX, boxY, boxZ, oc.BRepPrimAPI_MakeBox_1(boxX, boxY, boxZ))
|
||||
|
||||
let myBody = new oc.BRepPrimAPI_MakeBox_1(boxX, boxY, boxZ );
|
||||
//let myBody = new oc.BRepPrimAPI_Make
|
||||
|
||||
const aRes = new oc.TopoDS_Compound();
|
||||
const aBuilder = new oc.BRep_Builder();
|
||||
aBuilder.MakeCompound(aRes);
|
||||
aBuilder.Add(aRes, myBody.Shape());
|
||||
|
||||
|
||||
|
||||
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||
return {
|
||||
consumed: [],
|
||||
created: [mobject]
|
||||
};
|
||||
},
|
||||
schema: {
|
||||
boxX: {
|
||||
type: 'number',
|
||||
defaultValue: 200,
|
||||
label: 'X'
|
||||
},
|
||||
boxY: {
|
||||
type: 'number',
|
||||
defaultValue: 280,
|
||||
label: 'Y'
|
||||
},
|
||||
BoxZ: {
|
||||
type: 'number',
|
||||
defaultValue: 280,
|
||||
label: 'Z'
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
1
modules/3d-party/primitive_cone/docs/index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
place holder
|
||||
BIN
modules/3d-party/primitive_cone/icon32.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
modules/3d-party/primitive_cone/icon96.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
50
modules/3d-party/primitive_cone/index.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { ApplicationContext } from 'context';
|
||||
import { MBrepShell } from '../../../web/app/cad/model/mshell';
|
||||
import { roundValueForPresentation as r } from '../../../web/app/cad/craft/operationHelper';
|
||||
import { occ2brep } from '../../../web/app/cad/occ/occ2models';
|
||||
|
||||
export const primitive_cone = {
|
||||
id: 'primitive_cone',
|
||||
label: 'primitive_cone',
|
||||
icon: 'img/cad/extrude',
|
||||
info: 'primitive_cone',
|
||||
mutualExclusiveFields: [],
|
||||
paramsInfo: ({ diameter, height }) => `(${r(diameter)} ${r(height)})`,
|
||||
run: ({ diameter, height, }, ctx: ApplicationContext) => {
|
||||
//const occObj = createcone(diameter, height, ctx.occService.occContext);
|
||||
const oc = ctx.occService.occContext;
|
||||
|
||||
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||
const coneCenterline = oc.gp.DZ();
|
||||
const coneOrientationAndLocation = new oc.gp_Ax2_3(myLocation, coneCenterline);
|
||||
|
||||
let myBody = new oc.BRepPrimAPI_MakeCone_1(10,20,100);
|
||||
//let myBody = new oc.BRepPrimAPI_Make
|
||||
|
||||
const aRes = new oc.TopoDS_Compound();
|
||||
const aBuilder = new oc.BRep_Builder();
|
||||
aBuilder.MakeCompound(aRes);
|
||||
aBuilder.Add(aRes, myBody.Shape());
|
||||
|
||||
|
||||
|
||||
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||
return {
|
||||
consumed: [],
|
||||
created: [mobject]
|
||||
};
|
||||
},
|
||||
schema: {
|
||||
diameter: {
|
||||
type: 'number',
|
||||
defaultValue: 200,
|
||||
label: 'diameter'
|
||||
},
|
||||
height: {
|
||||
type: 'number',
|
||||
defaultValue: 280,
|
||||
label: 'height'
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
1
modules/3d-party/primitive_cylinder/docs/index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
place holder
|
||||
BIN
modules/3d-party/primitive_cylinder/icon32.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
modules/3d-party/primitive_cylinder/icon96.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
51
modules/3d-party/primitive_cylinder/index.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import { ApplicationContext } from 'context';
|
||||
import { MBrepShell } from '../../../web/app/cad/model/mshell';
|
||||
import { roundValueForPresentation as r } from '../../../web/app/cad/craft/operationHelper';
|
||||
import { occ2brep } from '../../../web/app/cad/occ/occ2models';
|
||||
|
||||
export const primitive_cylinder = {
|
||||
id: 'primitive_cylinder',
|
||||
label: 'primitive_cylinder',
|
||||
icon: 'img/cad/extrude',
|
||||
info: 'primitive_cylinder',
|
||||
mutualExclusiveFields: [],
|
||||
paramsInfo: ({ diameter, height }) => `(${r(diameter)} ${r(height)})`,
|
||||
run: ({ diameter, height, }, ctx: ApplicationContext) => {
|
||||
//const occObj = createCylinder(diameter, height, ctx.occService.occContext);
|
||||
const oc = ctx.occService.occContext;
|
||||
|
||||
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||
const cylinderCenterline = oc.gp.DZ();
|
||||
const cylinderOrientationAndLocation = new oc.gp_Ax2_3(myLocation, cylinderCenterline);
|
||||
|
||||
|
||||
let myBody = new oc.BRepPrimAPI_MakeCylinder_3(cylinderOrientationAndLocation, diameter, height,);
|
||||
//let myBody = new oc.BRepPrimAPI_Make
|
||||
|
||||
const aRes = new oc.TopoDS_Compound();
|
||||
const aBuilder = new oc.BRep_Builder();
|
||||
aBuilder.MakeCompound(aRes);
|
||||
aBuilder.Add(aRes, myBody.Shape());
|
||||
|
||||
|
||||
|
||||
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||
return {
|
||||
consumed: [],
|
||||
created: [mobject]
|
||||
};
|
||||
},
|
||||
schema: {
|
||||
diameter: {
|
||||
type: 'number',
|
||||
defaultValue: 200,
|
||||
label: 'diameter'
|
||||
},
|
||||
height: {
|
||||
type: 'number',
|
||||
defaultValue: 280,
|
||||
label: 'height'
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
57
modules/3d-party/primitive_cylinder/partOperationsPlugin.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import extrudeOperation from '../craft/cutExtrude/extrudeOperation';
|
||||
import cutOperation from '../craft/cutExtrude/cutOperation';
|
||||
import planeOperation from '../craft/primitives/simplePlane/simplePlaneOperation';
|
||||
import filletOperation from '../craft/fillet/filletOperation';
|
||||
import revolveOperation from '../craft/revolve/revolveOperation';
|
||||
import createDatumOperation from '../craft/datum/create/createDatumOperation';
|
||||
import moveDatumOperation from '../craft/datum/move/moveDatumOperation';
|
||||
import rotateDatumOperation from '../craft/datum/rotate/rotateDatumOperation';
|
||||
import datumOperation from '../craft/primitives/plane/planeOperation';
|
||||
import boxOperation from '../craft/primitives/box/boxOperation';
|
||||
import sphereOperation from '../craft/primitives/sphere/sphereOperation';
|
||||
import cylinderOperation from '../craft/primitives/cylinder/cylinderOperation';
|
||||
import torusOperation from '../craft/primitives/torus/torusOperation';
|
||||
import coneOperation from '../craft/primitives/cone/coneOperation';
|
||||
import spatialCurveOperation from '../craft/spatialCurve/spatialCurveOperation';
|
||||
import loftOperation from '../craft/loft/loftOperation';
|
||||
import {intersectionOperation, subtractOperation, unionOperation} from '../craft/boolean/booleanOperation';
|
||||
import { loadMDFCommand } from '../mdf/mdf';
|
||||
import { MDF_EXTRUDE_EXAMPLE } from '../mdf/mdfExtrudeExample';
|
||||
import { OCC_BOTTLE_OPERATION } from '3d-party/occ-bottle/bottleOperation';
|
||||
import { primitive_cylinder } from '3d-party/primitive_cylinder/index';
|
||||
import { primitive_box } from '3d-party/primitive_box/index';
|
||||
import { primitive_cone } from '3d-party/primitive_cone/index';
|
||||
//import { primitive_box } from '3d-party/primitive_sphere/index';
|
||||
//import { primitive_box } from '3d-party/primitive_torus/index';
|
||||
|
||||
|
||||
export function activate({services}) {
|
||||
services.operation.registerOperations([
|
||||
planeOperation,
|
||||
boxOperation,
|
||||
// extrudeOperation,
|
||||
loadMDFCommand(MDF_EXTRUDE_EXAMPLE),
|
||||
cutOperation,
|
||||
revolveOperation,
|
||||
filletOperation,
|
||||
createDatumOperation,
|
||||
moveDatumOperation,
|
||||
rotateDatumOperation,
|
||||
datumOperation,
|
||||
sphereOperation,
|
||||
cylinderOperation,
|
||||
torusOperation,
|
||||
coneOperation,
|
||||
spatialCurveOperation,
|
||||
loftOperation,
|
||||
intersectionOperation,
|
||||
subtractOperation,
|
||||
unionOperation,
|
||||
loadMDFCommand(OCC_BOTTLE_OPERATION),
|
||||
loadMDFCommand(primitive_cylinder),
|
||||
loadMDFCommand(primitive_box),
|
||||
loadMDFCommand(primitive_cone),
|
||||
loadMDFCommand(primitive_sphere),
|
||||
//loadMDFCommand(primitive_torus),
|
||||
])
|
||||
}
|
||||
1
modules/3d-party/primitive_sphere/docs/index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
place holder
|
||||
BIN
modules/3d-party/primitive_sphere/icon32.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
modules/3d-party/primitive_sphere/icon96.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
46
modules/3d-party/primitive_sphere/index.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { ApplicationContext } from 'context';
|
||||
import { MBrepShell } from '../../../web/app/cad/model/mshell';
|
||||
import { roundValueForPresentation as r } from '../../../web/app/cad/craft/operationHelper';
|
||||
import { occ2brep } from '../../../web/app/cad/occ/occ2models';
|
||||
|
||||
export const primitive_sphere = {
|
||||
id: 'primitive_sphere',
|
||||
label: 'primitive_sphere',
|
||||
icon: 'img/cad/extrude',
|
||||
info: 'primitive_sphere',
|
||||
mutualExclusiveFields: [],
|
||||
paramsInfo: ({ diameter }) => `(${r(diameter)} )`,
|
||||
run: ({ diameter, }, ctx: ApplicationContext) => {
|
||||
|
||||
const oc = ctx.occService.occContext;
|
||||
|
||||
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||
const sphereCenterline = oc.gp.DZ();
|
||||
const sphereOrientationAndLocation = new oc.gp_Ax2_3(myLocation, sphereCenterline);
|
||||
|
||||
|
||||
let myBody = new oc.BRepPrimAPI_MakeSphere_1(diameter);
|
||||
//let myBody = new oc.BRepPrimAPI_Make
|
||||
|
||||
const aRes = new oc.TopoDS_Compound();
|
||||
const aBuilder = new oc.BRep_Builder();
|
||||
aBuilder.MakeCompound(aRes);
|
||||
aBuilder.Add(aRes, myBody.Shape());
|
||||
|
||||
|
||||
|
||||
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||
return {
|
||||
consumed: [],
|
||||
created: [mobject]
|
||||
};
|
||||
},
|
||||
schema: {
|
||||
diameter: {
|
||||
type: 'number',
|
||||
defaultValue: 200,
|
||||
label: 'diameter'
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
1
modules/3d-party/primitive_torus/docs/index.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
place holder
|
||||
BIN
modules/3d-party/primitive_torus/icon32.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
modules/3d-party/primitive_torus/icon96.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
51
modules/3d-party/primitive_torus/index.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import { ApplicationContext } from 'context';
|
||||
import { MBrepShell } from '../../../web/app/cad/model/mshell';
|
||||
import { roundValueForPresentation as r } from '../../../web/app/cad/craft/operationHelper';
|
||||
import { occ2brep } from '../../../web/app/cad/occ/occ2models';
|
||||
|
||||
export const primitive_torus = {
|
||||
id: 'primitive_torus',
|
||||
label: 'primitive_torus',
|
||||
icon: 'img/cad/extrude',
|
||||
info: 'primitive_torus',
|
||||
mutualExclusiveFields: [],
|
||||
paramsInfo: ({ radius, tubeRadius }) => `(${r(radius)} ${r(tubeRadius)} )`,
|
||||
run: ({ radius, tubeRadius }, ctx: ApplicationContext) => {
|
||||
|
||||
const oc = ctx.occService.occContext;
|
||||
|
||||
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||
const torusCenterline = oc.gp.DZ();
|
||||
const torusOrientationAndLocation = new oc.gp_Ax2_3(myLocation, torusCenterline);
|
||||
|
||||
|
||||
let myBody = new oc.BRepPrimAPI_MakeTorus_1(radius, tubeRadius);
|
||||
//let myBody = new oc.BRepPrimAPI_Make
|
||||
|
||||
const aRes = new oc.TopoDS_Compound();
|
||||
const aBuilder = new oc.BRep_Builder();
|
||||
aBuilder.MakeCompound(aRes);
|
||||
aBuilder.Add(aRes, myBody.Shape());
|
||||
|
||||
|
||||
|
||||
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||
return {
|
||||
consumed: [],
|
||||
created: [mobject]
|
||||
};
|
||||
},
|
||||
schema: {
|
||||
radius : {
|
||||
type: 'number',
|
||||
defaultValue: 200,
|
||||
label: 'radius'
|
||||
},
|
||||
tubeRadius: {
|
||||
type: 'number',
|
||||
defaultValue: 50,
|
||||
label: 'tube radius'
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
5
package-lock.json
generated
|
|
@ -73,7 +73,6 @@
|
|||
"integrity": "sha512-XXLgAm6LBbaNxaGhMAznXXaxtCWfuv6PIDJ9Alsy9JYTOh+j2jJz+L/162kkfU1j/pTSxK1xGmlwI4pdIMkoag==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chokidar": "^2.1.8",
|
||||
"commander": "^4.0.1",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"fs-readdir-recursive": "^1.1.0",
|
||||
|
|
@ -3327,7 +3326,6 @@
|
|||
"anymatch": "^2.0.0",
|
||||
"async-each": "^1.0.1",
|
||||
"braces": "^2.3.2",
|
||||
"fsevents": "^1.2.7",
|
||||
"glob-parent": "^3.1.0",
|
||||
"inherits": "^2.0.3",
|
||||
"is-binary-path": "^1.0.0",
|
||||
|
|
@ -8544,12 +8542,9 @@
|
|||
"clone": "^2.1.2",
|
||||
"errno": "^0.1.1",
|
||||
"graceful-fs": "^4.1.2",
|
||||
"image-size": "~0.5.0",
|
||||
"mime": "^1.4.1",
|
||||
"mkdirp": "^0.5.0",
|
||||
"promise": "^7.1.1",
|
||||
"request": "^2.83.0",
|
||||
"source-map": "~0.6.0",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"bin": {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export default [
|
|||
label: 'add',
|
||||
cssIcons: ['cube'],
|
||||
info: 'set of available solid creation operations',
|
||||
actions: ['PLANE', 'BOX', 'SPHERE', 'CONE', 'CYLINDER', 'TORUS']
|
||||
actions: ['PLANE', "primitive_cylinder", "primitive_box", "primitive_cone", "primitive_sphere", "primitive_torus"]
|
||||
},
|
||||
{
|
||||
id: 'views',
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ import {intersectionOperation, subtractOperation, unionOperation} from '../craft
|
|||
import { loadMDFCommand } from '../mdf/mdf';
|
||||
import { MDF_EXTRUDE_EXAMPLE } from '../mdf/mdfExtrudeExample';
|
||||
import { OCC_BOTTLE_OPERATION } from '3d-party/occ-bottle/bottleOperation';
|
||||
import { primitive_cylinder } from '3d-party/primitive_cylinder/index';
|
||||
import { primitive_box } from '3d-party/primitive_box/index';
|
||||
import { primitive_cone } from '3d-party/primitive_cone/index';
|
||||
import { primitive_sphere } from '3d-party/primitive_sphere/index';
|
||||
import { primitive_torus } from '3d-party/primitive_torus/index';
|
||||
|
||||
|
||||
export function activate({services}) {
|
||||
|
|
@ -42,6 +47,11 @@ export function activate({services}) {
|
|||
intersectionOperation,
|
||||
subtractOperation,
|
||||
unionOperation,
|
||||
loadMDFCommand(OCC_BOTTLE_OPERATION)
|
||||
loadMDFCommand(OCC_BOTTLE_OPERATION),
|
||||
loadMDFCommand(primitive_cylinder),
|
||||
loadMDFCommand(primitive_box),
|
||||
loadMDFCommand(primitive_cone),
|
||||
loadMDFCommand(primitive_sphere),
|
||||
loadMDFCommand(primitive_torus),
|
||||
])
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ import {GrSelect} from "react-icons/gr";
|
|||
|
||||
export const STANDARD_MODE_HEADS_UP_TOOLBAR = ['DATUM_CREATE', 'PLANE', 'EditFace', 'EXTRUDE', 'CUT', 'REVOLVE', 'LOFT',
|
||||
'-', 'FILLET', '-', 'INTERSECTION', 'SUBTRACT', 'UNION', '-', 'IMPORT_PART', "IMPORT_STEP_FILE", "IMPORT_STEP_LOCAL_FILE",
|
||||
"ExportFaceToDXF", 'OCC_BOTTLE'];
|
||||
"ExportFaceToDXF", 'OCC_BOTTLE', "primitive_cylinder", "primitive_box", "primitive_cone", "primitive_sphere","primitive_torus"];
|
||||
|
||||
export function activate({services, streams}) {
|
||||
streams.ui.controlBars.left.value = ['menu.file', 'menu.craft', 'menu.boolean', 'menu.primitives', 'menu.views', 'Donate', 'GitHub'];
|
||||
|
|
|
|||