diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-02-01 21:25:40 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-02-01 21:25:40 +0300 |
commit | efbcbb2665b7763463e58d1f36514c48bb43b44e (patch) | |
tree | 242de3a8205313d9bd4cea4cfcacf965353ba852 /io_import_dxf | |
parent | 7bc0fa6bf2d8fb564759a4b2c776eda098f61bd9 (diff) |
Fix T84936: DXF Import Error
Importing splines from a dxf file can cause an error in the sorting
process:
```
TypeError '<' not supported between instances of 'tuple' and 'NoneType'
```
Since instances of type "SPLINE" do not have an extrusion direction,
replace the extrusion values with an empty tuple.
Diffstat (limited to 'io_import_dxf')
-rw-r--r-- | io_import_dxf/dxfimport/groupsort.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/io_import_dxf/dxfimport/groupsort.py b/io_import_dxf/dxfimport/groupsort.py index 998b69b4..9a49acc7 100644 --- a/io_import_dxf/dxfimport/groupsort.py +++ b/io_import_dxf/dxfimport/groupsort.py @@ -85,6 +85,10 @@ def by_attributes(entities): subd = entity.subdivision_levels if entity.dxftype in {"LINE", "POINT"}: extrusion = (0.0, 0.0, 1.0) + if extrusion is None: + # This can happen for entities of type "SPLINE" for example. + # But the sort comparison does not work between 'tuple' and 'NoneType'. + extrusion = () return entity.thickness, subd, width, extrusion return itertools.groupby(sorted(entities, key=attributes), key=attributes) |