<p>I'm not aware of libraries that do that for you (but you can create your own, see end of the answer), but creating a relieve hole pattern is not that difficult or tedious using <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Conditional_and_Iterator_Functions" rel="nofollow noreferrer">iterator functions</a> (e.g. the <code>for loop</code>). Note that it may not be a good idea to make enclosed holes inside your object, see the bottom section &quot;Internal cavities in models&quot; at the bottom of the answer.</p>
<p>Small OpenSCAD test script:</p>
<pre><code> tol=0.2;
 
 difference(){
   cube([100,100,10]);
   for (x=[10:20:90]){
     for (y=[10:20:90]){
       translate([x,y,-tol/2]){
         cylinder(r=9,h=10+tol,$fn=180);
       }
     }
   }
 }
</code></pre>
<p><a href="https://i.sstatic.net/RUMaM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RUMaM.png" alt="enter image description here" /></a></p>
<p>This can be used for both parts of your question, but in case the pattern needs to be inside an object you need to lower the value of <code>h</code> in the subtracting cylinder and raise/translate it (you could use the <code>center=true</code> in the <code>cylinder</code> function as a parameter and raise the center to the middle of your object <code>translate([x,y,objectThickness/2])</code>). You could make a <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/User-Defined_Functions_and_Modules" rel="nofollow noreferrer"><code>module</code></a> of the recurring pattern yourself to create your library.</p>
<p>note: Replace <code>cylinder</code> with <code>cube</code> or any <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids" rel="nofollow noreferrer">other geometrical solid</a> or (2D) pattern (use <code>linear_extrude</code>) to subtract from your part.</p>
<hr />
<h2>Internal cavities in models</h2>
<p>Note that it is not always wise to create your own spacing/grid structure enclosed in the model. Please read the accepted answer of <a href="https://3dprinting.stackexchange.com/questions/182/why-do-some-models-appear-broken-in-slicing-software">this question</a>. This answer explains that slicer applications work best with true solids!</p>
<hr />

CC BY-SA 4.0
2018-05-24T06:27:17.700Z
2021-11-15T22:37:43.413Z
2021-11-15T22:37:43.413Z
0scar
<p>I am working on a design in OpenSCAD, and need (would want) two things that seem tedious to hand-code:</p>

<ol>
<li><p>A pattern of holes in a wall, for less weight/material. Could be round holes or some geometric pattern.</p></li>
<li><p>Empty enclosed space, with some grid-structure for stability. Again, for saving weight/material (and time during the printing).</p></li>
</ol>

<p>Are there any libraries for these things?</p>

<3d-models><3d-design><openscad>
OpenSCAD library for empty space/holes
Tomas By
# OpenSCAD library for empty space/holes

(Asked by: username_0 on 2018-05-23)

I am working on a design in OpenSCAD, and need (would want) two things that seem tedious to hand-code:

1. A pattern of holes in a wall, for less weight/material. Could be round holes or some geometric pattern.
2. Empty enclosed space, with some grid-structure for stability. Again, for saving weight/material (and time during the printing).

Are there any libraries for these things?

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

---

## 1 answers

### Answer by username_1 on 2018-05-24. Score: 5

I'm not aware of libraries that do that for you (but you can create your own, see end of the answer), but creating a relieve hole pattern is not that difficult or tedious using iterator functions (e.g. the for loop). Note that it may not be a good idea to make enclosed holes inside your object, see the bottom section "Internal cavities in models" at the bottom of the answer.
Small OpenSCAD test script:
 tol=0.2;
 
 difference(){
   cube([100,100,10]);
   for (x=[10:20:90]){
     for (y=[10:20:90]){
       translate([x,y,-tol/2]){
         cylinder(r=9,h=10+tol,$fn=180);
       }
     }
   }
 }


This can be used for both parts of your question, but in case the pattern needs to be inside an object you need to lower the value of h in the subtracting cylinder and raise/translate it (you could use the center=true in the cylinder function as a parameter and raise the center to the middle of your object translate([x,y,objectThickness/2])). You could make a module of the recurring pattern yourself to create your library.
note: Replace cylinder with cube or any other geometrical solid or (2D) pattern (use linear_extrude) to subtract from your part.

Internal cavities in models
Note that it is not always wise to create your own spacing/grid structure enclosed in the model. Please read the accepted answer of this question. This answer explains that slicer applications work best with true solids!


---

