Commit d25605d6 authored by lode_leroy's avatar lode_leroy

close contours

git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@55 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 8f1d8ccb
VER=0.1.9
VER=0.1.10
all:
......
......@@ -4,7 +4,7 @@ class SVGExporter:
self.file = file(filename,"w")
self.file.write("""<?xml version='1.0'?>
<svg xmlns='http://www.w3.org/2000/svg' width='640' height='800'>
<g transform='translate(320,320) scale(60)' stroke-width='0.01' font-size='0.2'>
<g transform='translate(320,320) scale(50)' stroke-width='0.01' font-size='0.2'>
""")
self._fill = 'none'
self._stroke = 'black'
......
......@@ -118,6 +118,8 @@ class PolygonExtractor:
self.svg = SVGExporter("test-3.svg")
for path in path_list:
prev = None
if len(path.points)<=1:
continue
for p in path.points:
if p.dir == 0:
self.svg.fill("red")
......@@ -128,6 +130,9 @@ class PolygonExtractor:
if prev:
self.svg.AddLine(p.x, p.y, prev.x, prev.y)
prev = p
p = path.points[0]
self.svg.AddLine(p.x, p.y, prev.x, prev.y)
self.svg.close()
self.cont.close()
......
......@@ -34,6 +34,8 @@ class ContourCutter:
self.pe.finish()
if self.pe.merge_path_list:
self.paths = self.pe.merge_path_list
for p in self.paths:
p.append(p.points[0])
else:
if self.pe.hor_path_list:
self.paths = self.pe.hor_path_list
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment