OpenSCAD library for empty space/holes


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?

Tomas By

Posted 2018-05-23T22:28:22.280

Reputation: 509



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.i. the for loop). Note that it may not be a good idea to make enclosed holes inside your object, see the edit section at the bottom of the answer.

Small OpenSCAD test script:


   for (x=[10:20:90]){
     for (y=[10:20:90]){

enter image description here

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.


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!


Posted 2018-05-23T22:28:22.280

Reputation: 25 570