Skip to main content

Sections, slices and drawings

Many uses of a 3D model are flat: the layers a 3D printer or a laser cutter makes, a cross-section through a part, a technical drawing with hidden edges dashed. bitbybit.occt.operations cuts shapes for all of them.

Slices​

slice cuts a solid into parallel layers along a direction, every step model units, like a loaf of bread. Each layer is the flat section where a cutting plane meets the solid, and all of them come back in one compound. sliceInStepPattern uses a repeating pattern of gaps, and sliceByFrames cuts with the plane of each frame you give it, at any angle.

Here a sphere is sliced every half unit along Y:

A sphere cut into layers
Bitbybit Platform

A sphere cut into layers in Rete

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"sphere": {
"id": "sphere",
"name": "bitbybit.occt.shapes.solid.createSphere",
"customName": "sphere",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 4,
"center": [
0,
0,
0
]
},
"inputs": {},
"position": [
40,
40
]
},
"slice": {
"id": "slice",
"name": "bitbybit.occt.operations.slice",
"customName": "slice",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"step": 0.5,
"direction": [
0,
1,
0
]
},
"inputs": {
"shape": {
"connections": [
{
"node": "sphere",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"look": {
"id": "look",
"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": "#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": true,
"backFaceColour": "#ffffff",
"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,
288
]
},
"drawSlice": {
"id": "drawSlice",
"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": "slice",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "look",
"output": "result",
"data": {}
}
]
}
},
"position": [
880,
40
]
}
},
"modules": {}
}

Each slice is a face: extrude it by the thickness of your sheet and you have the parts of a stacked model to cut.

Splitting​

  • splitByFrame cuts a shape in two with the plane of a frame and gives both halves.
  • splitShapeWithShapes cuts a shape into pieces with other shapes, without removing material, as a knife would. splitShapeWithShapesWithHistory gives the pieces as one compound with a history for each shape given, the shape being split first, whose faces names the pieces each face was cut into. With nonDestructive false, cutting shapes that take nothing off the shape leave no pieces to follow, and the call is refused.
  • splitFaceByWires scores a face along wires that lie on it, so each region can be coloured or extruded on its own.

Section views​

  • cutByFrames cuts every shape of a list with the planes of frames and keeps what lies behind them, the side away from each normal. A cut solid stays closed, its cut faces part of it, so drawing the results shows the inside as a section view does. Each result lines up with its shape and can keep its colour; a shape cut away whole gives an empty compound.
  • With several frames, keep says what stays. behindAll, the default, keeps what lies behind every plane: six frames facing outwards keep the inside of a box, as a section box does. behindAny keeps what lies behind any plane, so only what lies in front of all of them goes: two frames cut a corner away.
  • sectionByFrames gives only the cut faces, holes included, for each shape and each frame, or with makeFaces false the section wires: the outline to hatch or dimension in a drawing.
  • The side taken away is the one a frame's normal points to, which is where hiddenLines looks from with the same frame, so one frame both cuts the model and draws the cut.
  • A design build has occt.design.section, which cuts every placed part the same way and shares the work between placements of the same part.

A cut and a section with the same frame go together, the cut showing what is behind the plane and the section what the plane passes through:

A bearing cut away to show its section
Bitbybit Platform

A bearing cut away to show its section in Rete

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"bearing": {
"id": "bearing",
"name": "bitbybit.occt.parts.mechanical.bearings.iso.ballBearing",
"customName": "ball bearing",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"designation": "6205",
"shields": false,
"unit": "mm"
},
"inputs": {},
"position": [
40,
40
]
},
"plane": {
"id": "plane",
"name": "bitbybit.frame.create",
"customName": "frame",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"origin": [
0,
0,
0
],
"normal": [
0,
0,
1
],
"direction": [
1,
0,
0
]
},
"inputs": {},
"position": [
40,
380
]
},
"toCut": {
"id": "toCut",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "bearing",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"planes": {
"id": "planes",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "plane",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
280
]
},
"cut": {
"id": "cut",
"name": "bitbybit.occt.operations.cutByFrames",
"customName": "cut by frames",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"keep": "behindAll"
},
"inputs": {
"shapes": {
"connections": [
{
"node": "toCut",
"output": "list",
"data": {}
}
]
},
"frames": {
"connections": [
{
"node": "planes",
"output": "list",
"data": {}
}
]
}
},
"position": [
880,
40
]
},
"sections": {
"id": "sections",
"name": "bitbybit.occt.operations.sectionByFrames",
"customName": "section by frames",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"makeFaces": true,
"tolerance": 1e-7
},
"inputs": {
"shapes": {
"connections": [
{
"node": "toCut",
"output": "list",
"data": {}
}
]
},
"frames": {
"connections": [
{
"node": "planes",
"output": "list",
"data": {}
}
]
}
},
"position": [
880,
334
]
},
"cutPart": {
"id": "cutPart",
"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": "cut",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
40
]
},
"ofBearing": {
"id": "ofBearing",
"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": "sections",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
334
]
},
"sectionFaces": {
"id": "sectionFaces",
"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": "ofBearing",
"output": "result",
"data": {}
}
]
}
},
"position": [
1720,
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,
520
]
},
"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,
674
]
},
"hatch": {
"id": "hatch",
"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,
1704
]
},
"drawCutPart": {
"id": "drawCutPart",
"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": "cutPart",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "steel",
"output": "result",
"data": {}
}
]
}
},
"position": [
2140,
40
]
},
"drawSectionFaces": {
"id": "drawSectionFaces",
"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": "sectionFaces",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "hatch",
"output": "result",
"data": {}
}
]
}
},
"position": [
2140,
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": [
34,
44,
72
],
"lookAt": [
0,
7,
-6
],
"lowerBetaLimit": 1,
"upperBetaLimit": 179,
"angularSensibilityX": 1000,
"angularSensibilityY": 1000,
"maxZ": 1000,
"panningSensibility": 1000,
"wheelPrecision": 3
},
"inputs": {},
"position": [
2140,
628
]
}
},
"modules": {}
}

Where two shapes meet​

sectionWires finds the curves where two shapes meet and joins them into wires: the outline a plane cuts through a part, or the seam where a pipe meets a wall.

The curves where two pipes cross
Bitbybit Platform

The curves where two pipes cross in Rete

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"wide": {
"id": "wide",
"name": "bitbybit.occt.shapes.solid.createCylinder",
"customName": "cylinder",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 3,
"height": 14,
"center": [
0,
-7,
0
],
"direction": [
0,
1,
0
],
"angle": 360,
"originOnCenter": false
},
"inputs": {},
"position": [
40,
40
]
},
"narrow": {
"id": "narrow",
"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": 14,
"center": [
-7,
0,
0
],
"direction": [
1,
0,
0
],
"angle": 360,
"originOnCenter": false
},
"inputs": {},
"position": [
40,
472
]
},
"curves": {
"id": "curves",
"name": "bitbybit.occt.operations.sectionWires",
"customName": "section wires",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"tolerance": 1e-7
},
"inputs": {
"shapeA": {
"connections": [
{
"node": "wide",
"output": "result",
"data": {}
}
]
},
"shapeB": {
"connections": [
{
"node": "narrow",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
},
"welds": {
"id": "welds",
"name": "bitbybit.occt.operations.pipeWiresCylindrical",
"customName": "pipe wires cylindrical",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 0.12,
"makeSolid": true,
"trihedronEnum": "isCorrectedFrenet",
"forceApproxC1": false,
"bendRadius": 0
},
"inputs": {
"shapes": {
"connections": [
{
"node": "curves",
"output": "result",
"data": {}
}
]
}
},
"position": [
880,
40
]
},
"brass": {
"id": "brass",
"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,
904
]
},
"drawWide": {
"id": "drawWide",
"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": "wide",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
40
]
},
"drawNarrow": {
"id": "drawNarrow",
"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": "narrow",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
334
]
},
"drawWelds": {
"id": "drawWelds",
"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": "welds",
"output": "result",
"data": {}
}
]
},
"options": {
"connections": [
{
"node": "brass",
"output": "result",
"data": {}
}
]
}
},
"position": [
1300,
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": [
14,
14,
-18
],
"lookAt": [
0,
0,
0
],
"lowerBetaLimit": 1,
"upperBetaLimit": 179,
"angularSensibilityX": 1000,
"angularSensibilityY": 1000,
"maxZ": 1000,
"panningSensibility": 1000,
"wheelPrecision": 3
},
"inputs": {},
"position": [
1300,
922
]
}
},
"modules": {}
}

Drawings​

hiddenLines draws a shape as a technical drawing does, seen from a view frame and flattened: the edges the eye sees, and those hidden behind faces, which a drawing dashes. Together with sections, the result goes to DXF or SVG for a drawing or a cutter.