Code

add group code 70 to LWPOLYLINE
[inkscape.git] / share / extensions / dxf_input.py
index 235c777b0748e5a90282c9475721fa22d3495d22..ffb1194c8a542dc613ee2f36e98681b5d0b539a1 100644 (file)
@@ -65,10 +65,14 @@ def export_LINE():
 def export_SPLINE():\r
     # mandatory group codes : (10, 20, 70) (x, y, flags)\r
     if vals[groups['10']] and vals[groups['20']] and vals[groups['70']]:\r
-        if vals[groups['70']][0] == 8 and len(vals[groups['10']]) == 4 and len(vals[groups['20']]) == 4:\r
+        if not (vals[groups['70']][0] & 3) and len(vals[groups['10']]) == 4 and len(vals[groups['20']]) == 4:\r
             path = 'M %f,%f C %f,%f %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['10']][1], vals[groups['20']][1], vals[groups['10']][2], vals[groups['20']][2], vals[groups['10']][3], vals[groups['20']][3])\r
             attribs = {'d': path, 'style': style}\r
             inkex.etree.SubElement(doc.getroot(), 'path', attribs)\r
+        if not (vals[groups['70']][0] & 3) and len(vals[groups['10']]) == 3 and len(vals[groups['20']]) == 3:\r
+            path = 'M %f,%f Q %f,%f %f,%f' % (vals[groups['10']][0], vals[groups['20']][0], vals[groups['10']][1], vals[groups['20']][1], vals[groups['10']][2], vals[groups['20']][2])\r
+            attribs = {'d': path, 'style': style}\r
+            inkex.etree.SubElement(doc.getroot(), 'path', attribs)\r
 \r
 def export_CIRCLE():\r
     # mandatory group codes : (10, 20, 40) (x, y, radius)\r
@@ -210,6 +214,7 @@ while line[0] and line[1] != 'ENDSEC':
         seqs.append(line[0])                        # list of group codes\r
         if line[0] == '1' or line[0] == '8':        # text value\r
             val = line[1].replace('\~', ' ')\r
+            val = unicode(val, "iso-8859-1")\r
         elif line[0] == '62' or line[0] == '70':    # unscaled integer value\r
             val = int(line[1])\r
         elif line[0] == '10':                       # scaled float x value\r
@@ -234,6 +239,8 @@ while line[0] and line[1] != 'ENDSEC':
             if vals[groups['370']]:                 # Common Lineweight\r
                 if vals[groups['370']][0] > 0:\r
                     w = scale*vals[groups['370']][0]/100.0\r
+                    if w < 0.5:\r
+                        w = 0.5\r
                     style = simplestyle.formatStyle({'stroke': '%s' % color, 'fill': 'none', 'stroke-width': '%.1f' % w})\r
             entities[entity]()\r
         entity = line[1]\r