#include <BlockFix_UnionEdges.hxx>
#include <ShapeUpgrade_RemoveLocations.hxx>
+#include <TopoDS_Edge.hxx>
+#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <Precision.hxx>
myShape = BlockFix::RefillProblemFaces(myShape);
// faces unification
- BlockFix_UnionFaces aFaceUnifier;
- aFaceUnifier.GetTolerance() = myTolerance;
- aFaceUnifier.GetOptimumNbFaces() = myOptimumNbFaces;
- TopoDS_Shape aResult = aFaceUnifier.Perform(myShape);
+ TopoDS_Shape aResult = myShape;
+ if (myOptimumNbFaces > 1) {
+ // use old algo BlockFix_UnionFaces for exactly given resulting number of faces
+ BlockFix_UnionFaces aFaceUnifier;
+ aFaceUnifier.GetTolerance() = myTolerance;
+ aFaceUnifier.GetOptimumNbFaces() = myOptimumNbFaces;
+ aResult = aFaceUnifier.Perform(aResult);
+ }
+ else if (myOptimumNbFaces != -1) {
+ // use OCCT algo ShapeUpgrade_UnifySameDomain
+ ShapeUpgrade_UnifySameDomain Unifier;
+ //only faces
+ Standard_Boolean isUnifyEdges = Standard_False;
+ Standard_Boolean isUnifyFaces = Standard_True;
+ Standard_Boolean isConcatBSplines = Standard_True;
+ Unifier.Initialize(myShape, isUnifyEdges, isUnifyFaces, isConcatBSplines);
+ //Unifier.SetLinearTolerance(myTolerance);
+ Unifier.SetLinearTolerance(Precision::Confusion());
+ Unifier.SetAngularTolerance(Precision::Confusion());
+ Unifier.Build();
+ aResult = Unifier.Shape();
+ }
+ else {
+ // myOptimumNbFaces == -1 means do not union faces
+ }
// avoid problem with degenerated edges appearance
// due to shape quality regress
aResult = RemLoc.GetResult();
// edges unification
- BlockFix_UnionEdges anEdgeUnifier;
- myShape = anEdgeUnifier.Perform(aResult,myTolerance);
+ //BlockFix_UnionEdges anEdgeUnifier;
+ //myShape = anEdgeUnifier.Perform(aResult,myTolerance);
+ ShapeUpgrade_UnifySameDomain Unifier;
+ Standard_Boolean isUnifyEdges = Standard_True;
+ Standard_Boolean isUnifyFaces = Standard_False; //only edges
+ Standard_Boolean isConcatBSplines = Standard_True;
+ Unifier.Initialize(aResult, isUnifyEdges, isUnifyFaces, isConcatBSplines);
+ Unifier.SetLinearTolerance(myTolerance);
+ Unifier.Build();
+ myShape = Unifier.Shape();
TopoDS_Shape aRes = BlockFix::FixRanges(myShape,myTolerance);
myShape = aRes;
#include <BRepExtrema_ExtPF.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
+#include <ShapeUpgrade_UnifySameDomain.hxx>
+
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
Standard_NullObject::Raise("Null Shape given");
}
- BlockFix_UnionFaces aFaceUnifier;
-
- aFaceUnifier.GetOptimumNbFaces() = 0; // To force union faces.
- aShape = aFaceUnifier.Perform(aBlockOrComp);
+ //BlockFix_UnionFaces aFaceUnifier;
+ //aFaceUnifier.GetOptimumNbFaces() = 0; // To force union faces.
+ //aShape = aFaceUnifier.Perform(aBlockOrComp);
+ // Use OCCT algo ShapeUpgrade_UnifySameDomain instead of BlockFix_UnionFaces:
+ Standard_Boolean isUnifyEdges = Standard_False;
+ Standard_Boolean isUnifyFaces = Standard_True;
+ Standard_Boolean isConcatBSplines = Standard_True;
+ ShapeUpgrade_UnifySameDomain aUnifier (aBlockOrComp,
+ isUnifyEdges, isUnifyFaces, isConcatBSplines);
+ aUnifier.SetLinearTolerance(Precision::Confusion());
+ aUnifier.SetAngularTolerance(Precision::Confusion());
+ aUnifier.Build();
+ aShape = aUnifier.Shape();
} else { // unknown function type
return 0;
}