Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using polylines for DXF export #448

Closed
wants to merge 1 commit into from

Conversation

felipesanches
Copy link

Everytime I send DXF files generated by openscad to our laser cutting service provider, they complain that the vectors are "all broken apart". I ended up figuring out that it means the current DXF exporter generates several independent line segments.

So this patch uses DXF polilynes instead, which makes it much nicer to do further editing of the generated DXF vectors.

happy hacking,
Felipe Sanches
metamaquina.com.br

@kintel
Copy link
Member

kintel commented Aug 19, 2013

I saw you removed the DICTIONARY entry - was that on purpose? At least older versions of Inkscape required that, but I haven't tested that lately.

@felipesanches
Copy link
Author

No, it wasn't on purpose. I simply did what I thought was correct. If you know a better way of doing it and that's better, I would appreciate to get it improved.

@kintel
Copy link
Member

kintel commented Aug 20, 2013

Which software do you import into for laser cutting?

The new dxf output fails to import into QCad, which is one of the primary target tools. I haven't yet tried LibreCad.
Corel Draw is often used for laser cutting, making that another target tool.
Illustrator might also be one we should support.

We should write up some manual tests to make sure we cover this properly.

@peteruithoven
Copy link

I also sometimes use OpenSCAD for lasercutting and I use VisiCut, a opensource tool for lasercutting.
But it's also important that Inkscape is supported since people might want to tweak stuff. Both tools are supported by the current release. Illustrator support would be great.

@felipesanches
Copy link
Author

I use Inkscape for tweaking the design before sending the files to my lasercutter service provider. I don't know which software he uses, but, since I save the result in Inkscape, he never receives the original DXF files generated directly by OpenSCAD.

The kinds of tweaks I do with inkscape are related to coloring the portions of the file that should be laser-etched. I'd love to automate this process.

I'm not a QCad (community edition), LibreCAD, FreeCAD or VisiCut user (yet! But would be happy to try these in order to improve dxf polyline export).

I do not use Corel, Illustrator, QCAD (non-free cutting-edge version) or any other proprietary tool. I cannot help with these. The interested parties will have to test features on these by themselves if they need it.

@kintel
Copy link
Member

kintel commented Aug 21, 2013

A very similar patch was attempted merged a long while ago: fe5e199
That commit mentions some of the reasons we had to revert that.

In short: This is a larger project than merely outputting polylines..

@matthijskooijman
Copy link

I just ran into this problem as well - because the segments are cut apart, our visicut/laos powered lasercutter jumps all over the place trying to cut them one by one...

In case it helps, openjscad.org seems to generate polyline DXF files that import into inkscape and visicut just fine, though I haven't got autocad to test.

This openjscad program:

function main() { 
 return circle(100);
}

Generates this DXF file: https://gist.github.com/matthijskooijman/c71338b4a5feaf091ab4

Anyone with autocad that can confirm it still loads?

@RudolfCardinal
Copy link

Since OpenSCAD-2019.05-x86_64 still exports lots of chopped-up lines, but has a perfectly good SVG export, attached is a quick standalone workaround in Python 3 to convert SVG output to DXF using LWPOLYLINE, via the "svg.path" and "ezdxf" libraries. This obviates the need to use Inkscape as an intermediate (in my case, Inkscape was struggling).

svg_to_dxf.zip

@t-paul
Copy link
Member

t-paul commented Mar 2, 2020

Closing, abandoned long time ago.

@t-paul t-paul closed this Mar 2, 2020
@wheybags
Copy link

Since this comes up in google searches still, I'll add the solution I settled on here.
I tried @RudolfCardinal's script, to export as svg then convert svg->dxf, and it worked pretty well but the resulting drawing was vertically flipped. Using inkscape to convert from SVG worked great for me instead, with a command line like the following:
inkscape --export-filename=export_side.dxf export_side.svg --export-extension=org.ekips.output.dxf_outlines

The only catch is that the --export-filename command was only recently added to inkscape, so you will need a copy of a development version. I used their bleeding edge ppa here: https://inkscape.org/release/inkscape-master/gnulinux/ubuntu/ppa/dl/
This will obviously not be a problemif you're reading this far in the future :D

I would also like to point out, that it would still be really nice to have a proper solution integrated into openscad directly.

@naggie
Copy link

naggie commented Feb 14, 2021

I tried the dxf_outline inkscape extension -- I had to use it independently as the --export-extension flag is apparently no longer available with inkscape 1.0 or something.

This can be accomplished by cloning the inkscape extensions repository and trying something like:

python3 ~/extensions/dxf_outlines.py --output=plate.dxf plate.svg

However, whilst this produces a DXF (from an OpenSCAD 2021.1 SVG) the DXF seems to be a collection of unconnected lines instead of a nice polyline.

What I ended up doing was a view of my part with mirror([0,1]) applied such that I could use @RudolfCardinal 's svg_to_dxf.py without the resultant vertical-flip encountered by @wheybags .

I just wanted to say thanks, @RudolfCardinal -- I now have a DXF file that I think I can get manufactured! Any idea what's causing the flip? I assume it's just 2 different co-ordinate systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants