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:


A pattern of holes in a wall, for less weight/material. Could be round holes or some geometric pattern.
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?
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:

 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.



EDIT:

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!