I would like to construct a 'cut-off'-prisma:
I have the base face, the extrusion vector and two cutting planes. My first attempt was to create the base prism with BrepPrimApi_makePrism and then use Boolean operation CUT to do the trimming. However, as we all know, BOPs can be prohibitivly expensive in computing time.
So my second idea is to do the following:
1. Project the baseface's wires (it has several) on startplane and endplane (along the extrusion vector)
2. Build the corresponding Shells with BrepOffsetAPI_ThruSections
3. Sew these together with the projectes basefaces
however, step 2 fails with an access violation at 0xfefd0068 on the call of brepOffsetApi_ThruSections::Build().
//project baseprofile to cutting planes
BRepProj_Projection projector1(curWir, BRepBuilderAPI_MakeFace(startPlane, -10000, 10000, -10000, 10000), startPlane->Axis().Direction());
BRepProj_Projection projector2(curWir, BRepBuilderAPI_MakeFace(endPlane, -10000, 10000, -10000, 10000), endPlane->Axis().Direction());
if(projector1.IsDone() && projector2.IsDone())
proj1Wir = TopoDS::Wire(projector1.Current());
proj2Wir = TopoDS::Wire(projector2.Current());
Things I have tried so far:
- I have fiddled around with fixing the wires, but had no improved results.
- Checked the number of edges of edge Wire after the projection - they are the same.
- there are no intersections between wire1 and wire2
- Removed the entire Projection step and transformed proj1wir and proj2wir manually to be orthogonal with my extrusion vector. This allowed for the thrusection to be built correctly, so i am probably missing some aspects of the projection.
I am close to my wits' end with this one. Does anyone of you, dear readers, have some insight to share?