mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-15 04:45:06 +01:00
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { ApplicationContext } from 'context';
|
|
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';
|
|
|
|
export default {
|
|
id: 'OCC_BOTTLE',
|
|
label: 'OCC Bottle',
|
|
icon: {
|
|
iconType: 'svg',
|
|
iconContent: icon
|
|
},
|
|
info: 'create occ bottle',
|
|
mutualExclusiveFields: [],
|
|
paramsInfo: ({ width, height, thickness }) => `(${r(width)} ${r(height)} ${r(thickness)})`,
|
|
schema: {
|
|
width: {
|
|
type: 'number',
|
|
defaultValue: 200,
|
|
label: 'width'
|
|
},
|
|
height: {
|
|
type: 'number',
|
|
defaultValue: 280,
|
|
label: 'height'
|
|
},
|
|
thickness: {
|
|
type: 'number',
|
|
min: 0,
|
|
label: 'thickness',
|
|
defaultValue: 150
|
|
}
|
|
},
|
|
run: ({ width, height, thickness }, ctx: ApplicationContext) => {
|
|
const occObj = createOCCBottle(width, height, thickness, ctx.occService.occContext);
|
|
const mobject = new MBrepShell(occ2brep(occObj, ctx.occService.occContext));
|
|
return {
|
|
consumed: [],
|
|
created: [mobject]
|
|
};
|
|
},
|
|
}
|