diff --git a/web/app/cad/craft/primitives/simplePlane/SimplePlaneWizard.jsx b/web/app/cad/craft/primitives/simplePlane/SimplePlaneWizard.jsx
index 15bc911a..91369f6c 100644
--- a/web/app/cad/craft/primitives/simplePlane/SimplePlaneWizard.jsx
+++ b/web/app/cad/craft/primitives/simplePlane/SimplePlaneWizard.jsx
@@ -12,7 +12,7 @@ export default function PlaneWizard() {
-
+
;
}
\ 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
index 165cf07d..56c99000 100644
--- a/web/app/cad/craft/primitives/simplePlane/simplePlaneOpSchema.js
+++ b/web/app/cad/craft/primitives/simplePlane/simplePlaneOpSchema.js
@@ -4,10 +4,14 @@ export default {
enum: ['XY', 'XZ', 'ZY'],
defaultValue: 'XY'
},
- parallelTo: {
+ datum: {
type: 'entity',
- allowedKinds: ['face'],
+ allowedKinds: ['face', 'datum'],
optional: true,
+ defaultValue: {
+ usePreselection: true,
+ preselectionIndex: 0,
+ }
},
depth: {
type: 'number',
diff --git a/web/app/cad/craft/primitives/simplePlane/simplePlaneOperation.js b/web/app/cad/craft/primitives/simplePlane/simplePlaneOperation.js
index b5e89f5a..1c74fb6c 100644
--- a/web/app/cad/craft/primitives/simplePlane/simplePlaneOperation.js
+++ b/web/app/cad/craft/primitives/simplePlane/simplePlaneOperation.js
@@ -6,21 +6,25 @@ import {MOpenFaceShell} from '../../../model/mopenFace';
import schema from './simplePlaneOpSchema';
import {PlaneSurfacePrototype} from '../../../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";
-function paramsToPlane({orientation, parallelTo, depth}, cadRegistry) {
- let face = null;
- if (parallelTo) {
- face = cadRegistry.findFace(parallelTo);
- }
- let plane = null;
- if (face === null) {
- const normal = STANDARD_BASES[orientation][2];
- plane = new Plane(normal, depth);
+function paramsToPlane({orientation, datum, depth}, cadRegistry) {
+ const csys = datum ? datum.csys : CSys.ORIGIN;
+
+ let axis;
+ if (orientation === 'XY') {
+ axis = csys.z;
+ } else if (orientation === 'XZ') {
+ axis = csys.y;
} else {
- let base = face.surface.tangentPlaneInMiddle();
- plane = new Plane(base.normal, base.w + depth);
+ axis = csys.x;
}
- return plane;
+
+ const w = axis.multiply(depth)._plus(csys.origin).dot(axis);
+
+ return new Plane(axis, w);
}
function createPlane(params, {cadRegistry}) {
diff --git a/web/app/cad/craft/schema/initializeBySchema.ts b/web/app/cad/craft/schema/initializeBySchema.ts
index d2a27362..fbb5bd20 100644
--- a/web/app/cad/craft/schema/initializeBySchema.ts
+++ b/web/app/cad/craft/schema/initializeBySchema.ts
@@ -23,6 +23,7 @@ export default function initializeBySchema(schema: OperationSchema, context: Cor
}
} else if (md.type === Types.entity && md.defaultValue !== undefined) {
const defaultValue = md.defaultValue;
+ console.log(defaultValue)
if (defaultValue.usePreselection === true && defaultValue.preselectionIndex !== undefined) {
const allowedKinds = md.allowedKinds;
const currentSelection =
diff --git a/web/app/cad/workbench/menuConfig.js b/web/app/cad/workbench/menuConfig.js
index fa69134b..5f0fe9ae 100644
--- a/web/app/cad/workbench/menuConfig.js
+++ b/web/app/cad/workbench/menuConfig.js
@@ -53,7 +53,7 @@ export default [
label: 'datum',
cssIcons: ['magic'],
info: 'operations on datum',
- actions: ['DATUM_ROTATE', 'DATUM_MOVE', '-', 'PLANE_FROM_DATUM', '-', 'BOX', 'SPHERE', 'CYLINDER', 'TORUS', 'CONE']
+ actions: ['PLANE', '-', 'BOX', 'SPHERE', 'CYLINDER', 'TORUS', 'CONE']
// actions: ['DATUM_MOVE', 'DATUM_ROTATE', 'DATUM_REBASE', '-', 'PLANE_FROM_DATUM', 'BOX', 'SPHERE', 'TORUS',
// 'CONE', 'CYLINDER']
},