How to Export a 2D illustration of a 3D model in OpenSCAD

I've been getting into OpenSCAD lately—I'd rather wrestle with a text-based 3D modeling application for more dimensional models than fight with lockups of Fusion 360!

One thing I wanted to do recently was model a sheet-metal object that would be cut from a flat piece of sheet metal, then folded into its final form using a brake. Before 3D printing the final design, or cutting metal, I wanted to 'dry fit' my design to make sure my measurements were correct.

The idea was to print a to-scale line drawing of the part on my laser printer, cut it out, fold it, and check to make sure everything lined up correctly.

Some online utilities took an STL file and turned it into a PNG, but they weren't great and most wouldn't output a PNG with the exact dimensions as the model (they printed too big or too small).

Here was my model:

3D Model for Mounting Plate in OpenSCAD

If I tried exporting a PDF or SVG of the model (File > Export > Export as PDF...), it understandably didn't know what to do:

Error in OpenSCAD - object is not a 2D object

To get something exportable, I just added projection() at the top of my model to turn the top-down view into a 2D projection, then Rendered the object. Now it shows up as a 2D plane drawing:

2D projection of 3D object in OpenSCAD

And now the 'Export as PDF...' option (as well as the other 2D options like SVG) works great, allowing me to save a to-scale PDF suitable for reference or printing:

2D PDF output of OpenSCAD 3D model projection

I decided to put up this blog post in the hopes it might help someone else doing the same thing. My DDG searches weren't quite coming up with anything besides a few old GitHub issues.

Now I'm thinking of how much easier many of my Illustrator drawings would be if I just programmed them in OpenSCAD...

Comments

I'd love to read more OpenScad stuff in this blog. I teach crude programming to 17-year-old electricianstudents, and OpenScad is becoming an important part of my teaching. Especially how to spend less time waiting for rendering. Will my future cm4 or cm3 pi cluster be able to distribute the workload evenly?

At this time, it doesn't seem like parallel processing (or distributed rendering) is a priority for OpenSCAD, so you'd still have to wait for the single-threaded rendering to complete :(

I'm designing a box in Openscad to hold my electronics for my 3d printer, and I want a way to print out a slice of my design on my hp Laserjet to scale so I could set the board on it and see if the holes lined up before I start wasting pla 3d printing it. This was exactly what I needed. Thank you so much. FYI I recognize the name I just so happen to watch you video's and enjoy your channel keep up the great work..... One day soon I hope to see a GPU on a RPi lol