Converting STL to DXF

You are correct, of course. I’ve edited that path several times trying to get a result, so have screwed it somewhere! I will double check it. Originally, I was doing it on the network, but have since moved to that PC, so it will be “C:\ …”

Will, I was trying what Gerry suggested to see what that does, so will change to “0,0,0” instead of “0,0,-8” to see what changes.

I used double backslashes since a single blackslash is an escape character in many strings.

So if you have no success with C:\Path\To\The\Thing then try C:\\Path\\To\\The\\Thing

The translation [0,0,-8] is moving the object down through the z-axis by 8 units, which are often millimetres.

When you do the import of the STL, it usually puts it in the world-space such that the base is sitting at z==0. Consequently, a projection at that point will be the profile of the base of the object.

If you want the projection to profile a different slice, you need to move (translate) the object, and possibly rotate it, such that the z plane at z==0 cuts through the cross-section you want to profile.

1 Like

projection() translate([0,0,-8]) import("C:\\Public\\Public Downloads\\GraphicDownloads\\LakeLivingstonTerrain_89650\\stls\\rawmodel_89650.stl");
Results in no display of anything and the following in the Console:

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

PS. I figured out that the forum was filtering the duplicate “\” characters! Fixed that.

It turns at that this is pretty easy to do in Meshmixer, the program that @jepho mentioned above. I use Meshmixer all the time for manipulating 3D models for 3D printing, but I had never tried exporting a 2D shape with it before.

The steps to do it are a follows:

Using a 3D terrain file (in STL format) I had previously downloaded from TouchTerrain, I open the file in Meshmixer:
(For reference, this is a 6.8 MB file.)

And do a plane cut [Edit | Plane Cut]:
Adjust the blue arrow up and down to set the cutting plane at the elevation you want.

Getting this:

Then save the file as an SVG [File | Export SVG].
Open the SVG in Inkscape, et voilà! You have a 2D shape of the slice!

4 Likes

If you still want to try this in OpenSCAD, run each part separately… the -8 was only for my model and might not be suitable for yours.

Start with:
import("C:\\Public\\Public Downloads\\GraphicDownloads\\LakeLivingstonTerrain_89650\\stls\\rawmodel_89650.stl");

You MUST be able to see your model at this point otherwise stop :slight_smile:

Then try with different Z offsets:
translate([0,0,-8]) import("C:\\Public\\Public Downloads\\GraphicDownloads\\LakeLivingstonTerrain_89650\\stls\\rawmodel_89650.stl");

Finally:
projection() translate([0,0,-???]) import("C:\\Public\\Public Downloads\\GraphicDownloads\\LakeLivingstonTerrain_89650\\stls\\rawmodel_89650.stl");

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.