Page MenuHome

DXF import for a file exported from QGIS fails with IndexError: list index out of range
Closed, ResolvedPublic

Description

Blender Version
Broken: 2.79 release 5bd8ac9

Importing a DXF file exported from QGIS fails with following exception.
Same DXF opens in Autodesk DWG TrueView 2018. It is a pretty simple map with a few areas.

Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_import_dxf\__init__.py", line 540, in execute
    proj_dxf, proj_scn, self.represent_thickness_and_width, self.import_atts, dxf_unit_scale)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_import_dxf\__init__.py", line 119, in read
    errors = do.entities(os.path.basename(filename).replace(".dxf", ""), new_scene)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_import_dxf\dxfimport\do.py", line 1614, in entities
    self.combined_objects((en for en in self.dwg.modelspace() if is_.combined_entity(en)), scene)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_import_dxf\dxfimport\do.py", line 1518, in combined_objects
    o = self._call_object_types(TYPE, by_att, group, name, scene, False)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_import_dxf\dxfimport\do.py", line 1367, in _call_object_types
    o = type_func(entity, scene, name)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_import_dxf\dxfimport\do.py", line 1288, in object_curve
    self._thickness_and_width(o, en, scene)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_import_dxf\dxfimport\do.py", line 1138, in _thickness_and_width
    w = entity.width[0][0] if hasattr(entity, "width") else 0
IndexError: list index out of range

Exact steps for others to reproduce the error

Enable DXF import.

Import the attached file.

Details

Type
Bug

Event Timeline

Sergey Sharybin (sergey) triaged this task as Normal priority.Oct 19 2017, 2:21 PM

@Lukas Treyer (cnd), is that something up to you? @Bastien Montagne (mont29), you als oseems to be mentioned as a maintainer :)

Lukas Treyer (cnd) closed this task as Resolved.Oct 23 2017, 11:09 AM

added an if statement to make sure the width property of dxf entities can be accessed as a 2dim array.
[can't remember how to link commits... ]
https://git.blender.org/gitweb/gitweb.cgi/blender-addons.git/commit/5f8aaa2d4e93831e329d2203ea9cd42fa32dd2df

Also, you can use "center geometry to scene" option and leave away "merge objects" option in your case.