Btw, therepair
command will fix the orientation but it's much better to understand why the shape came in corrupted that way. Shape healing is a "last chance" tool to apply when things completely get out of control.
The faulty Face comes from a BRepAlgoAPI_Common with using the planar face as arguments and a bounding box solid as tools.
Yes, for debugging it's either BREP or immediate drawing to the display from memory (to avoid any "unintentional healing").Use and export a BRep representation of your shapes if you want to debug them (Exporting as STEP might give you a different version of that shape)
clear; load-part C:/Work/.../shape.brep; fit;
explode
bop-fuse-gen r "SHELL 1" "SHELL 2"
set-as-part r
donly
// Find non-manifold edges
// TODO: ASITUS SDK
// Get child-parent relationships
TopTools_IndexedDataMapOfShapeListOfShape M;
TopExp::MapShapesAndAncestors(fused, TopAbs_EDGE, TopAbs_FACE, M);
// Check for every edge the number of its owning faces
const int nEdges = M.Extent();
for (int e = 1; e <= nEdges; ++e) {
const TopoDS_Edge &E = TopoDS::Edge(M.FindKey(e));
//
if (BRep_Tool::Degenerated(E)) continue;
const int nOwningFaces = M.FindFromIndex(e).Extent();
if (nOwningFaces > 2) {
bbuilder.Add(nonManifoldEdges, E);
//
bbuilder.Add(dbgDump, E);
}
}
if (nOwningFaces > 2 || E.Orientation() == TopAbs_INTERNAL) {
...
}