mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
2.99k stars 577 forks source link

intersection = self.active_mesh.intersection(bm) #1279

Open richardrl opened 3 years ago

richardrl commented 3 years ago

Intersection returns a Trimesh Scene when there is actually an intersection. This does not seem correct according to the API. Plus, I can't access the vertices in the intersection like I want.

spichardo commented 3 years ago

I see the same behavior... but it seems random on my end, so I ended with a temporary dirty solution such as

try:
      while(True):
          sectionMesh=skull_mesh.intersection(box)
          print(sectionMesh.volume)
          break
except AttributeError as err:
      if "'Scene' object has no attribute 'volume'" in str(err):
          p.print("Repeating CSG boolean since once in while it returns an scene instead of a mesh....")
      else:
          raise err

this eventually ends working on the second time it re-tries the intersection...