diff --git a/web/app/cad/craft/e0/e0Plugin.js b/web/app/cad/craft/e0/e0Plugin.js
index 3c9ba556..13f06d12 100644
--- a/web/app/cad/craft/e0/e0Plugin.js
+++ b/web/app/cad/craft/e0/e0Plugin.js
@@ -23,9 +23,6 @@ export function activate(ctx) {
loadWasm(ctx);
ctx.services.operation.handlers.push(operationHandler);
- function shellsToPointers(shells) {
- return shells.filter(managedByE0).map(m => m.brepShell.data.externals.ptr);
- }
function booleanBasedOperation(engineParams, params, impl) {
engineParams.deflection = DEFLECTION;
if (params.boolean && BOOLEAN_TYPES[params.boolean.type] > 0) {
@@ -105,6 +102,10 @@ export function activate(ctx) {
}
}
+function shellsToPointers(shells) {
+ return shells.filter(managedByE0).map(m => m.brepShell.data.externals.ptr);
+}
+
function writeCsys(csys, swapToY) {
return {
origin: csys.origin.data(),
@@ -133,12 +134,6 @@ function operationHandler(id, request, services) {
}
case 'REVOLVE': {
let {request: engineReq, face} = createRevolveCommand(request, services);
- if (managedByE0(face.shell)) {
- engineReq.boolean = {
- type: request.subtract ? BOOLEAN_TYPES.SUBTRACT : BOOLEAN_TYPES.UNION,
- operand: face.shell.brepShell.data.externals.ptr
- }
- }
let data = callEngine(engineReq, Module._SPI_revolve);
return singleShellRespone(face.shell, data);
}
@@ -252,7 +247,7 @@ function createRevolveCommand(request, {cadRegistry, sketcher}) {
let axisOrigin = tr._apply3(pivot.a.data());
let axisDir = vec._normalize(vec._sub(tr._apply3(pivot.b.data()), axisOrigin))
- return {
+ let res = {
face,
request: {
axisOrigin,
@@ -263,6 +258,13 @@ function createRevolveCommand(request, {cadRegistry, sketcher}) {
deflection: DEFLECTION
}
};
+ if (managedByE0(face.shell) && request.boolean && BOOLEAN_TYPES[request.boolean] > 0) {
+ res.request.boolean = {
+ type: BOOLEAN_TYPES[request.boolean],
+ operand: face.shell.brepShell.data.externals.ptr
+ }
+ }
+ return res;
}
diff --git a/web/app/cad/craft/materializeParams.js b/web/app/cad/craft/materializeParams.js
index 026a908a..fb2397d1 100644
--- a/web/app/cad/craft/materializeParams.js
+++ b/web/app/cad/craft/materializeParams.js
@@ -43,7 +43,7 @@ export default function materializeParams(services, params, schema, result, erro
}
} else if (md.type === 'enum') {
if (md.values.indexOf(value) === -1) {
- errors.push({path: [...parentPath, field], message: 'invalid value'});
+ value = md.defaultValue || md.values[0];
}
} else if (isEntityType(md.type)) {
if (typeof value !== 'string') {
diff --git a/web/app/cad/craft/revolve/RevolveForm.jsx b/web/app/cad/craft/revolve/RevolveForm.jsx
index afacec7a..68cf7f05 100644
--- a/web/app/cad/craft/revolve/RevolveForm.jsx
+++ b/web/app/cad/craft/revolve/RevolveForm.jsx
@@ -2,6 +2,7 @@ import React from 'react';
import {CheckboxField, NumberField} from '../wizard/components/form/Fields';
import {Group} from '../wizard/components/form/Form';
import Entity from '../wizard/components/form/Entity';
+import BooleanChoice from '../wizard/components/form/BooleanChioce';
export default function RevolveForm() {
@@ -9,6 +10,6 @@ export default function RevolveForm() {
-
+
;
}
\ No newline at end of file
diff --git a/web/app/cad/craft/revolve/schema.js b/web/app/cad/craft/revolve/schema.js
index 01d31d25..dbfe9bfd 100644
--- a/web/app/cad/craft/revolve/schema.js
+++ b/web/app/cad/craft/revolve/schema.js
@@ -13,7 +13,8 @@ export default {
},
boolean: {
type: 'enum',
- values: ['union', 'subtract', 'intersect', 'none'],
- defaultValue: 'none'
+ values: ['INTERSECT', 'SUBTRACT', 'UNION'],
+ defaultValue: 'UNION',
+ optional: true
}
}