Discussion:
[OpenSCAD] import() .dxf image format to OpenSCAD
Still_learning
7 years ago
Permalink
I am running OpenSCAD version 2017.01.20 on a Windows 7 laptop
that is current on updates.

I am attempting to get a 2D image converted into a 3D extrusion
so that I may subtract it from a cube() face.

To that end I downloaded an open source .png of the image I am
want to use. Converted that image in into paths using GIMP 2.8.8
and exported it to an .svg file.

Opened the .svg file in LibreCAD (looked good and right) and exported
it as a .dxf file.

I am trying to get the .dxf file recognized and displayed by OpenSCAD
but keep drawing a blank screen, even though following a preview
command or file save, the console tells me I have created an object
with 8 geometries and 592 bytes in one normalized CSG tree.

No error messages are generated when previewed or saved.

So, apparently "Something" is being recognized, but the final result
is not being displayed.

Nothing appears to want to display because the display progress indicator
is not activated. Calculation time is 0 and 0.

Since I am not running Linux, Inkscape does not seem a particularly good
option.

code used is:

linear_extrude(height = 2, center = true, convexity = 10)
translate([0,0,0])
import(file = "image-foo.dxf");

File also previously referenced in "use <image-foo.dxf>" statement
earlier in commands file. File resides among .scad files in same dir.

Thoughts on why this might not be working are appreciated.

Recommendations for how to make it work are appreciated more so.

SJ



-----
The more I learn, the more I get curious about.
--
Sent from: http://forum.openscad.org/
Mark Schafer
7 years ago
Permalink
Its a bit of a redo for you but can I suggest this process instead:
- Download Inkscape (OS vector draw program) (now on 0.92)
- go here and get the openSCAD extension and install as directed:
   - https://www.thingiverse.com/thing:1065500
- dragNdrop your image onto the canvas - select it and
- use the Trace Bitmap tool under the Path menu to make a 2D shape from it.
- select that shape and use the extension under:
  - Extensions/Generate from Paths/ Paths to openSCAD
to export it to a scad file.
Edit the scad file to change the height...

Cheers...
...
Still_learning
7 years ago
Permalink
Downloaded Inkscape and the extension but my laziness
got the better of me so instead of retracing the bitmap
with Inkscape, I simply loaded the .svg file generated
by an image trace in GIMP, then followed your conversion
instructions using the Paths to OpenSCAD tool.

It worked.

Thanks.



-----
The more I learn, the more I get curious about.
--
Sent from: http://forum.openscad.org/

Torsten Paul
7 years ago
Permalink
The dev snapshots of OpenSCAD can import SVG directly. It's
still a bit experimental as SVG is not really a good format
for CAD but it should work for normal traced shapes. (The
import needs to be enabled in the Preferences)

ciao,
Torsten.
cbernhardt
7 years ago
Permalink
Can you post a link to your DXF file?




--
Sent from: http://forum.openscad.org/
Loading...