OpenSCAD Layout Grid

OpenSCAD Build Surface Grid
OpenSCAD Build Surface Grid

This OpenSCAD module spreads an array of cubes across the otherwise featureless preview window, so I know whether the gizmo I’m building or the parts I’m arranging actually fit on the Thing-O-Matic’s build platform. This doesn’t get out to the very edge, but if it looks close, then I should pay more attention anyway.

module ShowPegGrid(Size) {

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

}

ShowPegGrid(1.0);

You obviously don’t want to extrude these things, so put the ShowPegGrid() statement inside an if, so you can turn it off for the final build layout.

8 thoughts on “OpenSCAD Layout Grid

  1. I do something similar: “square(100,true);”
    Since the square can’t render, I won’t accidentally forget it in the final STL. :)

    1. That’s quick & easy… and I like the part about not having to remember anything!

      The grid o’ chunks lets me eyeball the offsets when I’m arranging a bunch of parts, which turned out to be surprisingly useful.

  2. The grid is interesting. Using:

    %ShowPegGrid(1.0);

    will make it transparent grey and keep it from rendering.

    I use this:

    //100×100 build platform for debug
    translate([-50,-50,-1.01]) %cube([100,100,1]);

    but I like MakerBlock’s “2D-square” version with its built-in no render.

      1. That vertical offset of -1.01 mm puts the sheet just under the build platform, which keeps the bottom of the objects out of the gray goo.

        That said, I have an intense aversion to negative Z coordinates in the model and can cite some scrapes in the platform as justification. We all know that sheet isn’t printable, but does the printer know?

Comments are closed.