Code

add support for quadratic Bezier
authoralvinpenner <alvinpenner@users.sourceforge.net>
Tue, 23 Dec 2008 02:27:45 +0000 (02:27 +0000)
committeralvinpenner <alvinpenner@users.sourceforge.net>
Tue, 23 Dec 2008 02:27:45 +0000 (02:27 +0000)
share/extensions/dxf_input.py

index 6c759ba8f4416820bfc01d7bbc2b8b5e876de3a2..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