SlicerCSG issue with multiple meshes and angle of extrusion

Hello,

I have an issue with CSG when I try to slice multiple extruded meshes build with an extrusion path generated with an angle.
When I try to use CSG intersect with some meshes and an extruded polygon, I facing “Maximum call stack size exceeded”.

During research to find why this happen, it seems that angle of extruded shapes influence crash of CSG because when I try reduce angle sometimes it work and without angle it always working.

Cases :
I’ve build a playground with some cases to reproduce that bug :
→ meshes with extrusion angle of PI/6 or PI/4
→ slice merged meshes or one by one

  • PI/4 + merged : crash
  • PI/4 + one by one : crash
  • PI/6 + merged : working
  • PI/6 + one by one : crash

Playground :
https://playground.babylonjs.com/#KVIDRU#1

I didn’t found that bug in doc or here so hope someone can help ?

Thank you

Welcome aboard!

CSG is very sensitive to the geometry you provide. It seems that the CAP feature of the extrudeShape function does not work well with CSG. If you remove it, it works:

There is not much we can do about it, it is the way extrudeMesh generates the faces that makes CSG fail. When that happens, try to generate your objects with other means than extrudeShape.

1 Like

Thank you @Evgeni_Popov for you fast reply, I’ve replace “cap” with “_cap” and it work well in every situation I need.

In fact, you can even remove it completely from the options. I renamed it to “_cap” because it was easier than removing the line :slight_smile :

Okay :sweat_smile: I thought it was an hidden property manage differently with CSG.
I’ve check my use cases and it won’t be a problem, the cap issue can be easily fix with alternative approach in my project.

Thanks again