Converting STL to DXF

Searching on this forum is irritating.

I’m trying to convert a Terrain2STL download to a DXF so I can cut it in Vectric Vcarve Desktop. I don’t need the terrain other than a slice at the surface to get an outline.

Search engine shows a bunch of converters, but so many require signup. I thought I had read stuff on here, but danged if I can find anything in a search.

1 Like

It may work to import the STL into OpenSCAD, adjust/rotate as desired, then use the projection() command to allow rendering the 2D outline and exporting to a DXF.

Thanks, Will. I’ll try that, but now I’ve got to refresh my OpenSCAD. They had some discussion about improving all that import/export stuff, but that was back in 2015.

I tried Slic3r to get an SVG file, but apparently it puts all slices of the STL into one file and there’s no way to limit it to a single slice that I can see. It will import as an SVG, but I’m supposing I’m only getting the first or last slice. Well, it is designed for 3D printing and creating gcode.

So, OpenSCAD might export as a DXF, but it won’t as long as the “top level object is not a 2D object.”

This sounds like I’m fixing to hit that brick wall at the end of the alley. :man_facepalming:

Did you use the projection() command and render? That should make a 2D object of the imported STL.

The syntax for projection() command is escaping me. I’m importing the stl but projection() is not recognizing what I’m using. I’m thinking it should be the name of the .scad file, but it says it doesn’t recognize that and ignores the line.

I tried adding the path to the file, too.

Do you expect to get a 3D DXF or a 2D one? Slightly confused on what you expect :wink:

It’s documented at:

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/3D_to_2D_Projection

Basically you need the command, the option(s) in the parentheses, then you need to call the object (the STL).

Could you post the file you have?

Since it sounds like you just want a 2D slice from the 3D STL file, you might try one of the slicers that are used for laser cutting. Slicer for Fusion 360 works well, but it looks like it’s not going to be supported any longer. You might find a stand alone app or one that works with Sketchup, for example this or this.

@WillAdams @fenrus @rowiac
The file I’m using for an example is larger than the 4M limit here, here is the link to Terrain2STL.

I’m looking for an easy way to get a 2D slice out of the 3D STL. There are so many STLs around for 3D printing, and my current project is a lake outline from an STL created with Terrain2STL. Ideally, I could specify which slice, so I can adjust the edge profile without a ton of vector editing.

I found Slic3r. That will export a DXF (or maybe an SVG :thinking:) from an STL since it uses that system to do 3D printing. However, I found that the slices are stored sequentially in the resulting file with no obvious way to choose one.

Then Will suggested OpenSCAD would squeeze out a 2D slice, but I’m a bit rusty with that.

Calling the object is where I’ve lost my mind. I’ve referenced the the file name as local and with the full path without success. Am I somehow creating a default object name the isn’t visible to me?

For openScad, you can try this, where the -8 is the height of the slice you want to grab:

projection()
    translate([0,0,-8])
        import ("C:\\Users\\Gerrard\\Downloads\\StoneWallA.stl");

After this, hit F6 to render it then export as DXF

1 Like

Thanks @Gerry. “translate()” is something I saw in the docs, but certainly didn’t comprehend how to use it.

So, I tried this in OpenSCAD without visible success. Is it modifying the STL that I referenced?

Render (F6)

projection() translate([0,0,-8]) import(“\PAUL-PC\Public\Public Downloads\GraphicDownloads\LakeLivingstonTerrain_89650\stls/rawmodel_89650.stl”);

Parsing design (AST generation)…
Compiling design (CSG Tree generation)…
Rendering Polygon Mesh using CGAL…
UI-WARNING: No top level geometry to render

Then if I do export from the file menu

ERROR: Nothing to export! Try rendering first (press F6).

Tinkercad will get you an SVG, but it may not handle a really big stl.

Yeah, Tinkercad choked on the STL, but made me wait before it did! :wink:

What shows on the screen? You should see a 2D representation of what you want to export.

That’s right. Nothing shows on the screen. I’m air cutting? :smiley:

Adjust the placement of the STL using Translate until it intersects the Z-plane at zero and renders the view you want.

This is an incorrect path. If it’s an SMB network share, it would have double backslash \\ at the start. You also have a forward slash in there too.

What’s your OS?

How are you coming up with the path for the STL?

1 Like