From 1fdb2906b498382116589bca29d5995e59d26062 Mon Sep 17 00:00:00 2001 From: Mike Molinari Date: Sun, 26 Sep 2021 01:12:37 +0000 Subject: [PATCH] moved color enum field to within schema object --- .../examples/features/occ_bottle/index.ts | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/modules/workbenches/examples/features/occ_bottle/index.ts b/modules/workbenches/examples/features/occ_bottle/index.ts index 70faa487..4c982053 100644 --- a/modules/workbenches/examples/features/occ_bottle/index.ts +++ b/modules/workbenches/examples/features/occ_bottle/index.ts @@ -3,7 +3,7 @@ import { MBrepShell } from 'cad/model/mshell'; import { roundValueForPresentation as r } from 'cad/craft/operationHelper'; import { createOCCBottle } from './bottle.occ'; import { occ2brep } from 'cad/occ/occ2models'; -import icon from './icon.svg'; +import icon from './icon.svg'; export default { id: 'OCC_BOTTLE', @@ -14,7 +14,7 @@ export default { }, info: 'create occ bottle', mutualExclusiveFields: [], - paramsInfo: ({ width, height, thickness }) => `(${r(width)} ${r(height)} ${r(thickness)})`, + paramsInfo: ({ width, height, thickness, color }) => `(${r(width)} ${r(height)} ${r(thickness)} ${r(color)})`, schema: { width: { type: 'number', @@ -31,24 +31,27 @@ export default { min: 0, label: 'thickness', defaultValue: 150 - } + }, + color: { + type: 'enum', + defaultValue: "red", + label: 'Color', + options: [ + { + label: 'Red', + value: 'red' + }, + { + label: 'Green', + value: 'green' + }, + ], + }, }, - color: { - type: 'enum', - options: [ - { - label: 'Red', - value: 'red' - }, - { - label: 'Green', - value: 'green' - } - ] - }, - run: ({ width, height, thickness }, ctx: ApplicationContext) => { + run: ({ width, height, thickness, color }, ctx: ApplicationContext) => { const occObj = createOCCBottle(width, height, thickness, ctx.occService.occContext); const mobject = new MBrepShell(occ2brep(occObj, ctx.occService.occContext)); + console.log(color); return { consumed: [], created: [mobject]