Part: fixes #6584: Pocket becomes a pad when next object ofter a polar pattern

This commit is contained in:
wmayer
2022-04-10 23:55:03 +02:00
parent 69ac799f58
commit 35913fc695

View File

@@ -60,6 +60,7 @@
# include <BRepBndLib.hxx>
# include <ShapeAnalysis_Edge.hxx>
# include <ShapeAnalysis_Curve.hxx>
# include <ShapeAnalysis_Shell.hxx>
# include <BRepAdaptor_Curve.hxx>
# include <TColgp_SequenceOfPnt.hxx>
# include <GeomAPI_ProjectPointOnSurf.hxx>
@@ -1042,6 +1043,7 @@ bool FaceUniter::process()
typeObjects.push_back(&getBSplineObject());
//add more face types.
bool checkFinalShell = false;
ModelRefine::FaceTypeSplitter splitter;
splitter.addShell(workShell);
std::vector<FaceTypedBase *>::iterator typeIt;
@@ -1072,7 +1074,7 @@ bool FaceUniter::process()
// the created face should have the same orientation as the input faces
const FaceVectorType& faces = adjacencySplitter.getGroup(adjacentIndex);
if (!faces.empty() && newFace.Orientation() != faces[0].Orientation()) {
newFace.Orientation(faces[0].Orientation());
checkFinalShell = true;
}
facesToSew.push_back(newFace);
if (facesToRemove.capacity() <= facesToRemove.size() + adjacencySplitter.getGroup(adjacentIndex).size())
@@ -1154,6 +1156,19 @@ bool FaceUniter::process()
faceFixer.Perform();
}
workShell = TopoDS::Shell(edgeFuse.Shape());
// A difference of orientation between original and fused faces was previously detected
if (checkFinalShell) {
ShapeAnalysis_Shell check;
check.LoadShells(workShell);
if (!check.HasFreeEdges()) {
// the shell is a solid, make sure that volume is positive
GProp_GProps props;
BRepGProp::VolumeProperties(workShell, props);
if (props.Mass() < 0)
workShell = TopoDS::Shell(workShell.Reversed());
}
}
// update the list of modifications
TopTools_DataMapOfShapeShape faceMap;
edgeFuse.Faces(faceMap);