SVG saved as DXF does not keep layers

Bug #410928 reported by sieg01
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Undecided
Alvin Penner

Bug Description

From the .47pre1.1 version.

Saving a SVG as DXF will not keep the layers.

There was a fix for this from better better dxf (http://tim.cexx.org/?p=590) that took the SVG layers and saved them as DXF layers.

sieg01 (sieg01)
tags: added: dxf export svg
Revision history for this message
su_v (suv-lp) wrote :

What changed since bug #410926 "DXF file is blank when opened"?

su_v (suv-lp)
tags: added: exporting extensions-plugins
removed: export
Revision history for this message
su_v (suv-lp) wrote :

see related bug #192923 about enhanced dxf export using the output extension "Desktop Cutting Plotter (*.DXF)"

Revision history for this message
sieg01 (sieg01) wrote :

I can open a Inkscape DXF file in QCAD, but I can't reopen the DXF in inkscape.

bug #192923 relates to DXF but not to including layers in the DXF export.

It looks like much of the work was done here (http://tim.cexx.org/?p=590) I am just not sure what would be need to include the patch in the .47 release.

Revision history for this message
su_v (suv-lp) wrote :

I tried to run 'b2_dxf_output' with Inkscape 0.46+devel r22028 on OS X 10.5.8. It failed with Python 2.6.2, but seems to work with Python 2.5.1. I'll attach the DXF file so you can test it (I don't have a CAD program here to test).

Other issues:
- 'b2_dxf_output' uses a modified version of 'simpletransform.py', a inkscape system extension file - I don't know how easy it would be to merge these two.
- 'b2_dxf_output' is based on an earlier version of 'dxf_outlines.inx' which has been modified and improved by Alvin Penner (see bug #192923) - Alvin would have to take a look at how to merge the two versions.

Revision history for this message
su_v (suv-lp) wrote :

Above attached exported DXF re-opened with Inkscape seems to retain all layer information, but the color is wrong - haven't checked though how it handles layer or entity specific color settings in general.

Revision history for this message
su_v (suv-lp) wrote :

oops - took the file from your other report (bug #410926 “DXF file is blank when opened”) as an example because the contour lines are on many different layers... sorry, now it's me who's confusing the two bugs. But above two comments 4 and 5 are related to the issue of layer export in DXF, i.e. this bug.

Original svg example: <http://launchpadlibrarian.net/30070847/northlonglake.svg>

Revision history for this message
sieg01 (sieg01) wrote :

How to you pick which python your using?

The DXF looks OK all of the layers are on there... In Qcad there seems like there are a bunch of little sub-lines instead of a continuous contour. I am not sure why it is doing that. If you look at the SVG it appears to have the same problem... it is composed of a bunch of 2 point lines that are not connected. You can see it if you zoom in.

I also tried to import it into sheetcam (cam software for CNC machine). It looks like it loads but nothing appears. That maybe a sheetcam issue though. I have gotten DXFs to load in the past before though. Or it could be related to the sub-line issue.

Revision history for this message
su_v (suv-lp) wrote :

> How to you pick which python your using?
I'm on a Mac - don't know about XP. Mainly by setting environment variables (like $PYTHONHOME or $PYTHONPATH). And Python itself has a utility (here: python_select) which allows to switch the currently used version (by changing links to a specific version number). Really don't know much about Python, and even less about Python on WIndows, sorry.

I noticed too that all paths in the re-imported dxf file are split into segments, and not all segments seem to connect precisely (tried to select a small contour line and join the segments with 'Combine' and then the node tool - unsuccessfully). This will make it rather useless for a CNC machine or Desktop Cutter - don't they require continuous paths/plines? Have to re-read <http://tim.cexx.org/?p=590> - maybe there are some comments about this… Or did Alvin fix it in his version?

Revision history for this message
sieg01 (sieg01) wrote :

Yeah I think sheet cam must want continuous paths and that is probably the reason it is not liking it.

A few months ago I had the export (http://tim.cexx.org/?p=590) on the stock inkscape .46 working well. I could export the svg into dxf and pull them into sheetcam just fine. But now I reinstalled the .46 version and I am still having issues. Something changed or maybe I'm not doing the whole process the same...

I put the .47pre1.1 version on because I saw there had been some updates on the dxf stuff. I was hoping some of the changes by tim (http://tim.cexx.org/?p=590) had made it in. But that appears to have been a separate effort. Well hopefully some of those changes can be rolled in.

Revision history for this message
Alvin Penner (apenner) wrote :

confirmed, have not yet decided what the scope of the job would be.

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Alvin Penner (apenner) wrote :

- just a quick follow-up.
- I used the file b2_dxf_output.zip to convert the drawing northlonglake.svg to .dxf.
- the good news is that it loaded into QCad and the layer information seemed to be preserved correctly, as expected.
- the bad news is that I could not view this dxf file using Voloview Express , nor could I view it with DWG Trueview. These are my favorite viewers because they are free and they are both made by Autodesk.
- I'll see if I can find out why the dxf file is not viewable.

Revision history for this message
Alvin Penner (apenner) wrote :

attached is a proposal that adds support for layers to the Desktop Cutting Plotter .DXF output. This affects the files dxf_outlines.py and dxf_templates.py

Revision history for this message
Alvin Penner (apenner) wrote :

any feedback would be welcome.

Alvin Penner (apenner)
Changed in inkscape:
status: Confirmed → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

Layer support in export to DXF (R13) tested and confirmed with Inkscape 0.48+devel r9676 on OS X 10.5.8, verified with QCad 2.0.5.0.

@Alvin - thx :)

Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
tags: removed: svg
Revision history for this message
su_v (suv-lp) wrote :

@Alvin - would you consider it save backporting the DXF export fix for layers to the 0.48.x branch so that the latest improvements get released with 0.48.1?

The changes are in revision 9675 (layer support, bug #410928).

Revision history for this message
Alvin Penner (apenner) wrote :

yes, I think it would be safe to backport these files. The changes would affect the files

dxf_outlines.py rev 9675
dxf_templates.py rev 9675
hpgl_output.py rev 9689

These changes involved a new reference to the file simpletransform.py, which was modified in rev 9635. However, this modification does not relate to either dxf or hpgl. Rev 9635 was new code that did not involve any changes to existing code.

Having said that, I know absolutely nothing at all about how backporting works, so perhaps someone else can make a better judgement.

Revision history for this message
su_v (suv-lp) wrote :

backported to inkscape 0.48.x in r9721

Changed in inkscape:
milestone: none → 0.48.1
jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.