DXF import sometimes gets divide by zero

Bug #892496 reported by Satyagraha 1956
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Alvin Penner

Bug Description

Am using 0.48.2 r9819 (WinXP). When importing the attached DXF file, I get the following traceback:

Traceback (most recent call last):

  File "dxf_input.py", line 487, in <module>

    entities[entity]()

  File "dxf_input.py", line 90, in export_SPLINE

    a1 = (vals[groups['40']][i] - vals[groups['40']][i-1])/(vals[groups['40']][i+2] - vals[groups['40']][i-1])

ZeroDivisionError: float division

Tags: dxf importing
Revision history for this message
Satyagraha 1956 (satyagraha-1956) wrote :
su_v (suv-lp)
tags: added: importing
Revision history for this message
su_v (suv-lp) wrote :

Reproduced with Inkscape 0.48.2 and 0.48+devel r10744 on Mac OS X 10.5.8 (i386)

Interestingly not reproduced with the modified DXF input extension from
 Bug #797137 “Landscape and Layer Color options for DXF inport”
 <https://bugs.launchpad.net/inkscape/+bug/797137>

@Alvin - I don't know what change in that provided custom version does handle this exception, nor on which version of 'dxf_input.py' it is based. Maybe you could take a closer look?

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

confirmed on Windows XP, Inkscape rev 10728.

fwiw, this file will not load into Voloview Express 2.01 so it is somehow not compliant with the dxf spec. Could you indicate how it was produced?

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

> Maybe you could take a closer look?

yes, I'll check it out this weekend, probably a problem caused by color

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

> this file will not load into Voloview Express 2.01

File opens without apparent errors in
- QCAD 2.0.5.0 (Community edition)
- QCAD 3 Beta & RC1
- LibreCAD 1.0rc4
- Draftsight V1R13
- SolidWorks eDrawings 11.2.0.113

Revision history for this message
Satyagraha 1956 (satyagraha-1956) wrote :

For information, this file is a public download from the link entitled "* DXF and DWG 2D-vector graphics [zip; 0.71 MB]" at:
http://www.vogelundnoot.com/int/products/dion_vm_chrome.asp#tabbed-3

I have seen this bug when importing DXF from several entirely unrelated product websites. Therefore I suspect there is one particular CAD program which generates these anomalous DXF format files - which one, though, I have no idea.

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

attached is a new version of dxf_input.py, which avoids the crash. This will need to be put into the directory share\extensions\dxf_input.py

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

three separate problems were encountered when loading the file.

1. The crash was caused by a new type of spline which is a subset of the multispline introduced in bzr rev 10183. The new type of spline contains knot points which are triply degenerate which caused the crash.
2. After fixing that, the file loaded without incident. However, a number of circular objects were missing. These were actually splines as well, in which the 'closed' attribute of Group Code 70 had been set, which caused the program to ignore these objects. It was not necessary to ignore these objects so the restriction was removed.
3. After fixing that, there were still a number of objects missing. These were objects of the type POLYLINE which contained VERTEX objects. Both of these types of objects are typical of AutoCad Release 12 files and they have been replaced by the LWPOLYLINE entity in Release 13. The dxf_input.py routine does not support AutoCad Release 12 features. To get around this, the file was loaded into QCad 2.1.3.2 and then re-saved, which automatically converts it to Release 13.
     When loaded into Inkscape, the svg file is attached here. As far as I can tell, it is complete.

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

committed to rev 10749

Changed in inkscape:
status: Confirmed → Fix Committed
su_v (suv-lp)
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
milestone: none → 0.49
tags: added: backport-proposed
Revision history for this message
su_v (suv-lp) wrote :

Backported to branch 0.48.x in revision 9935.

tags: removed: backport-proposed
su_v (suv-lp)
Changed in inkscape:
milestone: 0.49 → 0.48.4
Ted Gould (ted)
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.

Other bug subscribers

Remote bug watches

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