2012.07.16

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.

Converting OpenSCAD files to DXF files

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.

Rendering the OpenSCAD file

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.

DXF? Not yet!

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.

Render the DXF!

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.

DXF in Inkscape

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.

11 Responses to “OpenSCAD to DXF”

  1. twitter_caohaoimNo Gravatar says:

    I am just learning OpenSCAD. what does this process yield that is different than the normal exported .dxf?

  2. With the built-in DXF export you can only export a 2D file. This method will work for 3D files. I believe you can also rotate the object and select a specific height along the z-axis to slice. In this case since I was laser cutting instead of 3D printing, I specifically needed some 2D vector format, and DXF made the most sense.

  3. twitter_caohaoimNo Gravatar says:

    So if I have it right this DXF is a 3D DXF?

  4. Well, the DXF I output was a 2D DXF, but it is created through pulling in a 3D STL file and just grabbing a 2D slice of it. I assume you can create a 2D file in OpenSCAD and export directly to a DXF, but I do not know how.

    The nice thing about OpenSCAD is that you can tweak the variables. The original files expected a thicker wood, but I made the edits needed to work with 3mm wood instead.

  5. Once I get to test this all on the laser cutter and confirm it works (maybe next week?) I can toss it on Thingiverse.

  6. twitter_caohaoimNo Gravatar says:

    Will have to really dig into OpenSCAD. It thinks more like I do that something like blender.

    As an aside there seems to be something screwed up with my account here. When I first logged onto here it gave me the option to login using my twitter account. SO I did. Unfortunately the email is something completely fictitious twitter.caohaoim@example.com. My email is caohaoim@gmail.com. I was going to put in an avatar but don’t see an option.

  7. I ended up disabling some of the Twitter integration stuff during an upgrade. That probably broke something.

    Also, Blender confuses the hell out of me.

  8. twitter_caohaoimNo Gravatar says:

    Re Blender. Thank God I’m not the only one. I thought I had lost IQ points.

  9. Hmmm, I think I was confusing things.

    “With the built-in DXF export you can only export a 2D file. This method will work for 3D files”

    I meant the original .scad file being 2D versus 3D. Not the DXF file that you output. In the scenario I outlined above, the final output would always be a 2D DXF file.

    I hope that makes sense.

  10. Andy PalmerNo Gravatar says:

    You can cut out the intermediate compile and export by changing the line that reads plate(); to projection(cut=false) plate();

  11. andrewNo Gravatar says:

    Thanks for the original post and Andy Palmer’s great suggestion. I’m muddling through openSCAD specifically for gears and other parts destined for the laser cutter. Knowing that I can add projection(cut=false) before the function call makes reusing SCAD scripts form thingiverse super easy!

« | »

buy the button:

Buy The Button

recently at:


top recent artists: