Commit 11359c06 authored by lode_leroy's avatar lode_leroy

add x/y direction

git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@23 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent c3685f3e
...@@ -3,7 +3,7 @@ BRLCAD=c:/Software/BRL-CAD/bin ...@@ -3,7 +3,7 @@ BRLCAD=c:/Software/BRL-CAD/bin
MGED=$(BRLCAD)/mged MGED=$(BRLCAD)/mged
G-STL=$(BRLCAD)/g-stl G-STL=$(BRLCAD)/g-stl
VER=0.1.4 VER=0.1.6
all: all:
......
...@@ -307,11 +307,8 @@ class PolygonExtractor: ...@@ -307,11 +307,8 @@ class PolygonExtractor:
self.prev_line = self.curr_line self.prev_line = self.curr_line
def merge_path_lists(self): def merge_path_lists(self):
if self.hor_path_list: self.merge_path_list = []
self.merge_path_list = self.hor_path_list
else:
self.merge_path_list = self.ver_path_list
return
# find matching path to merge with */ # find matching path to merge with */
for s0 in self.hor_path_list: for s0 in self.hor_path_list:
...@@ -363,7 +360,7 @@ class PolygonExtractor: ...@@ -363,7 +360,7 @@ class PolygonExtractor:
if DEBUG_POLYGONEXTRACTOR: print "top1: x=", min_x1, "y=",min_y1, "p=",top1.peek().id if DEBUG_POLYGONEXTRACTOR: print "top1: x=", min_x1, "y=",min_y1, "p=",top1.peek().id
if (min_y1 >= min_y0-dy) and (min_y1 <= min_y0+dy) and (min_x1 >= min_x0-dx) and (min_x1 <= min_x0+dx): if (min_y1 >= min_y0-self.dy) and (min_y1 <= min_y0+self.dy) and (min_x1 >= min_x0-self.dx) and (min_x1 <= min_x0+self.dx):
# we have a potential match # we have a potential match
if DEBUG_POLYGONEXTRACTOR: print "matched %d" % s1.id if DEBUG_POLYGONEXTRACTOR: print "matched %d" % s1.id
if DEBUG_POLYGONEXTRACTOR: print "i0=%d i1=%d" % (top0.peek().id, top1.peek().id) if DEBUG_POLYGONEXTRACTOR: print "i0=%d i1=%d" % (top0.peek().id, top1.peek().id)
......
...@@ -227,7 +227,7 @@ class SimpleGui(Frame): ...@@ -227,7 +227,7 @@ class SimpleGui(Frame):
dy = INFINITE dy = INFINITE
if self.Direction.get() == "x": if self.Direction.get() == "x":
self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dx, dy, 0) self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dx, dy, 0)
else: elif self.Direction.get() == "y":
self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dy, dx, 1) self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dy, dx, 1)
elif self.PathGeneratorName.get() == "PushCutter": elif self.PathGeneratorName.get() == "PushCutter":
...@@ -244,6 +244,10 @@ class SimpleGui(Frame): ...@@ -244,6 +244,10 @@ class SimpleGui(Frame):
else: else:
self.option = None self.option = None
self.pathgenerator = PushCutter(self.cutter, self.model, self.option); self.pathgenerator = PushCutter(self.cutter, self.model, self.option);
if self.PathProcessorName.get() == "ContourCutter" and samples>1:
dx = (maxx-minx)/(samples-1)
else:
dx = INFINITE
if lines>1: if lines>1:
dy = (maxy-miny)/(lines-1) dy = (maxy-miny)/(lines-1)
else: else:
...@@ -254,8 +258,10 @@ class SimpleGui(Frame): ...@@ -254,8 +258,10 @@ class SimpleGui(Frame):
dz = INFINITE dz = INFINITE
if self.Direction.get() == "x": if self.Direction.get() == "x":
self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, 0, dy, dz) self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, 0, dy, dz)
else: elif self.Direction.get() == "y":
self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dy, 0, dz) self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dy, 0, dz)
elif self.Direction.get() == "xy":
self.toolpath = self.pathgenerator.GenerateToolPath(minx, maxx, miny, maxy, minz, maxz, dx, dy, dz)
self.ogl.tkRedraw() self.ogl.tkRedraw()
def browseSaveAs(self): def browseSaveAs(self):
...@@ -335,6 +341,7 @@ class SimpleGui(Frame): ...@@ -335,6 +341,7 @@ class SimpleGui(Frame):
self.Direction.set("x") self.Direction.set("x")
Radiobutton(self.ConfigurationFrame, text="x", variable=self.Direction, value="x", command=self.ogl.tkRedraw).pack(side=LEFT) Radiobutton(self.ConfigurationFrame, text="x", variable=self.Direction, value="x", command=self.ogl.tkRedraw).pack(side=LEFT)
Radiobutton(self.ConfigurationFrame, text="y", variable=self.Direction, value="y", command=self.ogl.tkRedraw).pack(side=LEFT) Radiobutton(self.ConfigurationFrame, text="y", variable=self.Direction, value="y", command=self.ogl.tkRedraw).pack(side=LEFT)
Radiobutton(self.ConfigurationFrame, text="xy", variable=self.Direction, value="xy", command=self.ogl.tkRedraw).pack(side=LEFT)
self.MinX = StringVar() self.MinX = StringVar()
self.MinX.set("-7") self.MinX.set("-7")
......
...@@ -29,14 +29,14 @@ class ContourCutter: ...@@ -29,14 +29,14 @@ class ContourCutter:
def finish(self): def finish(self):
self.pe.finish() self.pe.finish()
if True: if self.pe.merge_path_list:
self.paths = self.pe.merge_path_list
else:
if self.pe.hor_path_list: if self.pe.hor_path_list:
self.paths = self.pe.hor_path_list self.paths = self.pe.hor_path_list
else: else:
self.paths = self.pe.ver_path_list self.paths = self.pe.ver_path_list
for p in self.paths: for p in self.paths:
p.append(p.points[0]) p.append(p.points[0])
else:
if self.pe.merge_path_list:
self.paths = self.pe.merge_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