Measuring and analysing shapes
bitbybit.occt.analysis asks questions of shapes and answers with numbers, points and lists, not new shapes. Use it to size a part, check a fit, find where to put the next feature, or make sure parts do not collide.
Measure
analysis.measure holds the measurements a designer reaches for:
tightBoundingBox,orientedBoundingBoxandboundingBoxInFrame: the box around a shape, aligned with the world, turned to fit it as closely as possible, or in a frame of your own;extrema: the nearest points between two shapes, and their distance;angleBetweenanddihedralAngle: angles between directions and between faces;principalFrame: a shape's centre of mass and principal axes;minCurvatureRadius: the tightest bend of a shape, and where it is.
Volume and area are with the shapes themselves: bitbybit.occt.shapes.solid.getSolidVolume and getSolidSurfaceArea.
Here orientedBoundingBox measures a tilted cone. Its frame stands at the box's centre, with its direction along the longest side and its normal along the shortest, and halfSizes holds half the box's size along each. A cube of size 2 scaled by those half sizes and placed on the frame draws the box:

- Rete
- Blockly
- TypeScript
{
"id": "rete-v2-json",
"nodes": {
"cone": {
"id": "cone",
"name": "bitbybit.occt.shapes.solid.createCone",
"customName": "cone",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius1": 4,
"radius2": 1,
"height": 12,
"angle": 360,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
40
]
},
"leaning": {
"id": "leaning",
"name": "bitbybit.occt.transforms.rotate",
"customName": "rotate",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"axis": [
0,
0,
1
],
"angle": 35
},
"inputs": {
"shape": {
"connections": [
{
"node": "cone",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"part": {
"id": "part",
"name": "bitbybit.occt.transforms.rotate",
"customName": "rotate",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"axis": [
1,
0,
0
],
"angle": 25
},
"inputs": {
"shape": {
"connections": [
{
"node": "leaning",
"output": "result",
"data": {}
}
]
}
},
"position": [
880,
40
]
},
"fit": {
"id": "fit",
"name": "bitbybit.occt.analysis.measure.orientedBoundingBox",
"customName": "oriented bounding box",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"shape": {
"connections": [
{
"node": "part",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
40
]
},
"halfSizes": {
"id": "halfSizes",
"name": "bitbybit.json.getValueOnProp",
"customName": "get value on prop",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"property": "halfSizes"
},
"inputs": {
"json": {
"connections": [
{
"node": "fit",
"output": "result",
"data": {}
}
]
}
},
"position": [
1720,
40
]
},
"frame": {
"id": "frame",
"name": "bitbybit.json.getValueOnProp",
"customName": "get value on prop",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"property": "frame"
},
"inputs": {
"json": {
"connections": [
{
"node": "fit",
"output": "result",
"data": {}
}
]
}
},
"position": [
1720,
288
]
},
"frames": {
"id": "frames",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "frame",
"output": "result",
"data": {}
}
]
}
},
"position": [
2140,
40
]
},
"cube": {
"id": "cube",
"name": "bitbybit.occt.shapes.solid.createCube",
"customName": "cube",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"size": 2,
"center": [
0,
0,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
472
]
},
"sized": {
"id": "sized",
"name": "bitbybit.occt.transforms.scale3d",
"customName": "scale 3d",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"scale": [
1,
1,
1
],
"center": [
0,
0,
0
]
},
"inputs": {
"shape": {
"connections": [
{
"node": "cube",
"output": "result",
"data": {}
}
]
},
"scale": {
"connections": [
{
"node": "halfSizes",
"output": "result",
"data": {}
}
]
}
},
"position": [
2140,
280
]
},
"placed": {
"id": "placed",
"name": "bitbybit.occt.transforms.placeOnFrames",
"customName": "place on frames",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"shape": {
"connections": [
{
"node": "sized",
"output": "result",
"data": {}
}
]
},
"frames": {
"connections": [
{
"node": "frames",
"output": "list",
"data": {}
}
]
}
},
"position": [
2560,
40
]
},
"seeThrough": {
"id": "seeThrough",
"name": "bitbybit.draw.optionsOcctShape",
"customName": "options occt shape",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"faceOpacity": 0.25,
"edgeOpacity": 1,
"edgeColour": "#5f6773",
"faceColour": "#ffffff",
"vertexColour": "#ff00ff",
"edgeWidth": 2,
"edgeWidthBySize": false,
"vertexSize": 0.03,
"drawEdges": true,
"drawFaces": true,
"drawVertices": false,
"precision": 0.01,
"angularDeflection": 0.5,
"relativeDeflection": false,
"precisionShare": 0,
"drawEdgeIndexes": false,
"edgeIndexHeight": 0.06,
"edgeIndexColour": "#ff00ff",
"drawFaceIndexes": false,
"faceIndexHeight": 0.06,
"faceIndexColour": "#0000ff",
"drawTwoSided": false,
"backFaceColour": "#0000ff",
"backFaceOpacity": 1,
"edgeArrowSize": 0,
"edgeArrowAngle": 15,
"keepMeshData": false,
"allowQualityDecrease": true,
"forceFaceDeflection": false,
"drawIsoCurves": false,
"isoCurvesU": 5,
"isoCurvesV": 5,
"isoCurvesColour": "#808080",
"surfaceAnalysis": "none",
"draftDirection": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
766
]
},
"drawBox": {
"id": "drawBox",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "placed",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "seeThrough",
"output": "result",
"data": {}
}
]
}
},
"position": [
2980,
40
]
},
"view": {
"id": "view",
"name": "bitbybit.babylon.scene.adjustActiveArcRotateCamera",
"customName": "adjust active arc rotate camera",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"position": [
0,
21,
-36
],
"lookAt": [
-3,
4,
2
],
"lowerBetaLimit": 1,
"upperBetaLimit": 179,
"angularSensibilityX": 1000,
"angularSensibilityY": 1000,
"maxZ": 1000,
"panningSensibility": 1000,
"wheelPrecision": 3
},
"inputs": {},
"position": [
2980,
334
]
}
},
"modules": {}
}
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="part">part</variable><variable id="fit">fit</variable></variables><block type="variables_set" x="40" y="40"><field name="VAR" id="part">part</field><value name="VALUE"><block type="bitbybit.occt.transforms.rotate"><value name="Shape"><block type="bitbybit.occt.transforms.rotate"><value name="Shape"><block type="bitbybit.occt.shapes.solid.createCone"><value name="Radius1"><block type="math_number"><field name="NUM">4</field></block></value><value name="Radius2"><block type="math_number"><field name="NUM">1</field></block></value><value name="Height"><block type="math_number"><field name="NUM">12</field></block></value><value name="Angle"><block type="math_number"><field name="NUM">360</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Direction"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><value name="Axis"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">1</field></block></value></block></value><value name="Angle"><block type="math_number"><field name="NUM">35</field></block></value></block></value><value name="Axis"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">1</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Angle"><block type="math_number"><field name="NUM">25</field></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="variables_get"><field name="VAR" id="part">part</field></block></value><next><block type="variables_set"><field name="VAR" id="fit">fit</field><value name="VALUE"><block type="base_time_await_return"><value name="Promise"><block type="bitbybit.occt.analysis.measure.orientedBoundingBox"><value name="Shape"><block type="variables_get"><field name="VAR" id="part">part</field></block></value></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="bitbybit.occt.transforms.placeOnFrames"><value name="Shape"><block type="bitbybit.occt.transforms.scale3d"><value name="Shape"><block type="bitbybit.occt.shapes.solid.createCube"><value name="Size"><block type="math_number"><field name="NUM">2</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="OriginOnCenter"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value><value name="Scale"><block type="bitbybit.json.getValueOnProp"><value name="Json"><block type="variables_get"><field name="VAR" id="fit">fit</field></block></value><value name="Property"><block type="text"><field name="TEXT">halfSizes</field></block></value></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><value name="Frames"><block type="lists_create_with"><mutation items="1"></mutation><value name="ADD0"><block type="bitbybit.json.getValueOnProp"><value name="Json"><block type="variables_get"><field name="VAR" id="fit">fit</field></block></value><value name="Property"><block type="text"><field name="TEXT">frame</field></block></value></block></value></block></value></block></value><value name="Options"><block type="bitbybit.draw.optionsOcctShape"><value name="FaceOpacity"><block type="math_number"><field name="NUM">0.25</field></block></value><value name="EdgeOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeColour"><block type="colour_picker"><field name="COLOUR">#5f6773</field></block></value><value name="FaceColour"><block type="colour_picker"><field name="COLOUR">#ffffff</field></block></value><value name="VertexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="EdgeWidth"><block type="math_number"><field name="NUM">2</field></block></value><value name="EdgeWidthBySize"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="VertexSize"><block type="math_number"><field name="NUM">0.03</field></block></value><value name="DrawEdges"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawFaces"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawVertices"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Precision"><block type="math_number"><field name="NUM">0.01</field></block></value><value name="AngularDeflection"><block type="math_number"><field name="NUM">0.5</field></block></value><value name="RelativeDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="PrecisionShare"><block type="math_number"><field name="NUM">0</field></block></value><value name="DrawEdgeIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="EdgeIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="EdgeIndexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="DrawFaceIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="FaceIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="FaceIndexColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="DrawTwoSided"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="BackFaceColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="BackFaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeArrowSize"><block type="math_number"><field name="NUM">0</field></block></value><value name="EdgeArrowAngle"><block type="math_number"><field name="NUM">15</field></block></value><value name="KeepMeshData"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="AllowQualityDecrease"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="ForceFaceDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="DrawIsoCurves"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="IsoCurvesU"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesV"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesColour"><block type="colour_picker"><field name="COLOUR">#808080</field></block></value><value name="SurfaceAnalysis"><block type="bitbybit.occt.enums.surfaceAnalysisEnum"><field name="bitbybit.occt.enums.surfaceAnalysisEnum">'none'</field></block></value><value name="DraftDirection"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><next><block type="bitbybit.babylon.scene.adjustActiveArcRotateCamera"><value name="Position"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">21</field></block></value><value name="Z"><block type="math_number"><field name="NUM">-36</field></block></value></block></value><value name="LookAt"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">-3</field></block></value><value name="Y"><block type="math_number"><field name="NUM">4</field></block></value><value name="Z"><block type="math_number"><field name="NUM">2</field></block></value></block></value><value name="LowerBetaLimit"><block type="math_number"><field name="NUM">1</field></block></value><value name="UpperBetaLimit"><block type="math_number"><field name="NUM">179</field></block></value><value name="AngularSensibilityX"><block type="math_number"><field name="NUM">1000</field></block></value><value name="AngularSensibilityY"><block type="math_number"><field name="NUM">1000</field></block></value><value name="MaxZ"><block type="math_number"><field name="NUM">1000</field></block></value><value name="PanningSensibility"><block type="math_number"><field name="NUM">1000</field></block></value><value name="WheelPrecision"><block type="math_number"><field name="NUM">3</field></block></value></block></next></block></next></block></next></block></next></block></xml>
const cone = await bitbybit.occt.shapes.solid.createCone({ radius1: 4, radius2: 1, height: 12, angle: 360, center: [0, 0, 0], direction: [0, 1, 0] });
const leaning = await bitbybit.occt.transforms.rotate({ shape: cone, axis: [0, 0, 1], angle: 35 });
const part = await bitbybit.occt.transforms.rotate({ shape: leaning, axis: [1, 0, 0], angle: 25 });
const fit = await bitbybit.occt.analysis.measure.orientedBoundingBox({ shape: part });
const cube = await bitbybit.occt.shapes.solid.createCube({ size: 2, center: [0, 0, 0] });
const sized = await bitbybit.occt.transforms.scale3d({ shape: cube, scale: fit.halfSizes, center: [0, 0, 0] });
const placed = await bitbybit.occt.transforms.placeOnFrames({ shape: sized, frames: [fit.frame] });
const seeThrough = new Bit.Inputs.Draw.DrawOcctShapeOptions();
seeThrough.faceColour = "#ffffff";
seeThrough.faceOpacity = 0.25;
seeThrough.edgeColour = "#5f6773";
seeThrough.drawTwoSided = false;
await bitbybit.draw.drawAnyAsync({ entity: part });
await bitbybit.draw.drawAnyAsync({ entity: placed, options: seeThrough });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [0, 21, -36], lookAt: [-3, 4, 2] });
extrema gives more than the distance. Each result carries the point on each shape and whether it lies on a face, an edge or a vertex, so you can see what is nearest as well as how far:

- Rete
- Blockly
- TypeScript
{
"id": "rete-v2-json",
"nodes": {
"post": {
"id": "post",
"name": "bitbybit.occt.shapes.solid.createCylinder",
"customName": "cylinder",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 2,
"height": 6,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
],
"angle": 360,
"originOnCenter": false
},
"inputs": {},
"position": [
40,
40
]
},
"crate": {
"id": "crate",
"name": "bitbybit.occt.shapes.solid.createBox",
"customName": "box",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 4,
"length": 3,
"height": 3,
"center": [
7,
8,
3
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
472
]
},
"closest": {
"id": "closest",
"name": "bitbybit.occt.analysis.measure.extrema",
"customName": "extrema",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"shapeA": {
"connections": [
{
"node": "post",
"output": "result",
"data": {}
}
]
},
"shapeB": {
"connections": [
{
"node": "crate",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"nearest": {
"id": "nearest",
"name": "bitbybit.lists.getItem",
"customName": "get item",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"index": 0,
"clone": true
},
"inputs": {
"list": {
"connections": [
{
"node": "closest",
"output": "result",
"data": {}
}
]
}
},
"position": [
880,
40
]
},
"onPost": {
"id": "onPost",
"name": "bitbybit.json.getValueOnProp",
"customName": "get value on prop",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"property": "pointA"
},
"inputs": {
"json": {
"connections": [
{
"node": "nearest",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
40
]
},
"onCrate": {
"id": "onCrate",
"name": "bitbybit.json.getValueOnProp",
"customName": "get value on prop",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"property": "pointB"
},
"inputs": {
"json": {
"connections": [
{
"node": "nearest",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
288
]
},
"link": {
"id": "link",
"name": "bitbybit.occt.shapes.wire.createLineWire",
"customName": "line wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"start": [
0,
0,
0
],
"end": [
0,
1,
0
]
},
"inputs": {
"start": {
"connections": [
{
"node": "onPost",
"output": "result",
"data": {}
}
]
},
"end": {
"connections": [
{
"node": "onCrate",
"output": "result",
"data": {}
}
]
}
},
"position": [
1720,
40
]
},
"gap": {
"id": "gap",
"name": "bitbybit.draw.optionsOcctShape",
"customName": "options occt shape",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"faceOpacity": 1,
"edgeOpacity": 1,
"edgeColour": "#ff6a00",
"faceColour": "#ff0000",
"vertexColour": "#ff00ff",
"edgeWidth": 5,
"edgeWidthBySize": false,
"vertexSize": 0.03,
"drawEdges": true,
"drawFaces": true,
"drawVertices": false,
"precision": 0.01,
"angularDeflection": 0.5,
"relativeDeflection": false,
"precisionShare": 0,
"drawEdgeIndexes": false,
"edgeIndexHeight": 0.06,
"edgeIndexColour": "#ff00ff",
"drawFaceIndexes": false,
"faceIndexHeight": 0.06,
"faceIndexColour": "#0000ff",
"drawTwoSided": true,
"backFaceColour": "#0000ff",
"backFaceOpacity": 1,
"edgeArrowSize": 0,
"edgeArrowAngle": 15,
"keepMeshData": false,
"allowQualityDecrease": true,
"forceFaceDeflection": false,
"drawIsoCurves": false,
"isoCurvesU": 5,
"isoCurvesV": 5,
"isoCurvesColour": "#808080",
"surfaceAnalysis": "none",
"draftDirection": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
858
]
},
"drawPost": {
"id": "drawPost",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "post",
"output": "result",
"data": {}
}
]
}
},
"position": [
2140,
40
]
},
"drawCrate": {
"id": "drawCrate",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "crate",
"output": "result",
"data": {}
}
]
}
},
"position": [
2140,
334
]
},
"drawLink": {
"id": "drawLink",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "link",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "gap",
"output": "result",
"data": {}
}
]
}
},
"position": [
2140,
628
]
},
"view": {
"id": "view",
"name": "bitbybit.babylon.scene.adjustActiveArcRotateCamera",
"customName": "adjust active arc rotate camera",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"position": [
12,
18,
-20
],
"lookAt": [
3.5,
4.5,
1
],
"lowerBetaLimit": 1,
"upperBetaLimit": 179,
"angularSensibilityX": 1000,
"angularSensibilityY": 1000,
"maxZ": 1000,
"panningSensibility": 1000,
"wheelPrecision": 3
},
"inputs": {},
"position": [
2140,
922
]
}
},
"modules": {}
}
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="post">post</variable><variable id="crate">crate</variable><variable id="closest">closest</variable><variable id="nearest">nearest</variable></variables><block type="variables_set" x="40" y="200"><field name="VAR" id="post">post</field><value name="VALUE"><block type="bitbybit.occt.shapes.solid.createCylinder"><value name="Radius"><block type="math_number"><field name="NUM">2</field></block></value><value name="Height"><block type="math_number"><field name="NUM">6</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Angle"><block type="math_number"><field name="NUM">360</field></block></value><value name="OriginOnCenter"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value></block></value><next><block type="variables_set"><field name="VAR" id="crate">crate</field><value name="VALUE"><block type="bitbybit.occt.shapes.solid.createBox"><value name="Width"><block type="math_number"><field name="NUM">4</field></block></value><value name="Length"><block type="math_number"><field name="NUM">3</field></block></value><value name="Height"><block type="math_number"><field name="NUM">3</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">7</field></block></value><value name="Y"><block type="math_number"><field name="NUM">8</field></block></value><value name="Z"><block type="math_number"><field name="NUM">3</field></block></value></block></value><value name="OriginOnCenter"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value><next><block type="variables_set"><field name="VAR" id="closest">closest</field><value name="VALUE"><block type="base_time_await_return"><value name="Promise"><block type="bitbybit.occt.analysis.measure.extrema"><value name="ShapeA"><block type="variables_get"><field name="VAR" id="post">post</field></block></value><value name="ShapeB"><block type="variables_get"><field name="VAR" id="crate">crate</field></block></value></block></value></block></value><next><block type="variables_set"><field name="VAR" id="nearest">nearest</field><value name="VALUE"><block type="bitbybit.lists.getItem"><value name="List"><block type="variables_get"><field name="VAR" id="closest">closest</field></block></value><value name="Index"><block type="math_number"><field name="NUM">0</field></block></value><value name="Clone"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="variables_get"><field name="VAR" id="post">post</field></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="variables_get"><field name="VAR" id="crate">crate</field></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="bitbybit.occt.shapes.wire.createLineWire"><value name="Start"><block type="bitbybit.json.getValueOnProp"><value name="Json"><block type="variables_get"><field name="VAR" id="nearest">nearest</field></block></value><value name="Property"><block type="text"><field name="TEXT">pointA</field></block></value></block></value><value name="End"><block type="bitbybit.json.getValueOnProp"><value name="Json"><block type="variables_get"><field name="VAR" id="nearest">nearest</field></block></value><value name="Property"><block type="text"><field name="TEXT">pointB</field></block></value></block></value></block></value><value name="Options"><block type="bitbybit.draw.optionsOcctShape"><value name="FaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeColour"><block type="colour_picker"><field name="COLOUR">#ff6a00</field></block></value><value name="FaceColour"><block type="colour_picker"><field name="COLOUR">#ff0000</field></block></value><value name="VertexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="EdgeWidth"><block type="math_number"><field name="NUM">5</field></block></value><value name="EdgeWidthBySize"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="VertexSize"><block type="math_number"><field name="NUM">0.03</field></block></value><value name="DrawEdges"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawFaces"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawVertices"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Precision"><block type="math_number"><field name="NUM">0.01</field></block></value><value name="AngularDeflection"><block type="math_number"><field name="NUM">0.5</field></block></value><value name="RelativeDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="PrecisionShare"><block type="math_number"><field name="NUM">0</field></block></value><value name="DrawEdgeIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="EdgeIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="EdgeIndexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="DrawFaceIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="FaceIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="FaceIndexColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="DrawTwoSided"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="BackFaceColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="BackFaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeArrowSize"><block type="math_number"><field name="NUM">0</field></block></value><value name="EdgeArrowAngle"><block type="math_number"><field name="NUM">15</field></block></value><value name="KeepMeshData"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="AllowQualityDecrease"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="ForceFaceDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="DrawIsoCurves"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="IsoCurvesU"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesV"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesColour"><block type="colour_picker"><field name="COLOUR">#808080</field></block></value><value name="SurfaceAnalysis"><block type="bitbybit.occt.enums.surfaceAnalysisEnum"><field name="bitbybit.occt.enums.surfaceAnalysisEnum">'none'</field></block></value><value name="DraftDirection"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><next><block type="bitbybit.babylon.scene.adjustActiveArcRotateCamera"><value name="Position"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">12</field></block></value><value name="Y"><block type="math_number"><field name="NUM">18</field></block></value><value name="Z"><block type="math_number"><field name="NUM">-20</field></block></value></block></value><value name="LookAt"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">3.5</field></block></value><value name="Y"><block type="math_number"><field name="NUM">4.5</field></block></value><value name="Z"><block type="math_number"><field name="NUM">1</field></block></value></block></value><value name="LowerBetaLimit"><block type="math_number"><field name="NUM">1</field></block></value><value name="UpperBetaLimit"><block type="math_number"><field name="NUM">179</field></block></value><value name="AngularSensibilityX"><block type="math_number"><field name="NUM">1000</field></block></value><value name="AngularSensibilityY"><block type="math_number"><field name="NUM">1000</field></block></value><value name="MaxZ"><block type="math_number"><field name="NUM">1000</field></block></value><value name="PanningSensibility"><block type="math_number"><field name="NUM">1000</field></block></value><value name="WheelPrecision"><block type="math_number"><field name="NUM">3</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></xml>
const post = await bitbybit.occt.shapes.solid.createCylinder({ radius: 2, height: 6, center: [0, 0, 0], direction: [0, 1, 0] });
const crate = await bitbybit.occt.shapes.solid.createBox({ width: 4, length: 3, height: 3, center: [7, 8, 3] });
const closest = await bitbybit.occt.analysis.measure.extrema({ shapeA: post, shapeB: crate });
const link = await bitbybit.occt.shapes.wire.createLineWire({ start: closest[0].pointA, end: closest[0].pointB });
const gap = new Bit.Inputs.Draw.DrawOcctShapeOptions();
gap.edgeColour = "#ff6a00";
gap.edgeWidth = 5;
await bitbybit.draw.drawAnyAsync({ entity: post });
await bitbybit.draw.drawAnyAsync({ entity: crate });
await bitbybit.draw.drawAnyAsync({ entity: link, options: gap });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [12, 18, -20], lookAt: [3.5, 4.5, 1] });
Clashes
analysis.clashes.betweenShapes checks a list of parts against each other and names every pair that overlaps, touches or comes within a clearance, with their distance and the volume two solids share. selfIntersections finds a shape that cuts through itself, and facesWithin the faces of one shape that come within a clearance of the faces of another.
Here two blocks overlap. The clash names the pair by their places in the list, 0 and 1, with a distance of 0 and the volume they share:

- Rete
- Blockly
- TypeScript
{
"id": "rete-v2-json",
"nodes": {
"first": {
"id": "first",
"name": "bitbybit.occt.shapes.solid.createBox",
"customName": "box",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 3,
"length": 3,
"height": 3,
"center": [
0,
0,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
40
]
},
"second": {
"id": "second",
"name": "bitbybit.occt.shapes.solid.createBox",
"customName": "box",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 3,
"length": 3,
"height": 3,
"center": [
2,
1,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
426
]
},
"parts": {
"id": "parts",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "first",
"output": "result",
"data": {}
},
{
"node": "second",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"clashes": {
"id": "clashes",
"name": "bitbybit.occt.analysis.clashes.betweenShapes",
"customName": "clashes between shapes",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"clearance": 0,
"prefilter": true
},
"inputs": {
"shapes": {
"connections": [
{
"node": "parts",
"output": "list",
"data": {}
}
]
}
},
"position": [
880,
40
]
}
},
"modules": {}
}
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="first">first</variable><variable id="second">second</variable><variable id="parts">parts</variable><variable id="clashes">clashes</variable></variables><block type="variables_set" x="40" y="40"><field name="VAR" id="first">first</field><value name="VALUE"><block type="bitbybit.occt.shapes.solid.createBox"><value name="Width"><block type="math_number"><field name="NUM">3</field></block></value><value name="Length"><block type="math_number"><field name="NUM">3</field></block></value><value name="Height"><block type="math_number"><field name="NUM">3</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="OriginOnCenter"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value><next><block type="variables_set"><field name="VAR" id="second">second</field><value name="VALUE"><block type="bitbybit.occt.shapes.solid.createBox"><value name="Width"><block type="math_number"><field name="NUM">3</field></block></value><value name="Length"><block type="math_number"><field name="NUM">3</field></block></value><value name="Height"><block type="math_number"><field name="NUM">3</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">2</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="OriginOnCenter"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value><next><block type="variables_set"><field name="VAR" id="parts">parts</field><value name="VALUE"><block type="bitbybit.lists.addItem"><value name="List"><block type="bitbybit.lists.addItem"><value name="List"><block type="bitbybit.lists.createEmptyList"></block></value><value name="Item"><block type="variables_get"><field name="VAR" id="first">first</field></block></value><value name="Clone"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value></block></value><value name="Item"><block type="variables_get"><field name="VAR" id="second">second</field></block></value><value name="Clone"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value></block></value><next><block type="variables_set"><field name="VAR" id="clashes">clashes</field><value name="VALUE"><block type="bitbybit.occt.analysis.clashes.betweenShapes"><value name="Shapes"><block type="variables_get"><field name="VAR" id="parts">parts</field></block></value><value name="Clearance"><block type="math_number"><field name="NUM">0</field></block></value><value name="Prefilter"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="variables_get"><field name="VAR" id="parts">parts</field></block></value></block></next></block></next></block></next></block></next></block></xml>
const first = await bitbybit.occt.shapes.solid.createBox({ width: 3, length: 3, height: 3, center: [0, 0, 0] });
const second = await bitbybit.occt.shapes.solid.createBox({ width: 3, length: 3, height: 3, center: [2, 1, 0] });
const clashes = await bitbybit.occt.analysis.clashes.betweenShapes({ shapes: [first, second], clearance: 0 });
console.log(JSON.stringify(clashes));
await bitbybit.draw.drawAnyAsync({ entity: [first, second] });
In TypeScript the clashes are written to the console. In Rete, point at the output of clashes between shapes to read them.
Curves and surfaces
analysis.curves and analysis.surfaces read the geometry under edges and faces: the kind of curve or surface, curvature along a curve or at points on a surface, the closest points, where a curve crosses a face or another curve, and the kinks where a wire turns sharply. They are the tools for checking smoothness and for placing things exactly on a surface.
The viewer can show curvature on the model itself. Set surfaceAnalysis in the draw options and the faces take the colours of what it measures, from blue at analysisMin through green to red at analysisMax. It takes gaussian, mean, maxCurvature, minCurvature, minRadius and draftAngle. Here the Gaussian curvature shows where the vase bulges in red and where its waist curves like a saddle in blue, and its flat ends stay green:

- Rete
- Blockly
- TypeScript
{
"id": "rete-v2-json",
"nodes": {
"foot": {
"id": "foot",
"name": "bitbybit.occt.shapes.wire.createCircleWire",
"customName": "circle wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 3,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
40
]
},
"belly": {
"id": "belly",
"name": "bitbybit.occt.shapes.wire.createCircleWire",
"customName": "circle wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 5.2,
"center": [
0,
3,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
334
]
},
"waist": {
"id": "waist",
"name": "bitbybit.occt.shapes.wire.createCircleWire",
"customName": "circle wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 3.4,
"center": [
0,
7,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
628
]
},
"neck": {
"id": "neck",
"name": "bitbybit.occt.shapes.wire.createCircleWire",
"customName": "circle wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 2.2,
"center": [
0,
10,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
922
]
},
"lip": {
"id": "lip",
"name": "bitbybit.occt.shapes.wire.createCircleWire",
"customName": "circle wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 3.8,
"center": [
0,
14,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
1216
]
},
"rings": {
"id": "rings",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "foot",
"output": "result",
"data": {}
},
{
"node": "belly",
"output": "result",
"data": {}
},
{
"node": "waist",
"output": "result",
"data": {}
},
{
"node": "neck",
"output": "result",
"data": {}
},
{
"node": "lip",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"vase": {
"id": "vase",
"name": "bitbybit.occt.operations.loft",
"customName": "loft",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"makeSolid": true
},
"inputs": {
"shapes": {
"connections": [
{
"node": "rings",
"output": "list",
"data": {}
}
]
}
},
"position": [
880,
40
]
},
"curvature": {
"id": "curvature",
"name": "bitbybit.draw.optionsOcctShape",
"customName": "options occt shape",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"faceOpacity": 1,
"edgeOpacity": 1,
"edgeColour": "#ffffff",
"faceColour": "#ff0000",
"vertexColour": "#ff00ff",
"edgeWidth": 2,
"edgeWidthBySize": false,
"vertexSize": 0.03,
"drawEdges": false,
"drawFaces": true,
"drawVertices": false,
"precision": 0.02,
"angularDeflection": 0.5,
"relativeDeflection": false,
"precisionShare": 0,
"drawEdgeIndexes": false,
"edgeIndexHeight": 0.06,
"edgeIndexColour": "#ff00ff",
"drawFaceIndexes": false,
"faceIndexHeight": 0.06,
"faceIndexColour": "#0000ff",
"drawTwoSided": true,
"backFaceColour": "#0000ff",
"backFaceOpacity": 1,
"edgeArrowSize": 0,
"edgeArrowAngle": 15,
"keepMeshData": false,
"allowQualityDecrease": true,
"forceFaceDeflection": false,
"drawIsoCurves": false,
"isoCurvesU": 5,
"isoCurvesV": 5,
"isoCurvesColour": "#808080",
"surfaceAnalysis": "gaussian",
"draftDirection": [
0,
1,
0
],
"analysisMin": -0.06,
"analysisMax": 0.06
},
"inputs": {},
"position": [
40,
1510
]
},
"drawVase": {
"id": "drawVase",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "vase",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "curvature",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
40
]
},
"view": {
"id": "view",
"name": "bitbybit.babylon.scene.adjustActiveArcRotateCamera",
"customName": "adjust active arc rotate camera",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"position": [
14,
16,
-24
],
"lookAt": [
0,
7,
0
],
"lowerBetaLimit": 1,
"upperBetaLimit": 179,
"angularSensibilityX": 1000,
"angularSensibilityY": 1000,
"maxZ": 1000,
"panningSensibility": 1000,
"wheelPrecision": 3
},
"inputs": {},
"position": [
1300,
340
]
}
},
"modules": {}
}
<xml xmlns="https://developers.google.com/blockly/xml"><block type="bitbybit.draw.drawAnyAsyncNoReturn" x="40" y="200"><value name="Entity"><block type="bitbybit.occt.operations.loft"><value name="Shapes"><block type="lists_create_with"><mutation items="5"></mutation><value name="ADD0"><block type="bitbybit.occt.shapes.wire.createCircleWire"><value name="Radius"><block type="math_number"><field name="NUM">3</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><value name="ADD1"><block type="bitbybit.occt.shapes.wire.createCircleWire"><value name="Radius"><block type="math_number"><field name="NUM">5.2</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">3</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><value name="ADD2"><block type="bitbybit.occt.shapes.wire.createCircleWire"><value name="Radius"><block type="math_number"><field name="NUM">3.4</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">7</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><value name="ADD3"><block type="bitbybit.occt.shapes.wire.createCircleWire"><value name="Radius"><block type="math_number"><field name="NUM">2.2</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">10</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><value name="ADD4"><block type="bitbybit.occt.shapes.wire.createCircleWire"><value name="Radius"><block type="math_number"><field name="NUM">3.8</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">14</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value></block></value><value name="MakeSolid"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value><value name="Options"><block type="bitbybit.draw.optionsOcctShape"><value name="FaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeColour"><block type="colour_picker"><field name="COLOUR">#ffffff</field></block></value><value name="FaceColour"><block type="colour_picker"><field name="COLOUR">#ff0000</field></block></value><value name="VertexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="EdgeWidth"><block type="math_number"><field name="NUM">2</field></block></value><value name="EdgeWidthBySize"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="VertexSize"><block type="math_number"><field name="NUM">0.03</field></block></value><value name="DrawEdges"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="DrawFaces"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawVertices"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Precision"><block type="math_number"><field name="NUM">0.02</field></block></value><value name="AngularDeflection"><block type="math_number"><field name="NUM">0.5</field></block></value><value name="RelativeDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="PrecisionShare"><block type="math_number"><field name="NUM">0</field></block></value><value name="DrawEdgeIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="EdgeIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="EdgeIndexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="DrawFaceIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="FaceIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="FaceIndexColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="DrawTwoSided"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="BackFaceColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="BackFaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeArrowSize"><block type="math_number"><field name="NUM">0</field></block></value><value name="EdgeArrowAngle"><block type="math_number"><field name="NUM">15</field></block></value><value name="KeepMeshData"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="AllowQualityDecrease"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="ForceFaceDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="DrawIsoCurves"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="IsoCurvesU"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesV"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesColour"><block type="colour_picker"><field name="COLOUR">#808080</field></block></value><value name="SurfaceAnalysis"><block type="bitbybit.occt.enums.surfaceAnalysisEnum"><field name="bitbybit.occt.enums.surfaceAnalysisEnum">'gaussian'</field></block></value><value name="DraftDirection"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="AnalysisMin"><block type="math_number"><field name="NUM">-0.06</field></block></value><value name="AnalysisMax"><block type="math_number"><field name="NUM">0.06</field></block></value></block></value><next><block type="bitbybit.babylon.scene.adjustActiveArcRotateCamera"><value name="Position"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">14</field></block></value><value name="Y"><block type="math_number"><field name="NUM">16</field></block></value><value name="Z"><block type="math_number"><field name="NUM">-24</field></block></value></block></value><value name="LookAt"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">7</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="LowerBetaLimit"><block type="math_number"><field name="NUM">1</field></block></value><value name="UpperBetaLimit"><block type="math_number"><field name="NUM">179</field></block></value><value name="AngularSensibilityX"><block type="math_number"><field name="NUM">1000</field></block></value><value name="AngularSensibilityY"><block type="math_number"><field name="NUM">1000</field></block></value><value name="MaxZ"><block type="math_number"><field name="NUM">1000</field></block></value><value name="PanningSensibility"><block type="math_number"><field name="NUM">1000</field></block></value><value name="WheelPrecision"><block type="math_number"><field name="NUM">3</field></block></value></block></next></block></xml>
const rings = [];
for (const [radius, height] of [[3, 0], [5.2, 3], [3.4, 7], [2.2, 10], [3.8, 14]]) {
rings.push(await bitbybit.occt.shapes.wire.createCircleWire({ radius, center: [0, height, 0], direction: [0, 1, 0] }));
}
const vase = await bitbybit.occt.operations.loft({ shapes: rings, makeSolid: true });
const curvature = new Bit.Inputs.Draw.DrawOcctShapeOptions();
curvature.surfaceAnalysis = Bit.Inputs.OCCT.surfaceAnalysisEnum.gaussian;
curvature.analysisMin = -0.06;
curvature.analysisMax = 0.06;
curvature.drawEdges = false;
curvature.precision = 0.02;
await bitbybit.draw.drawAnyAsync({ entity: vase, options: curvature });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [14, 16, -24], lookAt: [0, 7, 0] });
For a curve, analysis.curves.curvatureComb draws a tooth at each sample, as long as the curve is sharp there. A smooth outline along the teeth means a smooth curve, and the point where the teeth change sides is where the curve changes its bend:

- Rete
- Blockly
- TypeScript
{
"id": "rete-v2-json",
"nodes": {
"points": {
"id": "points",
"name": "bitbybit.json.parse",
"customName": "parse",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"text": "[[0, 0, 0], [4, 0, 3], [8, 0, -1], [12, 0, 2], [16, 0, 0]]"
},
"inputs": {},
"position": [
40,
40
]
},
"curve": {
"id": "curve",
"name": "bitbybit.occt.shapes.wire.interpolatePoints",
"customName": "interpolate points",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"periodic": false,
"tolerance": 1e-7,
"parametrization": "chordLength"
},
"inputs": {
"points": {
"connections": [
{
"node": "points",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"comb": {
"id": "comb",
"name": "bitbybit.occt.analysis.curves.curvatureComb",
"customName": "curvature comb",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"samples": 120,
"scale": 0
},
"inputs": {
"shape": {
"connections": [
{
"node": "curve",
"output": "result",
"data": {}
}
]
}
},
"position": [
880,
40
]
},
"line": {
"id": "line",
"name": "bitbybit.draw.optionsOcctShape",
"customName": "options occt shape",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"faceOpacity": 1,
"edgeOpacity": 1,
"edgeColour": "#ffffff",
"faceColour": "#ff0000",
"vertexColour": "#ff00ff",
"edgeWidth": 4,
"edgeWidthBySize": false,
"vertexSize": 0.03,
"drawEdges": true,
"drawFaces": true,
"drawVertices": false,
"precision": 0.01,
"angularDeflection": 0.5,
"relativeDeflection": false,
"precisionShare": 0,
"drawEdgeIndexes": false,
"edgeIndexHeight": 0.06,
"edgeIndexColour": "#ff00ff",
"drawFaceIndexes": false,
"faceIndexHeight": 0.06,
"faceIndexColour": "#0000ff",
"drawTwoSided": true,
"backFaceColour": "#0000ff",
"backFaceOpacity": 1,
"edgeArrowSize": 0,
"edgeArrowAngle": 15,
"keepMeshData": false,
"allowQualityDecrease": true,
"forceFaceDeflection": false,
"drawIsoCurves": false,
"isoCurvesU": 5,
"isoCurvesV": 5,
"isoCurvesColour": "#808080",
"surfaceAnalysis": "none",
"draftDirection": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
280
]
},
"drawCurve": {
"id": "drawCurve",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "curve",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "line",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
40
]
},
"view": {
"id": "view",
"name": "bitbybit.babylon.scene.adjustActiveArcRotateCamera",
"customName": "adjust active arc rotate camera",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"position": [
8,
30,
-1
],
"lookAt": [
8,
0,
0
],
"lowerBetaLimit": 1,
"upperBetaLimit": 179,
"angularSensibilityX": 1000,
"angularSensibilityY": 1000,
"maxZ": 1000,
"panningSensibility": 1000,
"wheelPrecision": 3
},
"inputs": {},
"position": [
1300,
340
]
}
},
"modules": {}
}
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="curve">curve</variable></variables><block type="variables_set" x="40" y="200"><field name="VAR" id="curve">curve</field><value name="VALUE"><block type="bitbybit.occt.shapes.wire.interpolatePoints"><value name="Points"><block type="bitbybit.json.parse"><value name="Text"><block type="text"><field name="TEXT">[[0, 0, 0], [4, 0, 3], [8, 0, -1], [12, 0, 2], [16, 0, 0]]</field></block></value></block></value><value name="Periodic"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Tolerance"><block type="math_number"><field name="NUM">1e-7</field></block></value><value name="Parametrization"><block type="bitbybit.occt.enums.bSplineParametrizationEnum"><field name="bitbybit.occt.enums.bSplineParametrizationEnum">'chordLength'</field></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="variables_get"><field name="VAR" id="curve">curve</field></block></value><value name="Options"><block type="bitbybit.draw.optionsOcctShape"><value name="FaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeColour"><block type="colour_picker"><field name="COLOUR">#ffffff</field></block></value><value name="FaceColour"><block type="colour_picker"><field name="COLOUR">#ff0000</field></block></value><value name="VertexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="EdgeWidth"><block type="math_number"><field name="NUM">4</field></block></value><value name="EdgeWidthBySize"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="VertexSize"><block type="math_number"><field name="NUM">0.03</field></block></value><value name="DrawEdges"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawFaces"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawVertices"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Precision"><block type="math_number"><field name="NUM">0.01</field></block></value><value name="AngularDeflection"><block type="math_number"><field name="NUM">0.5</field></block></value><value name="RelativeDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="PrecisionShare"><block type="math_number"><field name="NUM">0</field></block></value><value name="DrawEdgeIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="EdgeIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="EdgeIndexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="DrawFaceIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="FaceIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="FaceIndexColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="DrawTwoSided"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="BackFaceColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="BackFaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeArrowSize"><block type="math_number"><field name="NUM">0</field></block></value><value name="EdgeArrowAngle"><block type="math_number"><field name="NUM">15</field></block></value><value name="KeepMeshData"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="AllowQualityDecrease"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="ForceFaceDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="DrawIsoCurves"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="IsoCurvesU"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesV"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesColour"><block type="colour_picker"><field name="COLOUR">#808080</field></block></value><value name="SurfaceAnalysis"><block type="bitbybit.occt.enums.surfaceAnalysisEnum"><field name="bitbybit.occt.enums.surfaceAnalysisEnum">'none'</field></block></value><value name="DraftDirection"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="bitbybit.occt.analysis.curves.curvatureComb"><value name="Shape"><block type="variables_get"><field name="VAR" id="curve">curve</field></block></value><value name="Samples"><block type="math_number"><field name="NUM">120</field></block></value><value name="Scale"><block type="math_number"><field name="NUM">0</field></block></value></block></value><next><block type="bitbybit.babylon.scene.adjustActiveArcRotateCamera"><value name="Position"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">8</field></block></value><value name="Y"><block type="math_number"><field name="NUM">30</field></block></value><value name="Z"><block type="math_number"><field name="NUM">-1</field></block></value></block></value><value name="LookAt"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">8</field></block></value><value name="Y"><block type="math_number"><field name="NUM">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="LowerBetaLimit"><block type="math_number"><field name="NUM">1</field></block></value><value name="UpperBetaLimit"><block type="math_number"><field name="NUM">179</field></block></value><value name="AngularSensibilityX"><block type="math_number"><field name="NUM">1000</field></block></value><value name="AngularSensibilityY"><block type="math_number"><field name="NUM">1000</field></block></value><value name="MaxZ"><block type="math_number"><field name="NUM">1000</field></block></value><value name="PanningSensibility"><block type="math_number"><field name="NUM">1000</field></block></value><value name="WheelPrecision"><block type="math_number"><field name="NUM">3</field></block></value></block></next></block></next></block></next></block></xml>
const curve = await bitbybit.occt.shapes.wire.interpolatePoints({ points: [[0, 0, 0], [4, 0, 3], [8, 0, -1], [12, 0, 2], [16, 0, 0]], periodic: false, tolerance: 1e-7 });
const comb = await bitbybit.occt.analysis.curves.curvatureComb({ shape: curve, samples: 120, scale: 0 });
const line = new Bit.Inputs.Draw.DrawOcctShapeOptions();
line.edgeColour = "#ffffff";
line.edgeWidth = 4;
await bitbybit.draw.drawAnyAsync({ entity: curve, options: line });
await bitbybit.draw.drawAnyAsync({ entity: comb });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [8, 30, -1], lookAt: [8, 0, 0] });
analysis.measure.minCurvatureRadius finds the tightest bend of a whole shape. With concaveOnly it looks only at inside bends, which answers a question every machinist asks: what is the largest cutter that reaches this corner? Here the answer is 0.75, and a cutter of that radius sits in the corner of the pocket. On sharp inside corners there is no bend to measure, so radius comes back empty:

- Rete
- Blockly
- TypeScript
{
"id": "rete-v2-json",
"nodes": {
"stock": {
"id": "stock",
"name": "bitbybit.occt.shapes.solid.createBox",
"customName": "box",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 12,
"length": 12,
"height": 5,
"center": [
0,
2.5,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
40
]
},
"pocket": {
"id": "pocket",
"name": "bitbybit.occt.shapes.solid.createBox",
"customName": "box",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 8,
"length": 8,
"height": 5,
"center": [
0,
4,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
426
]
},
"tools": {
"id": "tools",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "pocket",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"cut": {
"id": "cut",
"name": "bitbybit.occt.booleans.difference",
"customName": "difference",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"keepEdges": false,
"strategy": "oneAfterAnother"
},
"inputs": {
"shape": {
"connections": [
{
"node": "stock",
"output": "result",
"data": {}
}
]
},
"shapes": {
"connections": [
{
"node": "tools",
"output": "list",
"data": {}
}
]
}
},
"position": [
880,
40
]
},
"inside": {
"id": "inside",
"name": "bitbybit.occt.select.edges.concave",
"customName": "concave edges",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"tangentAngle": 1
},
"inputs": {
"shape": {
"connections": [
{
"node": "cut",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
40
]
},
"corners": {
"id": "corners",
"name": "bitbybit.occt.select.edges.along",
"customName": "edges along",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"direction": [
0,
1,
0
],
"angle": 0
},
"inputs": {
"shape": {
"connections": [
{
"node": "cut",
"output": "result",
"data": {}
}
]
},
"indexes": {
"connections": [
{
"node": "inside",
"output": "result",
"data": {}
}
]
}
},
"position": [
1720,
40
]
},
"part": {
"id": "part",
"name": "bitbybit.occt.fillets.filletEdges",
"customName": "fillet edges",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 0.75
},
"inputs": {
"shape": {
"connections": [
{
"node": "cut",
"output": "result",
"data": {}
}
]
},
"indexes": {
"connections": [
{
"node": "corners",
"output": "result",
"data": {}
}
]
}
},
"position": [
2140,
40
]
},
"tightest": {
"id": "tightest",
"name": "bitbybit.occt.analysis.measure.minCurvatureRadius",
"customName": "min curvature radius",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"samples": 16,
"concaveOnly": true
},
"inputs": {
"shape": {
"connections": [
{
"node": "part",
"output": "result",
"data": {}
}
]
}
},
"position": [
2560,
40
]
},
"tightestRadius": {
"id": "tightestRadius",
"name": "bitbybit.json.getValueOnProp",
"customName": "get value on prop",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"property": "radius"
},
"inputs": {
"json": {
"connections": [
{
"node": "tightest",
"output": "result",
"data": {}
}
]
}
},
"position": [
2980,
40
]
},
"cutter": {
"id": "cutter",
"name": "bitbybit.occt.shapes.solid.createCylinder",
"customName": "cylinder",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 1,
"height": 6,
"center": [
3.25,
1,
3.25
],
"direction": [
0,
1,
0
],
"angle": 360,
"originOnCenter": false
},
"inputs": {
"radius": {
"connections": [
{
"node": "tightestRadius",
"output": "result",
"data": {}
}
]
}
},
"position": [
3400,
40
]
},
"steel": {
"id": "steel",
"name": "bitbybit.draw.optionsOcctShape",
"customName": "options occt shape",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"faceOpacity": 1,
"edgeOpacity": 1,
"edgeColour": "#5f6773",
"faceColour": "#ff0000",
"vertexColour": "#ff00ff",
"edgeWidth": 2,
"edgeWidthBySize": false,
"vertexSize": 0.03,
"drawEdges": true,
"drawFaces": true,
"drawVertices": false,
"precision": 0.01,
"angularDeflection": 0.5,
"relativeDeflection": false,
"precisionShare": 0,
"drawEdgeIndexes": false,
"edgeIndexHeight": 0.06,
"edgeIndexColour": "#ff00ff",
"drawFaceIndexes": false,
"faceIndexHeight": 0.06,
"faceIndexColour": "#0000ff",
"drawTwoSided": false,
"backFaceColour": "#0000ff",
"backFaceOpacity": 1,
"edgeArrowSize": 0,
"edgeArrowAngle": 15,
"keepMeshData": false,
"allowQualityDecrease": true,
"forceFaceDeflection": false,
"drawIsoCurves": false,
"isoCurvesU": 5,
"isoCurvesV": 5,
"isoCurvesColour": "#808080",
"surfaceAnalysis": "none",
"draftDirection": [
0,
1,
0
]
},
"inputs": {
"faceMaterial": {
"connections": [
{
"node": "steelMaterial",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
280
]
},
"steelMaterial": {
"id": "steelMaterial",
"name": "bitbybit.draw.createPBRMaterial",
"customName": "create pbr material",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"name": "PBRMaterial",
"baseColor": "#eef0f2",
"metallic": 0.7,
"roughness": 0.3,
"alpha": 1,
"emissiveColor": "#000000",
"emissiveIntensity": 1,
"zOffset": 0,
"zOffsetUnits": 0,
"alphaMode": "opaque",
"alphaCutoff": 0.5,
"doubleSided": false,
"wireframe": false,
"unlit": false
},
"inputs": {},
"position": [
40,
812
]
},
"bright": {
"id": "bright",
"name": "bitbybit.draw.optionsOcctShape",
"customName": "options occt shape",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"faceOpacity": 1,
"edgeOpacity": 1,
"edgeColour": "#5f6773",
"faceColour": "#ff4400",
"vertexColour": "#ff00ff",
"edgeWidth": 2,
"edgeWidthBySize": false,
"vertexSize": 0.03,
"drawEdges": true,
"drawFaces": true,
"drawVertices": false,
"precision": 0.01,
"angularDeflection": 0.5,
"relativeDeflection": false,
"precisionShare": 0,
"drawEdgeIndexes": false,
"edgeIndexHeight": 0.06,
"edgeIndexColour": "#ff00ff",
"drawFaceIndexes": false,
"faceIndexHeight": 0.06,
"faceIndexColour": "#0000ff",
"drawTwoSided": false,
"backFaceColour": "#0000ff",
"backFaceOpacity": 1,
"edgeArrowSize": 0,
"edgeArrowAngle": 15,
"keepMeshData": false,
"allowQualityDecrease": true,
"forceFaceDeflection": false,
"drawIsoCurves": false,
"isoCurvesU": 5,
"isoCurvesV": 5,
"isoCurvesColour": "#808080",
"surfaceAnalysis": "none",
"draftDirection": [
0,
1,
0
]
},
"inputs": {},
"position": [
40,
1842
]
},
"drawPart": {
"id": "drawPart",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "part",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "steel",
"output": "result",
"data": {}
}
]
}
},
"position": [
3820,
40
]
},
"drawCutter": {
"id": "drawCutter",
"name": "bitbybit.draw.drawAnyAsync",
"customName": "draw any async",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"entity": {
"connections": [
{
"node": "cutter",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "bright",
"output": "result",
"data": {}
}
]
}
},
"position": [
3820,
334
]
},
"view": {
"id": "view",
"name": "bitbybit.babylon.scene.adjustActiveArcRotateCamera",
"customName": "adjust active arc rotate camera",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"position": [
9,
26,
-22
],
"lookAt": [
0,
2,
0
],
"lowerBetaLimit": 1,
"upperBetaLimit": 179,
"angularSensibilityX": 1000,
"angularSensibilityY": 1000,
"maxZ": 1000,
"panningSensibility": 1000,
"wheelPrecision": 3
},
"inputs": {},
"position": [
3820,
628
]
}
},
"modules": {}
}
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="cut">cut</variable><variable id="part">part</variable><variable id="tightest">tightest</variable></variables><block type="variables_set" x="40" y="200"><field name="VAR" id="cut">cut</field><value name="VALUE"><block type="bitbybit.occt.booleans.difference"><value name="Shape"><block type="bitbybit.occt.shapes.solid.createBox"><value name="Width"><block type="math_number"><field name="NUM">12</field></block></value><value name="Length"><block type="math_number"><field name="NUM">12</field></block></value><value name="Height"><block type="math_number"><field name="NUM">5</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">2.5</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="OriginOnCenter"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value><value name="Shapes"><block type="lists_create_with"><mutation items="1"></mutation><value name="ADD0"><block type="bitbybit.occt.shapes.solid.createBox"><value name="Width"><block type="math_number"><field name="NUM">8</field></block></value><value name="Length"><block type="math_number"><field name="NUM">8</field></block></value><value name="Height"><block type="math_number"><field name="NUM">5</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">4</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="OriginOnCenter"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value></block></value><value name="KeepEdges"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Strategy"><block type="bitbybit.occt.enums.booleanStrategyEnum"><field name="bitbybit.occt.enums.booleanStrategyEnum">'oneAfterAnother'</field></block></value></block></value><next><block type="variables_set"><field name="VAR" id="part">part</field><value name="VALUE"><block type="bitbybit.occt.fillets.filletEdges"><value name="Shape"><block type="variables_get"><field name="VAR" id="cut">cut</field></block></value><value name="Radius"><block type="math_number"><field name="NUM">0.75</field></block></value><value name="Indexes"><block type="bitbybit.occt.select.edges.along"><value name="Shape"><block type="variables_get"><field name="VAR" id="cut">cut</field></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Angle"><block type="math_number"><field name="NUM">0</field></block></value><value name="Indexes"><block type="bitbybit.occt.select.edges.concave"><value name="Shape"><block type="variables_get"><field name="VAR" id="cut">cut</field></block></value><value name="TangentAngle"><block type="math_number"><field name="NUM">1</field></block></value></block></value></block></value></block></value><next><block type="variables_set"><field name="VAR" id="tightest">tightest</field><value name="VALUE"><block type="base_time_await_return"><value name="Promise"><block type="bitbybit.occt.analysis.measure.minCurvatureRadius"><value name="Shape"><block type="variables_get"><field name="VAR" id="part">part</field></block></value><value name="Samples"><block type="math_number"><field name="NUM">16</field></block></value><value name="ConcaveOnly"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="variables_get"><field name="VAR" id="part">part</field></block></value><value name="Options"><block type="bitbybit.draw.optionsOcctShape"><value name="FaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeColour"><block type="colour_picker"><field name="COLOUR">#5f6773</field></block></value><value name="FaceColour"><block type="colour_picker"><field name="COLOUR">#ff0000</field></block></value><value name="VertexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="FaceMaterial"><block type="bitbybit.draw.createPBRMaterial"><value name="Name"><block type="text"><field name="TEXT">PBRMaterial</field></block></value><value name="BaseColor"><block type="colour_picker"><field name="COLOUR">#eef0f2</field></block></value><value name="Metallic"><block type="math_number"><field name="NUM">0.7</field></block></value><value name="Roughness"><block type="math_number"><field name="NUM">0.3</field></block></value><value name="Alpha"><block type="math_number"><field name="NUM">1</field></block></value><value name="EmissiveColor"><block type="colour_picker"><field name="COLOUR">#000000</field></block></value><value name="EmissiveIntensity"><block type="math_number"><field name="NUM">1</field></block></value><value name="ZOffset"><block type="math_number"><field name="NUM">0</field></block></value><value name="ZOffsetUnits"><block type="math_number"><field name="NUM">0</field></block></value><value name="AlphaMode"><block type="bitbybit.draw.enums.alphaModeEnum"><field name="bitbybit.draw.enums.alphaModeEnum">'opaque'</field></block></value><value name="AlphaCutoff"><block type="math_number"><field name="NUM">0.5</field></block></value><value name="DoubleSided"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Wireframe"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Unlit"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value></block></value><value name="EdgeWidth"><block type="math_number"><field name="NUM">2</field></block></value><value name="EdgeWidthBySize"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="VertexSize"><block type="math_number"><field name="NUM">0.03</field></block></value><value name="DrawEdges"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawFaces"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawVertices"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Precision"><block type="math_number"><field name="NUM">0.01</field></block></value><value name="AngularDeflection"><block type="math_number"><field name="NUM">0.5</field></block></value><value name="RelativeDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="PrecisionShare"><block type="math_number"><field name="NUM">0</field></block></value><value name="DrawEdgeIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="EdgeIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="EdgeIndexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="DrawFaceIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="FaceIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="FaceIndexColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="DrawTwoSided"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="BackFaceColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="BackFaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeArrowSize"><block type="math_number"><field name="NUM">0</field></block></value><value name="EdgeArrowAngle"><block type="math_number"><field name="NUM">15</field></block></value><value name="KeepMeshData"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="AllowQualityDecrease"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="ForceFaceDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="DrawIsoCurves"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="IsoCurvesU"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesV"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesColour"><block type="colour_picker"><field name="COLOUR">#808080</field></block></value><value name="SurfaceAnalysis"><block type="bitbybit.occt.enums.surfaceAnalysisEnum"><field name="bitbybit.occt.enums.surfaceAnalysisEnum">'none'</field></block></value><value name="DraftDirection"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><next><block type="bitbybit.draw.drawAnyAsyncNoReturn"><value name="Entity"><block type="bitbybit.occt.shapes.solid.createCylinder"><value name="Radius"><block type="bitbybit.json.getValueOnProp"><value name="Json"><block type="variables_get"><field name="VAR" id="tightest">tightest</field></block></value><value name="Property"><block type="text"><field name="TEXT">radius</field></block></value></block></value><value name="Height"><block type="math_number"><field name="NUM">6</field></block></value><value name="Center"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">3.25</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">3.25</field></block></value></block></value><value name="Direction"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="Angle"><block type="math_number"><field name="NUM">360</field></block></value><value name="OriginOnCenter"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value></block></value><value name="Options"><block type="bitbybit.draw.optionsOcctShape"><value name="FaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeColour"><block type="colour_picker"><field name="COLOUR">#5f6773</field></block></value><value name="FaceColour"><block type="colour_picker"><field name="COLOUR">#ff4400</field></block></value><value name="VertexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="EdgeWidth"><block type="math_number"><field name="NUM">2</field></block></value><value name="EdgeWidthBySize"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="VertexSize"><block type="math_number"><field name="NUM">0.03</field></block></value><value name="DrawEdges"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawFaces"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="DrawVertices"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="Precision"><block type="math_number"><field name="NUM">0.01</field></block></value><value name="AngularDeflection"><block type="math_number"><field name="NUM">0.5</field></block></value><value name="RelativeDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="PrecisionShare"><block type="math_number"><field name="NUM">0</field></block></value><value name="DrawEdgeIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="EdgeIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="EdgeIndexColour"><block type="colour_picker"><field name="COLOUR">#ff00ff</field></block></value><value name="DrawFaceIndexes"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="FaceIndexHeight"><block type="math_number"><field name="NUM">0.06</field></block></value><value name="FaceIndexColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="DrawTwoSided"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="BackFaceColour"><block type="colour_picker"><field name="COLOUR">#0000ff</field></block></value><value name="BackFaceOpacity"><block type="math_number"><field name="NUM">1</field></block></value><value name="EdgeArrowSize"><block type="math_number"><field name="NUM">0</field></block></value><value name="EdgeArrowAngle"><block type="math_number"><field name="NUM">15</field></block></value><value name="KeepMeshData"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="AllowQualityDecrease"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value><value name="ForceFaceDeflection"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="DrawIsoCurves"><block type="logic_boolean"><field name="BOOL">FALSE</field></block></value><value name="IsoCurvesU"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesV"><block type="math_number"><field name="NUM">5</field></block></value><value name="IsoCurvesColour"><block type="colour_picker"><field name="COLOUR">#808080</field></block></value><value name="SurfaceAnalysis"><block type="bitbybit.occt.enums.surfaceAnalysisEnum"><field name="bitbybit.occt.enums.surfaceAnalysisEnum">'none'</field></block></value><value name="DraftDirection"><block type="bitbybit.vector.vectorXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">1</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><next><block type="bitbybit.babylon.scene.adjustActiveArcRotateCamera"><value name="Position"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">9</field></block></value><value name="Y"><block type="math_number"><field name="NUM">26</field></block></value><value name="Z"><block type="math_number"><field name="NUM">-22</field></block></value></block></value><value name="LookAt"><block type="bitbybit.point.pointXYZ"><value name="X"><block type="math_number"><field name="NUM">0</field></block></value><value name="Y"><block type="math_number"><field name="NUM">2</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value><value name="LowerBetaLimit"><block type="math_number"><field name="NUM">1</field></block></value><value name="UpperBetaLimit"><block type="math_number"><field name="NUM">179</field></block></value><value name="AngularSensibilityX"><block type="math_number"><field name="NUM">1000</field></block></value><value name="AngularSensibilityY"><block type="math_number"><field name="NUM">1000</field></block></value><value name="MaxZ"><block type="math_number"><field name="NUM">1000</field></block></value><value name="PanningSensibility"><block type="math_number"><field name="NUM">1000</field></block></value><value name="WheelPrecision"><block type="math_number"><field name="NUM">3</field></block></value></block></next></block></next></block></next></block></next></block></next></block></xml>
const stock = await bitbybit.occt.shapes.solid.createBox({ width: 12, length: 12, height: 5, center: [0, 2.5, 0] });
const pocket = await bitbybit.occt.shapes.solid.createBox({ width: 8, length: 8, height: 5, center: [0, 4, 0] });
const cut = await bitbybit.occt.booleans.difference({ shape: stock, shapes: [pocket], keepEdges: false });
const inside = await bitbybit.occt.select.edges.concave({ shape: cut });
const corners = await bitbybit.occt.select.edges.along({ shape: cut, direction: [0, 1, 0], indexes: inside });
const part = await bitbybit.occt.fillets.filletEdges({ shape: cut, radius: 0.75, indexes: corners });
const tightest = await bitbybit.occt.analysis.measure.minCurvatureRadius({ shape: part, samples: 16, concaveOnly: true });
const cutter = await bitbybit.occt.shapes.solid.createCylinder({ radius: tightest.radius ?? 0, height: 6, center: [3.25, 1, 3.25], direction: [0, 1, 0] });
const steel = new Bit.Inputs.Draw.DrawOcctShapeOptions();
steel.faceMaterial = bitbybit.draw.createPBRMaterial({ baseColor: "#eef0f2", metallic: 0.7, roughness: 0.3 });
steel.edgeColour = "#5f6773";
steel.drawTwoSided = false;
const bright = new Bit.Inputs.Draw.DrawOcctShapeOptions();
bright.faceColour = "#ff4400";
bright.edgeColour = "#5f6773";
bright.drawTwoSided = false;
await bitbybit.draw.drawAnyAsync({ entity: part, options: steel });
await bitbybit.draw.drawAnyAsync({ entity: cutter, options: bright });
bitbybit.babylon.scene.adjustActiveArcRotateCamera({ position: [9, 26, -22], lookAt: [0, 2, 0] });
Every analysis
| Function | What it does |
|---|---|
clashes.betweenShapes | Finds every pair among a list of shapes that overlap, touch or come within a clearance of each other, such as colliding parts. |
clashes.facesWithin | Finds the faces of one shape that come within a clearance of faces of another, each pair measured exactly. |
clashes.selfIntersections | Finds the pairs of faces of one shape that cross each other anywhere but along an edge they share. |
curves.closestPoints | Finds the point of an edge or a wire nearest each given point, with where it lies along the curve. |
curves.curvatureComb | Draws a curvature comb along an edge or a wire: teeth standing on the curve, as long as the curvature there, pointing away from its center. |
curves.curvaturesAtLengths | Reads how an edge or a wire bends at places given as lengths along it from its start, in model units. |
curves.curvaturesAtParams | Reads how an edge or a wire bends at places given as fractions from 0 at its start to 1 at its end. |
curves.curveType | Tells what kind of curve an edge runs along: a line, a circle, an ellipse, a hyperbola, a parabola, a Bezier curve, a B-spline, an offset curve or another kind. |
curves.extremesAlong | Finds the highest and lowest points of an edge or a wire along a direction, such as the crests of a wave. |
curves.intersectCurves | Finds where two edges or wires cross or touch, with the parameter and the edge of each point on both curves. |
curves.intersectCurveWithFace | Finds where an edge or a wire passes through a face or lies on it, within the face's edges. |
curves.kinks | Finds the corners of an edge or a wire where the tangent turns by more than an angle, such as the corners of a polyline. |
measure.angleBetween | Measures the angle in degrees between two faces or edges where they come nearest each other. |
measure.boundingBoxInFrame | Finds the box that just holds a shape with its sides along a frame's axes instead of the world's. |
measure.dihedralAngle | Measures the angle through the material between the two faces that meet at an edge. |
measure.extrema | Finds every nearest pair of points between two shapes, with the vertex, edge or face each point lies on and where on it. |
measure.minCurvatureRadius | Finds the tightest bend of a shape, sampled over its faces and edges, and where it is. |
measure.orientedBoundingBox | Finds the smallest box that fits around a shape, turned to follow it rather than the axes: a frame at the box's centre, its direction along the longest side and its normal along the shortest, with half the box's size along each. |
measure.principalFrame | Finds a shape's principal axes of inertia as a frame at its centre of mass: the direction is the axis it turns about most easily, the normal the one it resists most. |
measure.tightBoundingBox | Finds the box lined up with the axes that just holds a shape's exact geometry. |
signatures | Describes every face and edge of a shape in one pass: each face's surface kind, area, centre, outward normal and box, and each edge's curve kind, length, midpoint and direction there. |
surfaces.closestPoints | Finds the point of a face nearest each given point, with its (u, v) and the face's normal there. |
surfaces.curvaturesOnUVs | Reads how a face bends at (u, v) pairs: its largest and smallest curvature with their directions, their mean and product, and the normal. |
surfaces.surfaceType | Tells what kind of surface a face lies on, such as a plane, a cylinder or a B-spline. |



