mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
mdf icons support
This commit is contained in:
parent
d75969fd11
commit
9bb8c8c012
22 changed files with 828 additions and 11 deletions
|
|
@ -8,7 +8,10 @@ import icon from './icon.svg';
|
||||||
export default {
|
export default {
|
||||||
id: 'OCC_BOTTLE',
|
id: 'OCC_BOTTLE',
|
||||||
label: 'OCC Bottle',
|
label: 'OCC Bottle',
|
||||||
icon,
|
icon: {
|
||||||
|
iconType: 'svg',
|
||||||
|
iconContent: icon
|
||||||
|
},
|
||||||
info: 'create occ bottle',
|
info: 'create occ bottle',
|
||||||
mutualExclusiveFields: [],
|
mutualExclusiveFields: [],
|
||||||
paramsInfo: ({ width, height, thickness }) => `(${r(width)} ${r(height)} ${r(thickness)})`,
|
paramsInfo: ({ width, height, thickness }) => `(${r(width)} ${r(height)} ${r(thickness)})`,
|
||||||
|
|
|
||||||
5
package-lock.json
generated
5
package-lock.json
generated
|
|
@ -74,6 +74,7 @@
|
||||||
"integrity": "sha512-XXLgAm6LBbaNxaGhMAznXXaxtCWfuv6PIDJ9Alsy9JYTOh+j2jJz+L/162kkfU1j/pTSxK1xGmlwI4pdIMkoag==",
|
"integrity": "sha512-XXLgAm6LBbaNxaGhMAznXXaxtCWfuv6PIDJ9Alsy9JYTOh+j2jJz+L/162kkfU1j/pTSxK1xGmlwI4pdIMkoag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"chokidar": "^2.1.8",
|
||||||
"commander": "^4.0.1",
|
"commander": "^4.0.1",
|
||||||
"convert-source-map": "^1.1.0",
|
"convert-source-map": "^1.1.0",
|
||||||
"fs-readdir-recursive": "^1.1.0",
|
"fs-readdir-recursive": "^1.1.0",
|
||||||
|
|
@ -3285,6 +3286,7 @@
|
||||||
"anymatch": "^2.0.0",
|
"anymatch": "^2.0.0",
|
||||||
"async-each": "^1.0.1",
|
"async-each": "^1.0.1",
|
||||||
"braces": "^2.3.2",
|
"braces": "^2.3.2",
|
||||||
|
"fsevents": "^1.2.7",
|
||||||
"glob-parent": "^3.1.0",
|
"glob-parent": "^3.1.0",
|
||||||
"inherits": "^2.0.3",
|
"inherits": "^2.0.3",
|
||||||
"is-binary-path": "^1.0.0",
|
"is-binary-path": "^1.0.0",
|
||||||
|
|
@ -8492,9 +8494,12 @@
|
||||||
"clone": "^2.1.2",
|
"clone": "^2.1.2",
|
||||||
"errno": "^0.1.1",
|
"errno": "^0.1.1",
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
|
"image-size": "~0.5.0",
|
||||||
"mime": "^1.4.1",
|
"mime": "^1.4.1",
|
||||||
"mkdirp": "^0.5.0",
|
"mkdirp": "^0.5.0",
|
||||||
"promise": "^7.1.1",
|
"promise": "^7.1.1",
|
||||||
|
"request": "^2.83.0",
|
||||||
|
"source-map": "~0.6.0",
|
||||||
"tslib": "^1.10.0"
|
"tslib": "^1.10.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ function ActionButton({label, icon, icon96, icon32, cssIcons, symbol, size, noLa
|
||||||
let smallOrMedium = size === 'medium' || size === 'small';
|
let smallOrMedium = size === 'medium' || size === 'small';
|
||||||
if (icon) {
|
if (icon) {
|
||||||
const Icon = icon;
|
const Icon = icon;
|
||||||
icon = <Icon />;
|
icon = <Icon size={size}/>;
|
||||||
}
|
}
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
if (smallOrMedium) {
|
if (smallOrMedium) {
|
||||||
|
|
|
||||||
58
web/app/cad/icons/DeclarativeIcon.tsx
Normal file
58
web/app/cad/icons/DeclarativeIcon.tsx
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { SvgIcon } from 'svg/SvgIcon';
|
||||||
|
import ImgIcon from 'ui/components/ImgIcon';
|
||||||
|
import { IconContent, IconDeclaration, IconSetDef, IconSize, IconType } from './IconDeclaration';
|
||||||
|
|
||||||
|
|
||||||
|
interface IconRenderProps {
|
||||||
|
size: IconSize
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DeclaredIcon(props: IconRenderProps & IconDeclaration & React.HTMLAttributes<HTMLDivElement>) {
|
||||||
|
|
||||||
|
if (props.iconSet) {
|
||||||
|
return <IconSet {...props} />
|
||||||
|
} else {
|
||||||
|
return <Icon {...props} />
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function IconSet(props: IconRenderProps & IconSetDef & React.HTMLAttributes<HTMLDivElement>) {
|
||||||
|
|
||||||
|
const {iconSet} = props;
|
||||||
|
|
||||||
|
let iconDef = iconSet[props.size] | iconSet[IconSize.large] | iconSet[IconSize.medium] | iconSet[IconSize.small]
|
||||||
|
|
||||||
|
return <Icon {...iconDef} {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Icon(props: {
|
||||||
|
iconType: IconType,
|
||||||
|
iconContent: IconContent
|
||||||
|
size: IconSize
|
||||||
|
} & React.HTMLAttributes<HTMLDivElement>) {
|
||||||
|
|
||||||
|
const {iconContent, size, iconType, ...htmlProps} = props;
|
||||||
|
|
||||||
|
const sizeInPx = getSizeInPx(size);
|
||||||
|
|
||||||
|
if (iconType === 'image') {
|
||||||
|
return <ImgIcon url={iconContent} size={sizeInPx} {...htmlProps}/>
|
||||||
|
} else if (props.iconType === 'svg') {
|
||||||
|
return <SvgIcon content={iconContent} size={sizeInPx} {...htmlProps}/>
|
||||||
|
} else {
|
||||||
|
throw 'unsupported icon type ' + iconType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSizeInPx(sizeName: IconSize): number {
|
||||||
|
switch (sizeName) {
|
||||||
|
case 'small': return 16;
|
||||||
|
case 'medium': return 24;
|
||||||
|
case 'large':
|
||||||
|
default:
|
||||||
|
return 48;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
web/app/cad/icons/IconDeclaration.ts
Normal file
24
web/app/cad/icons/IconDeclaration.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
export type IconDeclaration = IconSetDef | IconDef;
|
||||||
|
|
||||||
|
export enum IconSize {
|
||||||
|
small = 'small',
|
||||||
|
medium = 'medium',
|
||||||
|
large = 'large'
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface IconSetDef {
|
||||||
|
iconType: IconType;
|
||||||
|
|
||||||
|
iconSet: {
|
||||||
|
[key in IconSize]: IconDef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type IconType = 'image' | 'svg';
|
||||||
|
|
||||||
|
export type IconContent = any;
|
||||||
|
|
||||||
|
export type IconDef = IconContent | {
|
||||||
|
iconType: IconType;
|
||||||
|
iconContent: IconContent;
|
||||||
|
};
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { IconDeclaration } from "cad/icons/IconDeclaration";
|
||||||
import { CoreContext } from "context";
|
import { CoreContext } from "context";
|
||||||
import { IconType } from "react-icons";
|
import { IconType } from "react-icons";
|
||||||
import { OperationResult } from "../craft/craftPlugin";
|
import { OperationResult } from "../craft/craftPlugin";
|
||||||
|
|
@ -10,7 +11,7 @@ interface MDFCommand<R> {
|
||||||
id: string;
|
id: string;
|
||||||
label: string;
|
label: string;
|
||||||
info: string;
|
info: string;
|
||||||
icon: IconType | string;
|
icon: IconType | IconDeclaration;
|
||||||
run: (request: R, opContext: CoreContext) => OperationResult | Promise<OperationResult>;
|
run: (request: R, opContext: CoreContext) => OperationResult | Promise<OperationResult>;
|
||||||
paramsInfo: (params: R) => string,
|
paramsInfo: (params: R) => string,
|
||||||
schema: OperationSchema,
|
schema: OperationSchema,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
|
import { DeclaredIcon } from 'cad/icons/DeclarativeIcon';
|
||||||
|
import { IconDeclaration } from 'cad/icons/IconDeclaration';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SvgIcon } from "svg/SvgIcon";
|
import { AiOutlineQuestion } from 'react-icons/ai';
|
||||||
|
import { IconType } from 'react-icons/lib';
|
||||||
|
|
||||||
export function resolveMDFIcon(iconDef: any) {
|
export function resolveMDFIcon(iconDef: IconDeclaration | IconType) {
|
||||||
return () => <SvgIcon content={iconDef} />
|
if (iconDef.iconType) {
|
||||||
|
return (props) => <DeclaredIcon {...iconDef} {...props}/>
|
||||||
|
} else {
|
||||||
|
if (!iconDef || typeof(iconDef) !== 'object') {
|
||||||
|
return AiOutlineQuestion;
|
||||||
|
}
|
||||||
|
return iconDef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,11 +99,16 @@ module.exports = {
|
||||||
{
|
{
|
||||||
test: /\.svg$/,
|
test: /\.svg$/,
|
||||||
loader: 'raw-loader'
|
loader: 'raw-loader'
|
||||||
}, {
|
},
|
||||||
test: /\.png$/,
|
{
|
||||||
loader: 'url-loader?mimetype=image/png'
|
test: /\.(png|jpg|gif)$/i,
|
||||||
}
|
use: [
|
||||||
],
|
{
|
||||||
|
loader: 'url-loader'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
fs: "empty"
|
fs: "empty"
|
||||||
|
|
|
||||||
56
workbenches/modeler/features/primitive_box/index.ts
Normal file
56
workbenches/modeler/features/primitive_box/index.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_box',
|
||||||
|
label: 'primitive_box',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_box',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ boxX, boxY, boxZ }) => `(${r(boxX)} ${r(boxY)}) ${r(boxZ)})`,
|
||||||
|
run: ({ boxX, boxY, boxZ }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createCylinder(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
//const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
//const cylinderCenterline = oc.gp.DZ();
|
||||||
|
//const cylinderOrientationAndLocation = new oc.gp_Ax2_3(myLocation, cylinderCenterline);
|
||||||
|
console.log(boxX, boxY, boxZ, oc.BRepPrimAPI_MakeBox_1(boxX, boxY, boxZ))
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeBox_1(boxX, boxY, boxZ );
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
boxX: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'X'
|
||||||
|
},
|
||||||
|
boxY: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'Y'
|
||||||
|
},
|
||||||
|
BoxZ: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'Z'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
50
workbenches/modeler/features/primitive_cone/index.ts
Normal file
50
workbenches/modeler/features/primitive_cone/index.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_cone',
|
||||||
|
label: 'primitive_cone',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_cone',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter, height }) => `(${r(diameter)} ${r(height)})`,
|
||||||
|
run: ({ diameter, height, }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createcone(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const coneCenterline = oc.gp.DZ();
|
||||||
|
const coneOrientationAndLocation = new oc.gp_Ax2_3(myLocation, coneCenterline);
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeCone_1(10,20,100);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'height'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
51
workbenches/modeler/features/primitive_cylinder/index.ts
Normal file
51
workbenches/modeler/features/primitive_cylinder/index.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_cylinder',
|
||||||
|
label: 'primitive_cylinder',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_cylinder',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter, height }) => `(${r(diameter)} ${r(height)})`,
|
||||||
|
run: ({ diameter, height, }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createCylinder(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const cylinderCenterline = oc.gp.DZ();
|
||||||
|
const cylinderOrientationAndLocation = new oc.gp_Ax2_3(myLocation, cylinderCenterline);
|
||||||
|
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeCylinder_3(cylinderOrientationAndLocation, diameter, height,);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'height'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
46
workbenches/modeler/features/primitive_sphere/index.ts
Normal file
46
workbenches/modeler/features/primitive_sphere/index.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_sphere',
|
||||||
|
label: 'primitive_sphere',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_sphere',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter }) => `(${r(diameter)} )`,
|
||||||
|
run: ({ diameter, }, ctx: ApplicationContext) => {
|
||||||
|
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const sphereCenterline = oc.gp.DZ();
|
||||||
|
const sphereOrientationAndLocation = new oc.gp_Ax2_3(myLocation, sphereCenterline);
|
||||||
|
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeSphere_1(diameter);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
56
workbenches/modeller/feature/primitive_box/index.ts
Normal file
56
workbenches/modeller/feature/primitive_box/index.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_box',
|
||||||
|
label: 'primitive_box',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_box',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ boxX, boxY, boxZ }) => `(${r(boxX)} ${r(boxY)}) ${r(boxZ)})`,
|
||||||
|
run: ({ boxX, boxY, boxZ }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createCylinder(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
//const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
//const cylinderCenterline = oc.gp.DZ();
|
||||||
|
//const cylinderOrientationAndLocation = new oc.gp_Ax2_3(myLocation, cylinderCenterline);
|
||||||
|
console.log(boxX, boxY, boxZ, oc.BRepPrimAPI_MakeBox_1(boxX, boxY, boxZ))
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeBox_1(boxX, boxY, boxZ );
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
boxX: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'X'
|
||||||
|
},
|
||||||
|
boxY: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'Y'
|
||||||
|
},
|
||||||
|
BoxZ: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'Z'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
50
workbenches/modeller/feature/primitive_cone/index.ts
Normal file
50
workbenches/modeller/feature/primitive_cone/index.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_cone',
|
||||||
|
label: 'primitive_cone',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_cone',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter, height }) => `(${r(diameter)} ${r(height)})`,
|
||||||
|
run: ({ diameter, height, }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createcone(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const coneCenterline = oc.gp.DZ();
|
||||||
|
const coneOrientationAndLocation = new oc.gp_Ax2_3(myLocation, coneCenterline);
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeCone_1(10,20,100);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'height'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
51
workbenches/modeller/feature/primitive_cylinder/index.ts
Normal file
51
workbenches/modeller/feature/primitive_cylinder/index.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_cylinder',
|
||||||
|
label: 'primitive_cylinder',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_cylinder',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter, height }) => `(${r(diameter)} ${r(height)})`,
|
||||||
|
run: ({ diameter, height, }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createCylinder(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const cylinderCenterline = oc.gp.DZ();
|
||||||
|
const cylinderOrientationAndLocation = new oc.gp_Ax2_3(myLocation, cylinderCenterline);
|
||||||
|
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeCylinder_3(cylinderOrientationAndLocation, diameter, height,);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'height'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
46
workbenches/modeller/feature/primitive_sphere/index.ts
Normal file
46
workbenches/modeller/feature/primitive_sphere/index.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_sphere',
|
||||||
|
label: 'primitive_sphere',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_sphere',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter }) => `(${r(diameter)} )`,
|
||||||
|
run: ({ diameter, }, ctx: ApplicationContext) => {
|
||||||
|
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const sphereCenterline = oc.gp.DZ();
|
||||||
|
const sphereOrientationAndLocation = new oc.gp_Ax2_3(myLocation, sphereCenterline);
|
||||||
|
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeSphere_1(diameter);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
51
workbenches/modeller/feature/primitive_torus/index.ts
Normal file
51
workbenches/modeller/feature/primitive_torus/index.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_torus',
|
||||||
|
label: 'primitive_torus',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_torus',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ radius, tubeRadius }) => `(${r(radius)} ${r(tubeRadius)} )`,
|
||||||
|
run: ({ radius, tubeRadius }, ctx: ApplicationContext) => {
|
||||||
|
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const torusCenterline = oc.gp.DZ();
|
||||||
|
const torusOrientationAndLocation = new oc.gp_Ax2_3(myLocation, torusCenterline);
|
||||||
|
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeTorus_1(radius, tubeRadius);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
radius : {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'radius'
|
||||||
|
},
|
||||||
|
tubeRadius: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 50,
|
||||||
|
label: 'tube radius'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
56
workbenches/modeller/features/primitive_box/index.ts
Normal file
56
workbenches/modeller/features/primitive_box/index.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_box',
|
||||||
|
label: 'primitive_box',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_box',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ boxX, boxY, boxZ }) => `(${r(boxX)} ${r(boxY)}) ${r(boxZ)})`,
|
||||||
|
run: ({ boxX, boxY, boxZ }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createCylinder(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
//const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
//const cylinderCenterline = oc.gp.DZ();
|
||||||
|
//const cylinderOrientationAndLocation = new oc.gp_Ax2_3(myLocation, cylinderCenterline);
|
||||||
|
console.log(boxX, boxY, boxZ, oc.BRepPrimAPI_MakeBox_1(boxX, boxY, boxZ))
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeBox_1(boxX, boxY, boxZ );
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
boxX: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'X'
|
||||||
|
},
|
||||||
|
boxY: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'Y'
|
||||||
|
},
|
||||||
|
BoxZ: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'Z'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
50
workbenches/modeller/features/primitive_cone/index.ts
Normal file
50
workbenches/modeller/features/primitive_cone/index.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_cone',
|
||||||
|
label: 'primitive_cone',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_cone',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter, height }) => `(${r(diameter)} ${r(height)})`,
|
||||||
|
run: ({ diameter, height, }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createcone(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const coneCenterline = oc.gp.DZ();
|
||||||
|
const coneOrientationAndLocation = new oc.gp_Ax2_3(myLocation, coneCenterline);
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeCone_1(10,20,100);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'height'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
51
workbenches/modeller/features/primitive_cylinder/index.ts
Normal file
51
workbenches/modeller/features/primitive_cylinder/index.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_cylinder',
|
||||||
|
label: 'primitive_cylinder',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_cylinder',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter, height }) => `(${r(diameter)} ${r(height)})`,
|
||||||
|
run: ({ diameter, height, }, ctx: ApplicationContext) => {
|
||||||
|
//const occObj = createCylinder(diameter, height, ctx.occService.occContext);
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const cylinderCenterline = oc.gp.DZ();
|
||||||
|
const cylinderOrientationAndLocation = new oc.gp_Ax2_3(myLocation, cylinderCenterline);
|
||||||
|
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeCylinder_3(cylinderOrientationAndLocation, diameter, height,);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 280,
|
||||||
|
label: 'height'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
46
workbenches/modeller/features/primitive_sphere/index.ts
Normal file
46
workbenches/modeller/features/primitive_sphere/index.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_sphere',
|
||||||
|
label: 'primitive_sphere',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_sphere',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ diameter }) => `(${r(diameter)} )`,
|
||||||
|
run: ({ diameter, }, ctx: ApplicationContext) => {
|
||||||
|
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const sphereCenterline = oc.gp.DZ();
|
||||||
|
const sphereOrientationAndLocation = new oc.gp_Ax2_3(myLocation, sphereCenterline);
|
||||||
|
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeSphere_1(diameter);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
diameter: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'diameter'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
51
workbenches/modeller/features/primitive_torus/index.ts
Normal file
51
workbenches/modeller/features/primitive_torus/index.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { ApplicationContext } from 'context';
|
||||||
|
import { MBrepShell } from '../../../../../web/app/cad/model/mshell';
|
||||||
|
import { roundValueForPresentation as r } from '../../../../../web/app/cad/craft/operationHelper';
|
||||||
|
import { occ2brep } from '../../../../../web/app/cad/occ/occ2models';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
id: 'primitive_torus',
|
||||||
|
label: 'primitive_torus',
|
||||||
|
icon: 'img/cad/extrude',
|
||||||
|
info: 'primitive_torus',
|
||||||
|
mutualExclusiveFields: [],
|
||||||
|
paramsInfo: ({ radius, tubeRadius }) => `(${r(radius)} ${r(tubeRadius)} )`,
|
||||||
|
run: ({ radius, tubeRadius }, ctx: ApplicationContext) => {
|
||||||
|
|
||||||
|
const oc = ctx.occService.occContext;
|
||||||
|
|
||||||
|
const myLocation = new oc.gp_Pnt_3(0, 0, 0);
|
||||||
|
const torusCenterline = oc.gp.DZ();
|
||||||
|
const torusOrientationAndLocation = new oc.gp_Ax2_3(myLocation, torusCenterline);
|
||||||
|
|
||||||
|
|
||||||
|
let myBody = new oc.BRepPrimAPI_MakeTorus_1(radius, tubeRadius);
|
||||||
|
//let myBody = new oc.BRepPrimAPI_Make
|
||||||
|
|
||||||
|
const aRes = new oc.TopoDS_Compound();
|
||||||
|
const aBuilder = new oc.BRep_Builder();
|
||||||
|
aBuilder.MakeCompound(aRes);
|
||||||
|
aBuilder.Add(aRes, myBody.Shape());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mobject = new MBrepShell(occ2brep(aRes, ctx.occService.occContext));
|
||||||
|
return {
|
||||||
|
consumed: [],
|
||||||
|
created: [mobject]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
radius : {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 200,
|
||||||
|
label: 'radius'
|
||||||
|
},
|
||||||
|
tubeRadius: {
|
||||||
|
type: 'number',
|
||||||
|
defaultValue: 50,
|
||||||
|
label: 'tube radius'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in a new issue