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:
- Rete
- Blockly
- TypeScript
{
"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": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"step": 0.5,
"direction": [
0,
1,
0
]
},
"inputs": {
"shape": {
"connections": [
{
"node": "sphere",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
40
]
}
},
"modules": {}
}
<xml xmlns="https://developers.google.com/blockly/xml"><block type="bitbybit.draw.drawAnyAsyncNoReturn" x="40" y="40"><value name="Entity"><block type="bitbybit.occt.operations.slice"><value name="Shape"><block type="bitbybit.occt.shapes.solid.createSphere"><value name="Radius"><block type="math_number"><field name="NUM">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">0</field></block></value><value name="Z"><block type="math_number"><field name="NUM">0</field></block></value></block></value></block></value><value name="Step"><block type="math_number"><field name="NUM">0.5</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></block></value></block></xml>
const sphere = await bitbybit.occt.shapes.solid.createSphere({ radius: 4, center: [0, 0, 0] });
const slices = await bitbybit.occt.operations.slice({ shape: sphere, step: 0.5, direction: [0, 1, 0] });
await bitbybit.draw.drawAnyAsync({ entity: slices });
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
splitByFramecuts a shape in two with the plane of a frame and gives both halves.splitShapeWithShapescuts a shape into pieces with other shapes, without removing material, as a knife would.splitFaceByWiresscores a face along wires that lie on it, so each region can be coloured or extruded on its own.
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.
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.



