diff --git a/web/app/cad/craft/primitives/simplePlane/simplePlaneOperation.js b/modules/workbenches/modeler/features/plane/simplePlaneOperation.js similarity index 62% rename from web/app/cad/craft/primitives/simplePlane/simplePlaneOperation.js rename to modules/workbenches/modeler/features/plane/simplePlaneOperation.js index 042fd947..2d717870 100644 --- a/web/app/cad/craft/primitives/simplePlane/simplePlaneOperation.js +++ b/modules/workbenches/modeler/features/plane/simplePlaneOperation.js @@ -1,14 +1,19 @@ import {createMeshGeometry} from 'scene/geoms'; import {Plane} from 'geom/impl/plane'; import Vector from 'math/vector'; -import PlaneWizard from './SimplePlaneWizard'; -import {MOpenFaceShell} from '../../../model/mopenFace'; -import schema from './simplePlaneOpSchema'; -import {PlaneSurfacePrototype} from '../../../model/surfacePrototype'; +import {MOpenFaceShell} from '../../../../../web/app/cad/model/mopenFace'; +import {PlaneSurfacePrototype} from '../../../../../web/app/cad/model/surfacePrototype'; import {STANDARD_BASES} from 'math/basis'; import {MFace} from "cad/model/mface"; import CSys from "math/csys"; import {MDatum} from "cad/model/mdatum"; +import {EntityKind} from "cad/model/entities"; +import {entityKindCapture} from "cad/craft/schema/types/entityType"; + + + + + function paramsToPlane({orientation, datum, depth}, cadRegistry) { const csys = datum ? datum.csys : CSys.ORIGIN; @@ -55,8 +60,35 @@ export default { paramsInfo: ({depth}) => `(${depth})`, previewGeomProvider, run: createPlane, - form: PlaneWizard, - schema + form: [ + { + type: 'choice', + style: "dropdown", + label: 'orientation', + name: 'orientation', + style: 'radio', + values: ['XY', 'XZ', 'ZY'], + defaultValue: "XY", + }, + { + type: 'selection', + name: 'datum', + capture: [EntityKind.MDatum,EntityKind.FACE], + label: 'datum', + multi: false, + optional: true, + defaultValue: { + usePreselection: true, + preselectionIndex: 0 + }, + }, + { + type: 'number', + label: 'depth', + name: 'depth', + defaultValue: 0, + }, + ], }; diff --git a/web/app/cad/craft/primitives/plane/PlaneWizard.jsx b/web/app/cad/craft/primitives/plane/PlaneWizard.jsx deleted file mode 100644 index 2c5b8194..00000000 --- a/web/app/cad/craft/primitives/plane/PlaneWizard.jsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import {Group} from '../../wizard/components/form/Form'; -import Entity from '../../wizard/components/form/Entity'; - - -export default function PlaneWizard() { - return - - ; -} \ No newline at end of file diff --git a/web/app/cad/craft/primitives/plane/planeOperation.js b/web/app/cad/craft/primitives/plane/planeOperation.js deleted file mode 100644 index 0a3101f3..00000000 --- a/web/app/cad/craft/primitives/plane/planeOperation.js +++ /dev/null @@ -1,52 +0,0 @@ -import {createMeshGeometry} from 'scene/geoms'; -import {Plane} from 'geom/impl/plane'; -import Vector from 'math/vector'; -import PlaneWizard from './PlaneWizard'; -import {MOpenFaceShell} from '../../../model/mopenFace'; -import schema from './planeOpSchema'; -import {CSysPlaneSurfacePrototype} from '../../../model/surfacePrototype'; - -const WIDTH = 750; -const HEIGHT = 750; - -function createPlane(params, services) { - const mDatum = services.cadRegistry.findDatum(params.datum); - - return { - consumed: [mDatum], - created: [new MOpenFaceShell(new CSysPlaneSurfacePrototype(mDatum.csys), mDatum.csys)] - } -} - -function previewGeomProvider(params, services) { - const mDatum = services.cadRegistry.findDatum(params.datum); - - if (!mDatum) { - return null; - } - - const tr = mDatum.csys.outTransformation; - - const a = tr._apply(new Vector(0, 0, 0)); - const b = tr._apply(new Vector(WIDTH, 0, 0)); - const c = tr._apply(new Vector(WIDTH, HEIGHT, 0)); - const d = tr._apply(new Vector(0, HEIGHT, 0)); - - const trs = [[a, b, c], [a, c, d]]; - return createMeshGeometry(trs); -} - -export default { - id: 'PLANE_FROM_DATUM', - label: 'Plane', - icon: 'img/cad/plane', - info: 'creates new object plane off of datum', - paramsInfo: ({datum}) => `(${datum})`, - previewGeomProvider, - run: createPlane, - form: PlaneWizard, - schema -}; - - - diff --git a/web/app/cad/craft/primitives/simplePlane/SimplePlaneWizard.jsx b/web/app/cad/craft/primitives/simplePlane/SimplePlaneWizard.jsx deleted file mode 100644 index 91369f6c..00000000 --- a/web/app/cad/craft/primitives/simplePlane/SimplePlaneWizard.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import {Group} from '../../wizard/components/form/Form'; -import {NumberField, RadioButtonsField} from '../../wizard/components/form/Fields'; -import {RadioButton} from 'ui/components/controls/RadioButtons'; -import Entity from '../../wizard/components/form/Entity'; - - -export default function PlaneWizard() { - return - - - - - - - - ; -} \ No newline at end of file diff --git a/web/app/cad/craft/primitives/simplePlane/simplePlaneOpSchema.js b/web/app/cad/craft/primitives/simplePlane/simplePlaneOpSchema.js deleted file mode 100644 index 88279a0a..00000000 --- a/web/app/cad/craft/primitives/simplePlane/simplePlaneOpSchema.js +++ /dev/null @@ -1,22 +0,0 @@ -import {entityKindCapture} from "cad/craft/schema/types/entityType"; - -export default { - orientation: { - type: 'string', - enum: ['XY', 'XZ', 'ZY'], - defaultValue: 'XY' - }, - datum: { - type: 'entity', - entityCapture: entityKindCapture('face', 'datum'), - optional: true, - defaultValue: { - usePreselection: true, - preselectionIndex: 0, - } - }, - depth: { - type: 'number', - defaultValue: 0 - } -} \ No newline at end of file diff --git a/web/app/cad/workbench/workbenchesLoaderBundle.ts b/web/app/cad/workbench/workbenchesLoaderBundle.ts index 1db5ed95..a8a99e67 100644 --- a/web/app/cad/workbench/workbenchesLoaderBundle.ts +++ b/web/app/cad/workbench/workbenchesLoaderBundle.ts @@ -1,9 +1,9 @@ import {WorkbenchRegistry} from "workbenches/registry"; -import planeOperation from "cad/craft/primitives/simplePlane/simplePlaneOperation"; +import planeOperation from "workbenches/modeler/features/plane/simplePlaneOperation"; import createDatumOperation from "cad/craft/datum/create/createDatumOperation"; import moveDatumOperation from "cad/craft/datum/move/moveDatumOperation"; import rotateDatumOperation from "cad/craft/datum/rotate/rotateDatumOperation"; -import datumOperation from "cad/craft/primitives/plane/planeOperation"; + import {Bundle} from "bundler/bundleSystem"; import {WorkbenchService} from "cad/workbench/workbenchService"; import {OperationService} from "cad/craft/operationBundle"; @@ -37,6 +37,5 @@ function registerCoreOperations(ctx: WorkbenchesLoaderActivationContext) { createDatumOperation, moveDatumOperation, rotateDatumOperation, - datumOperation, ] as any); } \ No newline at end of file