Skip to main content

Extruding Wires And Faces

OCCT category icon with a stylized logo representation

Extruding a Wire

Extrusion is a fundamental 3D modeling operation that creates a three-dimensional shape by extending a profile (a wire) along a specified vector. Imagine taking a flat shape and pushing it through space to give it depth; that's the essence of extrusion. This technique is widely used for creating a vast array of objects, from simple geometric solids to complex mechanical parts and architectural elements.

In this tutorial, we'll guide you through the process of creating an extruded shape. We will start by defining a 2D star-shaped wire, apply a 2D fillet to round its corners, and then extrude this modified wire along a vector to form a 3D object. We'll demonstrate this process using Rete, Blockly, and TypeScript, providing clear examples for each environment.

The key parameters for an extrusion operation typically include:

  • The Profile (Wire): This is the shape that will be extruded. It can be any closed or open wire, such as a circle, polygon, or a custom-defined curve or polyline.
  • The Extrusion Vector: This defines the direction and distance (magnitude) of the extrusion. The profile is swept along this vector.
  • Solid or Shell: When you extrude the wire you create a shell shape. If you extrude face you create solid.

By understanding extrusion, you gain a powerful tool for your 3D modeling toolkit.

Bitbybit Platform

Extrude the wire into shell kind of shape

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"7c920baffd91d425": {
"id": "7c920baffd91d425",
"name": "bitbybit.occt.shapes.wire.createStarWire",
"customName": "star wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
],
"numRays": 7,
"outerRadius": 7,
"innerRadius": 4,
"offsetOuterEdges": 0,
"half": false
},
"inputs": {},
"position": [
110.734375,
360.171875
]
},
"a3ad01ccca577e86": {
"id": "a3ad01ccca577e86",
"name": "bitbybit.occt.operations.extrude",
"customName": "extrude",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"direction": [
0,
1,
0
]
},
"inputs": {
"shape": {
"connections": [
{
"node": "27e9c145d5e43cd0",
"output": "result",
"data": {}
}
]
},
"direction": {
"connections": [
{
"node": "58f71d7c11226693",
"output": "result",
"data": {}
}
]
}
},
"position": [
1070.1244775692053,
638.622822251194
]
},
"27e9c145d5e43cd0": {
"id": "27e9c145d5e43cd0",
"name": "bitbybit.occt.fillets.fillet2d",
"customName": "fillet 2d",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"radius": 0.5
},
"inputs": {
"shape": {
"connections": [
{
"node": "7c920baffd91d425",
"output": "result",
"data": {}
}
]
}
},
"position": [
490.85570951639164,
357.61402718044616
]
},
"58f71d7c11226693": {
"id": "58f71d7c11226693",
"name": "bitbybit.vector.vectorXYZ",
"customName": "vector xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 0,
"y": 3,
"z": 0
},
"inputs": {
"y": {
"connections": [
{
"node": "16fef8b5633bf2fa",
"output": "result",
"data": {}
}
]
}
},
"position": [
491.9697917949816,
908.010548409781
]
},
"16fef8b5633bf2fa": {
"id": "16fef8b5633bf2fa",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"data": {
"options": {
"min": 1,
"max": 6,
"step": 0.1,
"width": 350,
"updateOnDrag": false
},
"number": 2.8
},
"inputs": {},
"position": [
-418.6465475549992,
986.9008502987708
]
}
}
}

Extruding a Face

In addition to extruding wires (which typically create shells or open-ended shapes), you can also extrude faces. A face in this context is a bounded surface, often created from one or more closed wires. When a face is extruded, the operation effectively sweeps this surface along the extrusion vector, creating a closed volumetric body, or a solid.

This is a crucial distinction:

  • Wire Extrusion: Generally results in a shell (a collection of connected faces without volume, like a pipe).
  • Face Extrusion: Results in a solid (a shape with enclosed volume, like a solid bar).

In the following examples, we first construct a complex wire, then create a planar face from this wire, and finally extrude this face to produce a solid 3D object. This demonstrates a common workflow: defining a profile as a face and then giving it depth to create a solid part.

Bitbybit Platform

Extrude the face into solid shape

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"a3ad01ccca577e86": {
"id": "a3ad01ccca577e86",
"name": "bitbybit.occt.operations.extrude",
"customName": "extrude",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"direction": [
0,
1,
0
]
},
"inputs": {
"direction": {
"connections": [
{
"node": "58f71d7c11226693",
"output": "result",
"data": {}
}
]
},
"shape": {
"connections": [
{
"node": "83b8300f86a7d1c6",
"output": "result",
"data": {}
}
]
}
},
"position": [
885.5203527172653,
551.3241854977023
]
},
"58f71d7c11226693": {
"id": "58f71d7c11226693",
"name": "bitbybit.vector.vectorXYZ",
"customName": "vector xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 0,
"y": 3,
"z": 0
},
"inputs": {
"y": {
"connections": [
{
"node": "16fef8b5633bf2fa",
"output": "result",
"data": {}
}
]
}
},
"position": [
380.20906256341385,
785.7649077285179
]
},
"16fef8b5633bf2fa": {
"id": "16fef8b5633bf2fa",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"data": {
"options": {
"min": 1,
"max": 6,
"step": 0.1,
"width": 350,
"updateOnDrag": false
},
"number": 1.5
},
"inputs": {},
"position": [
-663.9156894269311,
863.0508723168588
]
},
"3bb14d673fa0d00b": {
"id": "3bb14d673fa0d00b",
"name": "bitbybit.occt.shapes.wire.createHeartWire",
"customName": "heart wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
],
"rotation": 0,
"sizeApprox": 5
},
"inputs": {},
"position": [
-532.6021201120332,
340.9870613060303
]
},
"9b4a825147ce5bc0": {
"id": "9b4a825147ce5bc0",
"name": "bitbybit.occt.shapes.wire.createZigZagBetweenTwoWires",
"customName": "zig zag between two wires",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"nrZigZags": 31,
"inverse": true,
"divideByEqualDistance": true,
"zigZagsPerEdge": true
},
"inputs": {
"wire2": {
"connections": [
{
"node": "3bb14d673fa0d00b",
"output": "result",
"data": {}
}
]
},
"wire1": {
"connections": [
{
"node": "3102582b6246e51c",
"output": "result",
"data": {}
}
]
}
},
"position": [
-84.63233896640459,
106.29897050725572
]
},
"3102582b6246e51c": {
"id": "3102582b6246e51c",
"name": "bitbybit.occt.shapes.wire.createHeartWire",
"customName": "heart wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
],
"rotation": 0,
"sizeApprox": 7
},
"inputs": {},
"position": [
-513.0810817981617,
-69.32154536997916
]
},
"83b8300f86a7d1c6": {
"id": "83b8300f86a7d1c6",
"name": "bitbybit.occt.shapes.face.createFaceFromWire",
"customName": "face from wire",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"planar": true
},
"inputs": {
"shape": {
"connections": [
{
"node": "9b4a825147ce5bc0",
"output": "result",
"data": {}
}
]
}
},
"position": [
358.5062775790989,
214.32449710401428
]
}
}
}

With these examples, you've learned the basics of creating extruded 3D shapes from both 2D wire profiles (resulting in shells) and 2D faces (resulting in solids). This operation is a cornerstone of many CAD workflows, allowing for the creation of diverse geometries.

You can also extrude shells (shapes consisting out of multiple faces).

Feel free to experiment with different base wire and face shapes (e.g., circles, rectangles, polygons, or more complex custom profiles) and vary the extrusion vector (both direction and magnitude). You can also explore combining extrusion with other operations to create even more intricate designs. Happy modeling!