There are many posts here which may not offer new information, but what they are is my information, usually gathered from other places, and with my own point of view. So with that said, here’s how I converted an OpenSCAD file designed to be used on a laser cutter into a DXF file. I put this out there as much for myself (so I know how to do it next time) as much as for others who might find the information useful.
We’re going to start with a .scad file in OpenSCAD. I’m using this file from the Laser Cut Filament Spool, and even though there are DXF files available, I ended up tweaking the .scad file, so I had to create new DXF files.
We start by opening the plate.scad file in OpenSCAD and doing a Compile and Render (CGAL) command, which is what you would do with any .scad file.
Once your object appears, you might say “Hey look! There’s an ‘Export as DXF’ command under the Design menu.” Well, that won’t work because our object is a 3D object, not a 2D object. So we need a few extra steps.
Instead of exporting as a DXF, just export it as an STL file, which may be what you normally do if you use OpenSCAD for generating things you can print on your 3D printer.
Did you output the STL file? Good! We’re ready for the next step…
We’re going to create a new file in OpenSCAD. Name it something like plate2dxf.scad and use the following line of code:
projection(cut=false) import("/Users/pete/Spool/plate.stl");
(Obviously you’ll need to edit the path to the file to match your own situation. If you have the files in the same folder you can just use “plate.stl” instead of the full path.)
Run the Compile and Render (CGAL) command again, and wait… wait… wait… Yeah, it took 10 minutes for this file to render. It’s not a fast process.
Once this is done, you can now use the “Export as DXF” command and get a standard 2D DXF file suitable for other applications.
Here’s my DXF file loaded into Inkscape. I typically use Inkscape to work with files I plan to laser cut. There’s a good explanation of my process in the post Laser. Cut. Files. (Part III). And yeah, I could have used this method previously had I known about it.
Hat tip to Giles Bathgate for his post Extracting 2D mendel outlines using OpenSCAD which was a tremendous help.
