Commit e30b290d authored by sumpfralle's avatar sumpfralle

r703@erker: lars | 2010-02-21 23:32:09 +0100

 fixed a small nasty bug, that occours in the DropCutter for small values of "material allowance"
 
 Description: ODE did not take the "extended" drill shapes into account, when deciding, if
 collisions are possible. Thus the collide callback was never called.


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@155 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent bbe7d336
......@@ -51,13 +51,13 @@ class CylindricalCutter(BaseCutter):
def extend_shape(diff_x, diff_y, diff_z):
# diff_z is assumed to be zero
reset_shape()
geom_end_transform = ode.GeomTransform(None)
geom_end_transform = ode.GeomTransform(geom.space)
geom_end_transform.setBody(geom.getBody())
geom_end = ode.GeomCylinder(None, radius, height)
geom_end.setPosition((diff_x, diff_y, center_height))
geom_end_transform.setGeom(geom_end)
# create the block that connects to two cylinders at the end
geom_connect_transform = ode.GeomTransform(None)
geom_connect_transform = ode.GeomTransform(geom.space)
geom_connect_transform.setBody(geom.getBody())
hypotenuse = sqrt(diff_x * diff_x + diff_y * diff_y)
cosinus = diff_x/hypotenuse
......
......@@ -42,13 +42,13 @@ class SphericalCutter(BaseCutter):
def extend_shape(diff_x, diff_y, diff_z):
# diff_z is assumed to be zero
reset_shape()
geom_end_transform = ode.GeomTransform(geom.getSpace())
geom_end_transform = ode.GeomTransform(geom.space)
geom_end_transform.setBody(geom.getBody())
geom_end = ode.GeomCapsule(None, radius, self.height)
geom_end.setPosition((diff_x, diff_y, center_height))
geom_end_transform.setGeom(geom_end)
# create the block that connects the two cylinders at the end
geom_connect_transform = ode.GeomTransform(geom.getSpace())
geom_connect_transform = ode.GeomTransform(geom.space)
geom_connect_transform.setBody(geom.getBody())
hypotenuse = sqrt(diff_x * diff_x + diff_y * diff_y)
cosinus = diff_x/hypotenuse
......@@ -60,7 +60,7 @@ class SphericalCutter(BaseCutter):
geom_connect.setPosition((diff_x/2.0, diff_y/2.0, center_height))
geom_connect_transform.setGeom(geom_connect)
# create a cylinder, that connects the two half spheres at the lower end of both drills
geom_cyl_transform = ode.GeomTransform(geom.getSpace())
geom_cyl_transform = ode.GeomTransform(geom.space)
geom_cyl_transform.setBody(geom.getBody())
geom_cyl = ode.GeomCylinder(None, radius, hypotenuse)
# switch x and z axis of the cylinder and then rotate it according to diff_x/diff_y
......
......@@ -67,6 +67,9 @@ class PhysicalWorld:
#geom.setGeom(shape)
#shape.setOffset(position)
self._space.add(shape)
# sadly PyODE forgets to update the "space" attribute that we need in
# the cutters' "extend" functions
shape.space = self._space
self._add_geom(shape, position, append=False)
self._drill_offset = position
self._drill = shape
......
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