How to slice a modell

Hello Guys,
I would like to slice a modell in thin layers, so that when we make a pile of these layers again, we have the original 3D modell back again. I have attached an image for easier explanation.

I'm actually a bit lost with OpenCascade and don't understand much of what's happening and that's my main problem of why I can't move forward alone most of the time. I have managed to have the view inside a windows form, added the lights and I can load a .step Modell, so I have a resulting TopoDS_Shape. But now on how do I actually cut it, I'm completely lost! Any advice is much appreciated.

I have read a bit about BOPTools_DSFiller, but I'm still pretty much clueless on how do I insert a plane to make the cut on the modell. Or even if this is the correct and recommended way to do it.

Many, many thanks in advance!

Thomas Paviot's picture

Hi Bernardo,

At pythonocc, we already discussed this issue. You can have a look at the example named 'parallel_slicer', contributed by Jelle Feringa, available at:

This program performs the slice of a TopoDS_Shape (with the BRepAlgoAPI_Section class) and uses the multiprocessing module in order to improve performance on multicore machines.

I suggest you also have a look at the emcfab project (, from Dave Cowden). They also use a pythonocc based slicer.

Best Regards,


bcarneiro's picture

Hello Thomas Paviot,

Thank you very much for your reply. I have tried the first solution and it did work. The problem is, the result is really 2D, it's the intersection of a plane and the shape I want to slice. But, what I would like to do is make a thin intersection, so something with a small height, like 2mm. I made then a box instead of a plane and tried to use BRepAlgoAPI_Section to calculate the intersection, but the result I get is always blank, nada. Can this be done with BRepAlgoAPI_Section?

The 2nd solution I still didn't understand it completely and couldn't get it to work properly.

Many thanks in advance!

Best Regards,

EricThompson's picture

Try replacing the BRepAlgoAPI_Section with BRepAlgoAPI_Common, which does a boolean intersection between two shapes.

bcarneiro's picture

Thanks Eric!!! This is exactly what I was looking for, I want to marry you!