Code

fix LP bug 293940, comment 73
authoralvinpenner <alvinpenner@users.sourceforge.net>
Thu, 7 May 2009 00:26:14 +0000 (00:26 +0000)
committeralvinpenner <alvinpenner@users.sourceforge.net>
Thu, 7 May 2009 00:26:14 +0000 (00:26 +0000)
share/extensions/dxf_input.py

index 8305ae14932b755602194746b9aa8ce22479f7cd..e4cfc3b554930f75266ed0f20a9f0f6da616d178 100644 (file)
@@ -310,11 +310,12 @@ DIMTXT = {}                                         # store DIMENSION text sizes
 
 while line[0] and line[1] != 'BLOCKS':
     line = get_line()
-    if line[1] == '$EXTMIN':
-        xmin = get_group('10')
-    if line[1] == '$EXTMAX':
-        xmax = get_group('10')
-        ymax = get_group('20')
+    if options.auto:
+        if line[1] == '$EXTMIN':
+            xmin = get_group('10')
+        if line[1] == '$EXTMAX':
+            xmax = get_group('10')
+            ymax = get_group('20')
     if flag == 1 and line[0] == '2':
         layername = unicode(line[1], "iso-8859-1")
         attribs = {inkex.addNS('groupmode','inkscape'): 'layer', inkex.addNS('label','inkscape'): '%s' % layername}
@@ -348,6 +349,11 @@ else:
 desc.text = '%s - scale = %f' % (unicode(args[0], "iso-8859-1"), scale)
 scale *= 90.0/25.4                                  # convert from mm to pixels
 
+if not layer_nodes:
+    attribs = {inkex.addNS('groupmode','inkscape'): 'layer', inkex.addNS('label','inkscape'): '0'}
+    layer_nodes['0'] = inkex.etree.SubElement(doc.getroot(), 'g', attribs)
+    layer_colors['0'] = 7
+
 for linename in linetypes.keys():                   # scale the dashed lines
     linetype = ''
     for length in linetypes[linename]: