dxf import problem

Bug #1001521 reported by pareshchaudhary on 2012-05-19
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

I am using lnkscape in linux. I have open some dxf file inkscape successfully but some them does not display anything in inkscape.

I have attach one dxf file that does not display anything.

Let me know any solution.

I also add one another file

su_v (suv-lp) wrote :

> I am using lnkscape in linux.

Which version of Inkscape do you have installed? (See Inkscape menu 'Help > About Inkscape')

> dxf_input.py (25.1 KiB, text/x-python)

AFAICT the attached version of 'dxf_input.py' doesn't exactly match any version distributed with stable releases of Inkscape 0.48.x - did you install a custom version of the python script?

su_v (suv-lp) on 2012-05-19
tags: added: dxf importing

I am using 0.48.1 version inkscape

su_v (suv-lp) wrote :

> 2.dxf (269.5 KiB, text/plain)

Reproduced with Inkscape (import is empty),
not reproduced with Inkscape 0.48+devel r11384 (see attached SVG file)

It appears though that the imported paths miss a closing segment (when comparing the rendering of the SVG file with the DXF file as displayed e.g. with SolidWorks' eDrawings viewer).

su_v (suv-lp) wrote :

> 1234.dxf (16.3 KiB, text/plain)

This appears to contain a single text object (no other vector data), and the imported text object contains the text content as well as the formatting options (see attached SVG file created with Inkscape 0.48+devel r11386).

@Alvin - wasn't this discussed in an earlier report? I don't recall whether it involved resaving the file with QCad first, to be able to import the text as properly formatted text object.

su_v (suv-lp) wrote :

> 1234.dxf (16.3 KiB, text/plain)

attached: DXF file opened in DraftSight and exported as SVG.

In which file i have to apply patch. I can't change inkscape version.

Alvin Penner (apenner) wrote :

you can get the most recent version of the code at the address:

you will need to download the two files dxf_input.py and dxf_input.inx. Then save them in the directory \Inkscape\share\extensions\ where the current files are located. You may want to make a backup of your current 2 files just in case.

I can confirm that the dxf_input shows some unwanted formatting info like font name, will try later in the day to see if importing into QCad would help

Alvin Penner (apenner) wrote :

for the file 2.dxf, just writing to confirm the missing closing segment compared to QCad

for the file 1234.dxf, there is some unwanted text formatting info

in both cases a temporary workaround is to load the dxf file into QCad and resave it as dxf, then load into recent Inkscape

Changed in inkscape:
status: New → Confirmed

As per comment #10 i have download dxf_input.inx and dxf_input.py

1234.dxf file open successfully and 2.dxf display wrong . i have attach drawing.svg and also attach two dxf file that does not open ..

Give me Fix solution

When import abc.dxf file then inkscape display error like

Traceback (most recent call last):
  File "dxf_input.py", line 468, in <module>
    layer = layer_nodes[vals[groups['8']][0]]
KeyError: u'Layer 1'

Alvin Penner (apenner) wrote :

- in comment 12, the file drawing.svg is a confirmation of what had previously been stated, namely that there is unwanted formatting information in this file. In this case the temporary workaround is to either edit the svg file to remove the unwanted information, or load the dxf file into QCad and resave it, which will produce a dxf file file that can be correctly read into Inkscape.

- with respect to the file 2.dxf, as stated previously in comment 6, it appears that the last segment, the closing segment, in some paths is missing. In this case the temporary workaround is to use QCad to resave the file.

Alvin Penner (apenner) wrote :

with respect to the file ganesha.dxf, it appears that the problem is the same as the file 1234.dxf, unwanted formatting info, and it can be resolved the same as previously suggested

Alvin Penner (apenner) wrote :

with respect to the file abc.dxf, this file contains in it the comment:

Inkscape export via "Better DXF Output" (<email address hidden>)

this suggests that it was probably originally a svg file exported to dxf using a different dxf output routine.
- could you attach the original svg file that this was based on?
- alternatively could you export it to dxf using the Inkscape routine that has the file type "Desktop Cutting Plotter (AutoCAD DXF R14)? Then try to re-import it back into Inkscape to see if it works.

Alvin Penner (apenner) wrote :

attached is a modified version of dxf_input.py. This version will close the missing line segments in the splines in the file 2.dxf

Alvin Penner (apenner) wrote :

closing segment committed to bzr rev 11467

su_v (suv-lp) wrote :

Adding tag 'backport-proposed' for revision 11467
(to be verified: possibly depends on fix for bug #892496 to be backported to 0.48.x first ?)

tags: added: backport-proposed
su_v (suv-lp) wrote :

Backported to branch 0.48.x in revision 9935.

tags: removed: backport-proposed
su_v (suv-lp) wrote :

Keeping open for now since the report was used for multiple, unrelated issues with DXF import.
The backported fix was for closing 'z' segments only.

Beluga (buovjaga) wrote :

Tried to open 1234.dxf:

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/inkex.py", line 113, in <module>
    from lxml import etree
ImportError: No module named 'lxml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "dxf_input.py", line 25, in <module>
    import inkex, simplestyle, math
  File "/usr/share/inkscape/extensions/inkex.py", line 119, in <module>
    "python-lxml\n\nTechnical details:\n%s" % (e, )))
  File "/usr/share/inkscape/extensions/inkex.py", line 101, in errormsg
    if isinstance(msg, unicode):
NameError: name 'unicode' is not defined

Arch Linux 64-bit, KDE Plasma 5
Inkscape 0.92pre1 15073 (GTK3)

Beluga (buovjaga) wrote :

Eh.. sorry for being silly: I installed lxml. But now it asks for StringIO and there is no package available, so skipping this one.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions