chiark / gitweb /
Change how the matrixes are applied on SVG objects. Fix a minor bug when the renderin...
[cura.git] / Cura / util / drawingLoader / dxf.py
index 3915572b3c1483031227da42bcfadcf2ed19c9dc..5f9fe0b7a59505f864b075dc935d9e5ec5f965af 100644 (file)
@@ -9,9 +9,9 @@ from xml.etree import ElementTree
 
 from Cura.util.drawingLoader import drawing
 
-class DXF(object):
+class DXF(drawing.Drawing):
        def __init__(self, filename):
-               self.paths = []
+               super(DXF, self).__init__()
                self._lastLine = None
                self._polyLine = None
 
@@ -39,26 +39,22 @@ class DXF(object):
                        self._checkForNewPath(entityType, activeObject)
                f.close()
 
-               for path in self.paths:
-                       if not path.isClosed():
-                               path.checkClosed()
+               self._postProcessPaths()
 
        def _checkForNewPath(self, type, obj):
                if type == 'LINE':
                        if self._lastLine is not None and self._lastLinePoint == complex(float(obj[10]), float(obj[20])):
                                self._lastLine.addLineTo(float(obj[11]), float(obj[21]))
                        else:
-                               p = drawing.Path(float(obj[10]), float(obj[20]))
+                               p = self.addPath(float(obj[10]), float(obj[20]))
                                p.addLineTo(float(obj[11]), float(obj[21]))
-                               self.paths.append(p)
                                self._lastLine = p
                        self._lastLinePoint = complex(float(obj[11]), float(obj[21]))
                elif type == 'POLYLINE':
                        self._polyLine = None
                elif type == 'VERTEX':
                        if self._polyLine is None:
-                               self._polyLine = drawing.Path(float(obj[10]), float(obj[20]))
-                               self.paths.append(self._polyLine)
+                               self._polyLine = self.addPath(float(obj[10]), float(obj[20]))
                        else:
                                self._polyLine.addLineTo(float(obj[10]), float(obj[20]))
                else:
@@ -69,5 +65,5 @@ if __name__ == '__main__':
                print 'File: %s' % (sys.argv[n])
                dxf = DXF(sys.argv[n])
 
-       drawing.saveAsHtml(dxf, "test_export.html")
+       dxf.saveAsHtml("test_export.html")