Commit 0595a56a authored by sumpfralle's avatar sumpfralle

r660@erker: lars | 2010-02-14 21:35:34 +0100

 revert experimental ODE patch for DropCutter


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@125 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 5ab6767b
......@@ -5,11 +5,10 @@ from pycam.Geometry.intersection import intersect_lines
class DropCutter:
def __init__(self, cutter, model, PathProcessor=None, physics=None):
def __init__(self, cutter, model, PathProcessor=None):
self.cutter = cutter
self.model = model
self.processor = PathProcessor
self.physics = physics
def GenerateToolPath(self, minx, maxx, miny, maxy, z0, z1, dx, dy, direction):
if self.processor:
......@@ -31,21 +30,42 @@ class DropCutter:
cl_max = None
t_max = None
self.cutter.moveto(p)
triangles = self.model.triangles(p.x-self.cutter.radius,p.y-self.cutter.radius,z0,p.x+self.cutter.radius,p.y+self.cutter.radius,+INFINITE)
for t in triangles:
if t.normal().z < 0: continue;
cl = self.cutter.drop(t)
if cl and (cl.z > z_max or cl_max is None):
z_max = cl.z
cl_max = cl
t_max = t
if not cl_max or cl_max.z<z0:
cl_max = Point(x,y,z0)
z = z1
dz = (z1-z0)/100
collision = False
while (z >= z0) and not collision:
self.physics.set_drill_position((x, y, z))
if self.physics.check_collision():
z_max = z + dz
collision = True
z -= dz
if collision:
pa.append(Point(x, y, z_max))
if cl_last and ((t_max and not t_last) or (t_last and not t_max)):
if cl_last.z < z_max:
pa.append(Point(cl_last.x,cl_last.y,cl_max.z))
else:
pa.append(Point(x, y, z0))
pa.append(Point(cl_max.x,cl_max.y,cl_last.z))
elif (t_max and t_last and cl_last and cl_max ) and (t_max != t_last):
nxl = -t_last.normal().x
nzl = t_last.normal().z
nxm = -t_max.normal().x
nzm = t_max.normal().z
xl = cl_last.x
zl = cl_last.z
xm = cl_max.x
zm = cl_max.z
(X,Z) = intersect_lines(xl, zl, nxl, nzl, xm, zm, nxm, nzm)
if X and xl < X and X < xm and (Z > zl or Z > zm):
Y = cl_last.y
if Z<z0-10 or Z>z1+10:
print "^", "xl=",xl,", zl=",zl,"nxl=",nxl,", nzl=",nzl,", X=", X, ", Z=",Z,", xm=",xm,",zm=",zm, ", nxm=",nxm,",nzm=",nzm
else:
pa.append(Point(X,Y,Z))
pa.append(cl_max)
cl_last = cl_max
t_last = t_max
x += dx
pa.end_scanline()
......
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