Commit d0d6acb0 authored by sumpfralle's avatar sumpfralle

reset the kdtree of trimesh models during "reset_cache"

 * otherwise it was not possible to generate toolpaths after transforming the model


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@471 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 83074a59
...@@ -23,6 +23,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>. ...@@ -23,6 +23,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
import pycam.Exporters.STLExporter import pycam.Exporters.STLExporter
from pycam.Geometry import Triangle, Line, Point from pycam.Geometry import Triangle, Line, Point
from pycam.Geometry.TriangleKdtree import TriangleKdtree
from pycam.Toolpath import Bounds from pycam.Toolpath import Bounds
from utils import INFINITE from utils import INFINITE
...@@ -189,6 +190,12 @@ class Model(BaseModel): ...@@ -189,6 +190,12 @@ class Model(BaseModel):
if isinstance(item, Triangle): if isinstance(item, Triangle):
self._triangles.append(item) self._triangles.append(item)
def reset_cache(self):
super(Model, self).reset_cache()
# the triangle kdtree needs to be reset after transforming the model
if hasattr(self, "t_kdtree"):
self.t_kdtree = TriangleKdtree(self.triangles())
def triangles(self, minx=-INFINITE,miny=-INFINITE,minz=-INFINITE,maxx=+INFINITE,maxy=+INFINITE,maxz=+INFINITE): def triangles(self, minx=-INFINITE,miny=-INFINITE,minz=-INFINITE,maxx=+INFINITE,maxy=+INFINITE,maxz=+INFINITE):
if minx==-INFINITE and miny==-INFINITE and minz==-INFINITE and maxx==+INFINITE and maxy==+INFINITE and maxz==+INFINITE: if minx==-INFINITE and miny==-INFINITE and minz==-INFINITE and maxx==+INFINITE and maxy==+INFINITE and maxz==+INFINITE:
return self._triangles return self._triangles
......
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