What is the best way to Slice a solid?

Hello, everyone:

I am working with RepRap, an open source, rapid prototyping project.

For this project, we need to "slice" a solid ( typically imported via STEP or STL ), into layers and create toolpaths that will fill each layer.

I've been working on using OCC to perform the slicing operation, and I could use some assistance.

So far, I have successfully imported the geometry into a shape, and then created a cutting plane to make a section. It will be no problem to iterate through the layers and create the sections.

I have read through these forums, and I've found quite a few different approaches that are possible. I could use some advice on which would work best.

(1) use BRepAlgoAPI_Section or BRepAlgo_Section. It seems many say that BRepAlgoAPI_Section is buggy. I was successful using this approach, but it had the problem that the resulting compound and its associated edges are not represented as a wire, so I have "lost" the information about how to traverse the edges in loops. I am not sure if BRrep_MakeWire will construct the edges in the right sense to represent inner and outer loops

(2) BRepTool_Cut has been mentioned by some-- it would create a single shap if I cut with a halfspace, or two shapes(?) if I cut with a shape made from a plane. It would be more expensive, i suppose, but would retain the cut surface as a face that would have wires already constructed

Does anyone have some advice on which approach I should take?

Your suggestions are much appreciated!

Evgeny Lodyzhehsky's picture

Dear Dave Cowden.

Could you demonstrate with an examples of "...It seems many say thatBRepAlgoAPI_Section is buggy..."
Please upload somewhere in net the shapes (*.brep) and short description of problems (*.txt)

Thanks in advance

Dave Cowden's picture
Evgeny Lodyzhehsky's picture

Dear Dave Cowden

1. It is to be regretted that you have no own examples where BRepAlgoAPI_Section fails.
The references above are not fresh data, and the bugs inside can already be fixed by Open Cascade team Did you check it? If no, they can be treated as fence graffo, no more.

2. "...my biggest issue with BRepAlgo[API]_Section is that it returns a compound of edges instead of wires, so I have trouble gathering loops..."
- A wire is just a set of edges, i.e. te object of the type TopoDS_Wire is just a container for edges. A compound is a container too but for shapes of any type. So if even you had TopoDS_Wire as result it would not to help you with gathering loops.

Dave Cowden's picture

That said, my biggest issue with BRepAlgo[API]_Section is that it returns a compound of edges instead of wires, so I have trouble gathering loops. I need to "fill" the sections with toolpaths so I need to be able to treat the section as a face and know what the sense of the wires are, etc.

Am i better off just using boolean cuts instead to solve this, even though that would be more expensive?

Divya's picture

can you tell me what classes to use inorder to slice a simple solid...

Dan Heeks's picture

Dave, why not just use Open CASCADE to create an STL file from STEP file and then use FreeSteel's slice.exe? ( it's free to use )