mirror of
https://github.com/xibyte/jsketcher
synced 2026-01-29 19:44:23 +01:00
fix plane off of datum
This commit is contained in:
parent
9e548409b0
commit
3159b19ca3
5 changed files with 25 additions and 16 deletions
|
|
@ -12,7 +12,7 @@ export default function PlaneWizard() {
|
|||
<RadioButton value='XZ' />
|
||||
<RadioButton value='ZY' />
|
||||
</RadioButtonsField>
|
||||
<Entity name='parallelTo' />
|
||||
<Entity name='datum' />
|
||||
<NumberField name='depth' />
|
||||
</Group>;
|
||||
}
|
||||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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}) {
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue