slight refactor torus primitive

This commit is contained in:
Mike Molinari 2021-09-23 03:11:22 +00:00 committed by GitHub
parent 79e25c02c9
commit 3dbbf3ff5f
3 changed files with 23 additions and 13 deletions

View file

@ -0,0 +1,10 @@
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 512 512">
<g>
<g>
<path d="m409.1,150.1h-306.2c-11.3,0-20.4,9.1-20.4,20.4v310.1c0,11.3 9.1,20.4 20.4,20.4h306.3c11.3,0 20.4-9.1 20.4-20.4v-310.1c-0.1-11.3-9.2-20.4-20.5-20.4zm-20.4,310.1h-265.4v-269.3h265.4v269.3z"/>
<path d="m170,135.9h175c11.3,0 20.4-9.1 20.4-20.4v-84.1c0-11.3-9.1-20.4-20.4-20.4h-175c-11.3,0-20.4,9.1-20.4,20.4v84.1c-0.1,11.3 9.1,20.4 20.4,20.4zm20.4-84.1h134.2v43.3h-134.2v-43.3z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 729 B

View file

@ -2,7 +2,7 @@ import { ApplicationContext } from 'context';
import { MBrepShell } from 'cad/model/mshell';
import { roundValueForPresentation as r } from 'cad/craft/operationHelper';
import { occ2brep } from 'cad/occ/occ2models';
import icon from './icon.png';
import icon from './icon.svg';
export default {
id: 'primitive_torus',
@ -11,6 +11,18 @@ export default {
info: 'primitive_torus',
mutualExclusiveFields: [],
paramsInfo: ({ radius, tubeRadius }) => `(${r(radius)} ${r(tubeRadius)} )`,
schema: {
radius: {
type: 'number',
defaultValue: 200,
label: 'radius'
},
tubeRadius: {
type: 'number',
defaultValue: 50,
label: 'tube radius'
},
},
run: ({ radius, tubeRadius }, ctx: ApplicationContext) => {
const oc = ctx.occService.occContext;
@ -36,17 +48,5 @@ export default {
created: [mobject]
};
},
schema: {
radius : {
type: 'number',
defaultValue: 200,
label: 'radius'
},
tubeRadius: {
type: 'number',
defaultValue: 50,
label: 'tube radius'
},
}
}

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB