DXF Import Error - TypeError '<' not supported between instances of 'tuple' and 'NoneType' #84936

Closed
opened 2021-01-21 17:00:42 +01:00 by Salim Hbeiliny · 12 comments

System Information
Operating system: Mac OS 10.15.7

Blender Version
Broken: 2.83.1

Addon Information
Name: Import AutoCAD DXF Format (.dxf) (0, 9, 6)
Author: Lukas Treyer, Manfred Moitzi (support + dxfgrabber library), Vladimir Elistratov, Bastien Montagne, Remigiusz Fiedler (AKA migius)

Short description of error
Importing a certain DXF file fails with the error:

TypeError '<' not supported between instances of 'tuple' and 'NoneType'

Exact steps for others to reproduce the error

  1. Start Blender
  2. Enable Addon: Import AutoCAD DXF format
  3. Import attached DXF file
    test_blender_import.dxf

I managed to fix this error in /Applications/Blender.app/Contents/Resources/2.83/scripts/addons/io_import_dxf/dxfimport/groupsort.py
by changing this line 86 (https://developer.blender.org/diffusion/BA/browse/master/io_import_dxf/dxfimport/groupsort.py$86)
from:

if entity.dxftype in {"LINE", "POINT"}

to:

if entity.dxftype in {"LINE", "POINT"} or extrusion == None:
**System Information** Operating system: Mac OS 10.15.7 **Blender Version** Broken: 2.83.1 **Addon Information** Name: Import AutoCAD DXF Format (.dxf) (0, 9, 6) Author: Lukas Treyer, Manfred Moitzi (support + dxfgrabber library), Vladimir Elistratov, Bastien Montagne, Remigiusz Fiedler (AKA migius) **Short description of error** Importing a certain DXF file fails with the error: ``` TypeError '<' not supported between instances of 'tuple' and 'NoneType' ``` **Exact steps for others to reproduce the error** 1. Start Blender 2. Enable Addon: Import AutoCAD DXF format 3. Import attached DXF file [test_blender_import.dxf](https://archive.blender.org/developer/F9591122/test_blender_import.dxf) I managed to fix this error in /Applications/Blender.app/Contents/Resources/2.83/scripts/addons/io_import_dxf/dxfimport/groupsort.py by changing this line 86 (https://developer.blender.org/diffusion/BA/browse/master/io_import_dxf/dxfimport/groupsort.py$86) from: ``` if entity.dxftype in {"LINE", "POINT"} ``` to: ``` if entity.dxftype in {"LINE", "POINT"} or extrusion == None: ```
Author

Added subscriber: @salim-1

Added subscriber: @salim-1

Added subscriber: @mano-wii

Added subscriber: @mano-wii

This is so since the original code (82a00ee2)

The proposed fix seems harmless since the function is used only as a key for sort.
But why should the None extrusion be (0.0, 0.0, 1.0) and not ()?
Is the result of the sort really as expected?

We may have to contact the original authors of the addon :\

This is so since the original code (82a00ee2) The proposed fix seems harmless since the function is used only as a key for sort. But why should the `None` `extrusion` be `(0.0, 0.0, 1.0)` and not `()`? Is the result of the sort really as expected? We may have to contact the original authors of the addon :\
Author

I didn't notice issues with the result, then again, I might miss some minor details. However () would make more sense. It also works for me.

I wasn't sure where else I can report this. Is there a separate repository from the original authors?

I didn't notice issues with the result, then again, I might miss some minor details. However `()` would make more sense. It also works for me. I wasn't sure where else I can report this. Is there a separate repository from the original authors?

Added subscriber: @cnd

Added subscriber: @cnd

The problem is that we cannot apply this correction blindly.
Either the original author needs to take a look or these questions need to be studied and answered:

  • Why should the None extrusion be (0.0, 0.0, 1.0)?
  • Is the result of the sort really as expected?
The problem is that we cannot apply this correction blindly. Either the original author needs to take a look or these questions need to be studied and answered: - Why should the `None` `extrusion` be `(0.0, 0.0, 1.0)`? - Is the result of the sort really as expected?
Author

Indeed, I agree. My suggestion is just to avoid the complete failure during import. I can't confirm that the expected result is 100% correct. However, I didn't notice any obvious issue myself.

Perhaps @cnd, the author of (82a00ee2) can take a look at this issue?

Indeed, I agree. My suggestion is just to avoid the complete failure during import. I can't confirm that the expected result is 100% correct. However, I didn't notice any obvious issue myself. Perhaps @cnd, the author of (82a00ee2) can take a look at this issue?

Since none of the original authors gave their opinion, and the proposed correction appears to be harmless, I will step forward and commit the solution.
I will also add a comment explaining that it is a workaround.
It is better than leaving the import failing.

Since none of the original authors gave their opinion, and the proposed correction appears to be harmless, I will step forward and commit the solution. I will also add a comment explaining that it is a workaround. It is better than leaving the import failing.
Author

Thanks, I think that it's better to go with your suggestion of using (), so the code would become:

        if entity.dxftype in {"LINE", "POINT"}:
            extrusion = (0.0, 0.0, 1.0)
        if extrusion == None:
            extrusion = ()

where the last 2 lines are the addition. I tested it and got the same results.

Thanks, I think that it's better to go with your suggestion of using `()`, so the code would become: ``` if entity.dxftype in {"LINE", "POINT"}: extrusion = (0.0, 0.0, 1.0) if extrusion == None: extrusion = () ``` where the last 2 lines are the addition. I tested it and got the same results.

This issue was referenced by efbcbb2665

This issue was referenced by efbcbb2665b7763463e58d1f36514c48bb43b44e

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Germano Cavalcante self-assigned this 2021-02-01 19:49:58 +01:00
Sign in to join this conversation.
No Milestone
No project
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#84936
No description provided.