[Bf-extensions-cvs] [efbcbb26] master: Fix T84936: DXF Import Error
Germano Cavalcante
noreply at git.blender.org
Mon Feb 1 19:49:36 CET 2021
Commit: efbcbb2665b7763463e58d1f36514c48bb43b44e
Author: Germano Cavalcante
Date: Mon Feb 1 15:25:40 2021 -0300
Branches: master
https://developer.blender.org/rBAefbcbb2665b7763463e58d1f36514c48bb43b44e
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.
===================================================================
M io_import_dxf/dxfimport/groupsort.py
===================================================================
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)
More information about the Bf-extensions-cvs
mailing list