Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Treyer <treyer@arch.ethz.ch>2014-08-19 18:06:16 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-08-19 18:11:49 +0400
commit82a00ee2a0d8f2001917ddc4e34de4104200eca3 (patch)
tree7596caf1feaccda00c3db65d689687a4bc60192b /io_import_dxf/dxfgrabber/headersection.py
parentff4c009b1849d6b7980d589536870ab406c54abd (diff)
New DXF importer, based in DXFGrabber.
This addon replaces the old DXF importer. Written by cnd (Lukas Treyer). It uses dxfgrabber - copyright (C) 2012 by Manfred Moitzi (mozman) (MIT license). Review and some cleanup by mont29 (Bastien Montagne).
Diffstat (limited to 'io_import_dxf/dxfgrabber/headersection.py')
-rwxr-xr-xio_import_dxf/dxfgrabber/headersection.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/io_import_dxf/dxfgrabber/headersection.py b/io_import_dxf/dxfgrabber/headersection.py
new file mode 100755
index 00000000..a12cee95
--- /dev/null
+++ b/io_import_dxf/dxfgrabber/headersection.py
@@ -0,0 +1,33 @@
+# Purpose: handle header section
+# Created: 21.07.2012, taken from my ezdxf project
+# Copyright (C) 2012, Manfred Moitzi
+# License: MIT License
+from __future__ import unicode_literals
+__author__ = "mozman <mozman@gmx.at>"
+
+from .tags import TagGroups, DXFTag
+
+class HeaderSection(dict):
+ name = "header"
+
+ def __init__(self):
+ super(HeaderSection, self).__init__()
+ self._create_default_vars()
+
+ @staticmethod
+ def from_tags(tags):
+ header = HeaderSection()
+ if tags[1] == DXFTag(2, 'HEADER'): # DXF12 without a HEADER section is valid!
+ header._build(tags)
+ return header
+
+ def _create_default_vars(self):
+ self['$ACADVER'] = 'AC1009'
+ self['$DWGCODEPAGE'] = 'ANSI_1252'
+
+ def _build(self, tags):
+ if len(tags) == 3: # empty header section!
+ return
+ groups = TagGroups(tags[2:-1], split_code=9)
+ for group in groups:
+ self[group[0].value] = group[1].value