Revised OpenSCAD Layout Grid

Following the suggestions in the comments to my previous attempt at an OpenSCAD layout grid, this pass works better:

  • Leave it turned on all the time
  • Parameterized everything
  • Useful default values
  • Less obtrusive

It looks about the same as before, only now it’s transparent gray. The 2-unit cube in the middle marks the “your object goes there” spot; the % prefix on the grid cubes causes OpenSCAD to ignore them.

OpenSCAD Build Surface Grid - revised
OpenSCAD Build Surface Grid - revised

The OpenSCAD source code:

module ShowPegGrid(Space = 10.0,Size = 1.0) {

Range = floor(50 / Space);

for (x=[-Range:Range])
for (y=[-Range:Range])
translate([x*Space,y*Space,Size/2])
%cube(Size,center=true);

}

ShowPegGrid();
cube(2,center=true);