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.

About these ads

  1. #1 by MakerBlock on 2011-06-28 - 11:55

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

    • #2 by Ed on 2011-06-28 - 15:31

      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. #3 by Brent on 2011-06-28 - 12:18

    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.

    • #4 by Ed on 2011-06-28 - 15:33

      make it transparent grey

      [sound of one hand clapping forehead]

      Of course!

    • #5 by MakerBlock on 2011-06-28 - 16:07

      @Brent: Adding the “true” flag will center the cube or square automagically. Try:
      %cube([100,100,1],true);

      • #6 by Ed on 2011-06-28 - 17:30

        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?

  1. Helmet Mirror Mount: Solid Model « The Smell of Molten Projects in the Morning
  2. Revised OpenSCAD Layout Grid « The Smell of Molten Projects in the Morning