<p>Extruding faces is only possible on 2D polygons. From a 3D object you cannot capture the face and extrude it. To extrude "faces" you would need to define the shape of the face and extend it in the third dimension of your choice. This way a 3D shape is created that could be concatenated (joined using e.g. <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/CSG_Modelling#union" rel="nofollow noreferrer"><code>union</code></a>) to the original shape. For the extrusion, the function <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion#Linear_Extrude" rel="nofollow noreferrer"><code>linear_extrude</code></a> is available:</p>

<pre><code>linear_extrude(height = fanwidth, center = true, convexity = 10, twist = -fanrot, slices = 20, scale = 1.0, $fn = 16) {...}
</code></pre>

CC BY-SA 4.0
2019-09-06T11:50:05.230Z
As long as you can know the plane a face is in, you can `projection` it to a 2D shape then extrude that. You can also capture a thin slice around a face manually via `intersection` and then `hull` it with a translate of itself. (Depending on the object the latter may or may not give exact results.)
R.. GitHub STOP HELPING ICE
CC BY-SA 4.0
2019-09-06T12:10:14.040Z
@R.. Very good examples to extrude "faces"! Please add that as a separate answer, or include it into your current answer.
0scar
CC BY-SA 4.0
2019-09-06T12:20:06.723Z
I've added this as a separate answer since it's unrelated to my existing one.
R.. GitHub STOP HELPING ICE
CC BY-SA 4.0
2019-09-06T12:21:51.070Z
@R.. Very nice, and certainly good that you separated the answers!
0scar
CC BY-SA 4.0
2019-09-06T06:43:35.897Z
2019-09-06T13:12:09.190Z
2019-09-06T13:12:09.190Z
0scar
<p>For extruding a single face, as long as you can know the plane the face is in, you can <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/3D_to_2D_Projection" rel="nofollow noreferrer"><code>projection</code></a> it to a 2D shape then <code>linear_extrude</code> that. In general you need the <code>cut=true</code> variant of <code>projection</code>, and you need to translate/rotate the object to be projected such that the face is in the XY plane (this is the "as long as you can know") part. Unfortunately this is subject to numerical instability, so you probably have to translate it by an extra 0.001 or so to <em>cross</em> the XY plane, in which case you'll end up with an approximation of the face rather than an exact version of it.</p>

<p>(Strictly speaking OpenSCAD doesn't have exact things anyway, except in the case of faces sharing points in a <code>polyhedron</code>, so this limitation probably doesn't make the situation any worse than it already is in OpenSCAD).</p>

<p>Once you have the projection, you can <code>linear_extrude</code> it in any direction you want, manipulate the result (e.g. skew with a transformation matrix), and rotate and translate it back onto the face. It should be possible to wrap up this whole operation into a <code>module</code> that operates on its child[ren].</p>

<p>Another approach would be capturing a thin slice around the face manually via <code>intersection</code>, then performing a <code>hull</code> with a translate of itself, but this will only work if it's convex (otherwise <code>hull</code> will fill in the convex hull of the 2D face shape too).</p>

CC BY-SA 4.0
2019-09-06T12:19:43.177Z
2019-09-06T12:19:43.177Z
R.. GitHub STOP HELPING ICE
<p>Built-in to the language and its CSG model, no - processing the CSG tree is a completely separate phase following execution of the functional language, and there is no way to "read back" anything from the conversion of the model into faces in order to operate on the faces.</p>

<p>However, you can do this if you're willing to do some heavy lifting yourself, or look for library code from someone else who's already done it. What it would involve is working out a description form of your own in terms of nested lists representing the model, with a module for converting the list to an OpenSCAD CSG tree. You can then write functions to manipulate this description in arbitrary ways, essentially reinventing the CSG phase of OpenSCAD within its own language. Some lesser versions of this have definitely been done in the past for things like implementing "loft" type functionality in OpenSCAD.</p>

CC BY-SA 4.0
2019-09-06T11:53:44.073Z
2019-09-06T11:53:44.073Z
R.. GitHub STOP HELPING ICE
<p>For the geometry I am making, I want to extrude each face individually along its normal.</p>

<p>This is a standard procedure in 3D modeling software like Blender; see Example 3 <a href="https://blender.stackexchange.com/questions/7365/extrude-faces-along-local-normals">here</a>. </p>

<p>Is this possible in OpenSCAD?</p>

<3d-models><openscad>
Is it possible extrude faces along normals individually in OpenSCAD?
Roman Kogan
# Is it possible extrude faces along normals individually in OpenSCAD?

(Asked by: username_0 on 2019-09-06)

For the geometry I am making, I want to extrude each face individually along its normal.

This is a standard procedure in 3D modeling software like Blender; see Example 3 [here](https://blender.stackexchange.com/questions/7365/extrude-faces-along-local-normals).

Is this possible in OpenSCAD?

**Tags:** 3d-models, openscad

---

## 3 answers

### Answer by username_1 on 2019-09-06. Score: 2

Extruding faces is only possible on 2D polygons. From a 3D object you cannot capture the face and extrude it. To extrude "faces" you would need to define the shape of the face and extend it in the third dimension of your choice. This way a 3D shape is created that could be concatenated (joined using e.g. union) to the original shape. For the extrusion, the function linear_extrude is available:
linear_extrude(height = fanwidth, center = true, convexity = 10, twist = -fanrot, slices = 20, scale = 1.0, $fn = 16) {...}

> **Comments:**
> **username_2**: As long as you can know the plane a face is in, you can `projection` it to a 2D shape then extrude that. You can also capture a thin slice around a face manually via `intersection` and then `hull` it with a translate of itself. (Depending on the object the latter may or may not give exact results.)  
> **username_1**: @R.. Very good examples to extrude "faces"! Please add that as a separate answer, or include it into your current answer.  
> **username_2**: I've added this as a separate answer since it's unrelated to my existing one.  
> **username_1**: @R.. Very nice, and certainly good that you separated the answers!  

---

### Answer by username_2 on 2019-09-06. Score: 2

For extruding a single face, as long as you can know the plane the face is in, you can [`projection`](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/3D_to_2D_Projection) it to a 2D shape then `linear_extrude` that. In general you need the `cut=true` variant of `projection`, and you need to translate/rotate the object to be projected such that the face is in the XY plane (this is the "as long as you can know") part. Unfortunately this is subject to numerical instability, so you probably have to translate it by an extra 0.001 or so to *cross* the XY plane, in which case you'll end up with an approximation of the face rather than an exact version of it.

(Strictly speaking OpenSCAD doesn't have exact things anyway, except in the case of faces sharing points in a `polyhedron`, so this limitation probably doesn't make the situation any worse than it already is in OpenSCAD).

Once you have the projection, you can `linear_extrude` it in any direction you want, manipulate the result (e.g. skew with a transformation matrix), and rotate and translate it back onto the face. It should be possible to wrap up this whole operation into a `module` that operates on its child[ren].

Another approach would be capturing a thin slice around the face manually via `intersection`, then performing a `hull` with a translate of itself, but this will only work if it's convex (otherwise `hull` will fill in the convex hull of the 2D face shape too).


---

### Answer by username_2 on 2019-09-06. Score: 1

Built-in to the language and its CSG model, no - processing the CSG tree is a completely separate phase following execution of the functional language, and there is no way to "read back" anything from the conversion of the model into faces in order to operate on the faces.

However, you can do this if you're willing to do some heavy lifting yourself, or look for library code from someone else who's already done it. What it would involve is working out a description form of your own in terms of nested lists representing the model, with a module for converting the list to an OpenSCAD CSG tree. You can then write functions to manipulate this description in arbitrary ways, essentially reinventing the CSG phase of OpenSCAD within its own language. Some lesser versions of this have definitely been done in the past for things like implementing "loft" type functionality in OpenSCAD.


---

