From efbcbb2665b7763463e58d1f36514c48bb43b44e Mon Sep 17 00:00:00 2001
From: Germano Cavalcante <germano.costa@ig.com.br>
Date: Mon, 1 Feb 2021 15:25:40 -0300
Subject: [PATCH] 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.
---
 io_import_dxf/dxfimport/groupsort.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/io_import_dxf/dxfimport/groupsort.py b/io_import_dxf/dxfimport/groupsort.py
index 998b69b41..9a49acc79 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)
-- 
GitLab