Menu

#97 crash when loading a heavy DXF file

Fixed
nobody
None
High
Patch
2019-10-12
2018-03-13
No

When loading this file, I get this error in the terminal. Sorry, I don't have time to look further into the code to see where things went sideways ...

$ dxf2gcode temple_noir_aplats_negatif.dxf
Creating configuration window
Creating configuration window
Chargement fichier: temple_noir_aplats_negatif.dxf
Lecture structure DXF
Reading Block *MODEL_SPACE; Nr: 0
Reading Block *PAPER_SPACE; Nr: 1
Traceback (most recent call last):
  File "/usr/bin/dxf2gcode", line 1198, in <module>
    window.load()
  File "/usr/bin/dxf2gcode", line 844, in load
    self.valuesDXF = ReadDXF(self.filename)
  File "/usr/lib/python3.6/site-packages/dxfimport/importer.py", line 85, in __init__
    self.entities = self.Read_Entities(sections_pos)
  File "/usr/lib/python3.6/site-packages/dxfimport/importer.py", line 345, in Read_Entities
    sections[section_nr - 1].end - 1)
  File "/usr/lib/python3.6/site-packages/dxfimport/importer.py", line 360, in Get_Geo
    entitie_geo = self.get_geo_entitie(len(geos), name)
  File "/usr/lib/python3.6/site-packages/dxfimport/importer.py", line 419, in get_geo_entitie
    geo = GeoentLwPolyline(geo_nr, self)
  File "/usr/lib/python3.6/site-packages/dxfimport/geoent_lwpolyline.py", line 47, in __init__
    self.Read(caller)
  File "/usr/lib/python3.6/site-packages/dxfimport/geoent_lwpolyline.py", line 196, in Read
    self.geo.append(LineGeo(Ps=Ps, Pe=self.geo[0].Ps))
IndexError: list index out of range
2 Attachments

Discussion

  • Thomas Girod

    Thomas Girod - 2018-03-13

    I forgot to mention I got the error from version 20170925 and from latest git commit

     
  • chrisko

    chrisko - 2018-03-16

    Hi Thomas,
    did just check the error and found some failure in the script but this was not the real root cause. Your heavy dxf is including Polylines which include no elements (no line or point or whatever). Can you check that maybe, since i thought this can not happen.
    I guess you are using linus, right? I may attach the file including some additional case which will check for that after Sebastian checked in his new version.
    Stay tuned ....
    regards
    Christian

     
  • chrisko

    chrisko - 2018-03-16

    I succeeded in loading it with this fix, but the dxf is not well created i think, Many colinear / overlapping / doubles lines i guess. How did you create it? Maybe you reconsider the way to generate better dxf.
    regards
    Christian

     
  • chrisko

    chrisko - 2018-03-16
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,2 @@
    +2018-03-16 20_15_25-DXF2GCODE - [D__GIT_DXF2GCODE_sourcecode_dxf_temple_noir_aplats_negatif.dxf].png (41.4 kB; image/png)
     temple_noir_aplats_negatif.dxf (2.2 MB; image/vnd.dxf)
    
     
  • Thomas Girod

    Thomas Girod - 2018-03-16

    Thanks a lot for looking into this!

    This file was originally a SVG, converted to DXF with inkscape. I didn't design the original file, so I don't if the original SVG is also broken.

    You are right about double lines - I started writing a tool to convert dxf to gcode, and I found this file to be very ugly too.

     
  • chrisko

    chrisko - 2018-03-16

    This is what i expected some automatically generated file :-) ....
    However, i just commited the change into the following branch: https://sourceforge.net/p/dxf2gcode/sourcecode/ci/2bab0a200cd1643c54b6fdf5b54c3e84aee59946/

    Please check if you are happy with it.

    Just since i am curious about it, do you still continue to write your tool and what is the reason not to use dxf2gcode? I know this is a lof of work to write such a tool :-) ...

     
  • Thomas Girod

    Thomas Girod - 2018-03-16

    The file loaded, that's cool ! But I see some paths are broken because of the duplicate lines. When converting this file with my program I faced the same problem: I had to remove duplicates and reverse-duplicates before joining elements into paths, or I would get tiny closed paths that looks like lines ...

    I haven't been working on my program lately because I have more pressing things to do, but it's there. https://github.com/tgirod/gocam. To answer your questions, I didn't know dxf2gcode existed - I guess I misgoogled it. I started the project because I was frustrated with a few things in bCNC: no support for splines, slow on heavy files, no support for islands in the pocket algorithm.

    What I wrote is still crude, but even with a lot of brute force the performances are decent compared to python equivalents.

     
  • Damian Wrobel

    Damian Wrobel - 2019-10-12
    • status: New --> Fixed
     

Log in to post a comment.