diff options
author | Lukas Treyer <treyer@arch.ethz.ch> | 2014-10-21 18:37:45 +0400 |
---|---|---|
committer | Lukas Treyer <treyer@arch.ethz.ch> | 2014-10-21 18:39:05 +0400 |
commit | 68e4b7e6bf9ddd643bd8ac9b48b8b9aeaeae4b03 (patch) | |
tree | 8bd3867f7884cde92fabeca14d55654829816eb2 /io_import_dxf/__init__.py | |
parent | 2750b4e7a1d888314793d1ab713554e6a84ab233 (diff) |
Proper error message for DXF versions below AC1009. Users get notified that DXF files with version below AC1009 (DXF12) are not supported. This is because there is not enough documentation available for those versions. Users with files that old are kindly requested to export their projects to newer versions. In some cases it might also work to just replace AC1006 (or anything below AC1009) with AC1009 directly in the DXF.
Diffstat (limited to 'io_import_dxf/__init__.py')
-rw-r--r-- | io_import_dxf/__init__.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/io_import_dxf/__init__.py b/io_import_dxf/__init__.py index e3cfa99b..fae5b173 100644 --- a/io_import_dxf/__init__.py +++ b/io_import_dxf/__init__.py @@ -22,6 +22,7 @@ import bpy import os from bpy.props import StringProperty, BoolProperty, EnumProperty, IntProperty, FloatProperty from .dxfimport.do import Do, Indicator +from .dxfgrabber.headersection import MinVersionError from .transverse_mercator import TransverseMercator @@ -109,17 +110,20 @@ def read(report, filename, obj_merge=BY_LAYER, import_text=True, import_light=Tr thicknessWidth=True, but_group_by_att=True, dxf_unit_scale=1.0): # import dxf and export nurbs types to sat/sab files # because that's how autocad stores nurbs types in a dxf... - do = Do(filename, obj_merge, import_text, import_light, export_acis, merge_lines, do_bbox, block_rep, recenter, - projDXF, projSCN, thicknessWidth, but_group_by_att, dxf_unit_scale) - errors = do.entities(os.path.basename(filename).replace(".dxf", ""), new_scene) - - # display errors - for error in errors: - report('ERROR', error) - - # inform the user about the sat/sab files - if len(do.acis_files) > 0: - report('INFO', "Exported %d NURBS objects to sat/sab files next to your DXF file" % len(do.acis_files)) + try: + do = Do(filename, obj_merge, import_text, import_light, export_acis, merge_lines, do_bbox, block_rep, recenter, + projDXF, projSCN, thicknessWidth, but_group_by_att, dxf_unit_scale) + errors = do.entities(os.path.basename(filename).replace(".dxf", ""), new_scene) + + # display errors + for error in errors: + report({'ERROR', 'INFO'}, error) + + # inform the user about the sat/sab files + if len(do.acis_files) > 0: + report({'INFO'}, "Exported %d NURBS objects to sat/sab files next to your DXF file" % len(do.acis_files)) + except MinVersionError as minv: + report({'ERROR', 'INFO'}, str(minv)) def display_groups_in_outliner(): |