#include <ShapeFix_Shape.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepGProp_Face.hxx>
+#include <BinTools.hxx>
static const Standard_Real aPipeLinearTolerance = 1.0e-4;
static const Standard_Real aPipeAngularTolerance = 1.0e-2;
+static const Standard_Boolean isParallelComputation = Standard_False;
+const char aDirPatch[] = "D:\\nbv-29523\\shapes\\my\\";
+
static Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF,
const Standard_Real theFuzzyToler,
TopTools_ListOfShape& theListOfFaces,
TopTools_ListOfShape& theListOfSplits);
+#define BREPFILL_VOLUVED_DEBUG
+
//=======================================================================
//function : GetSpineAndProfile
//purpose :
myFuzzyValue = theTolerance;
}
+#ifdef BREPFILL_VOLUVED_DEBUG
+ char aBuff[10000];
+ Sprintf(aBuff, "%s%s", aDirPatch, "spine.nbv");
+ BinTools::Write(theSpine, aBuff);
+ Sprintf(aBuff, "%s%s", aDirPatch, "profile.nbv");
+ BinTools::Write(theProfile, aBuff);
+
+ std::streamsize aPrecVal = std::cout.precision();
+
+ std::cout.precision(15);
+
+ std::cout << "++++ Dump of Spine" << std::endl;
+ BRepTools::Dump(theSpine, std::cout);
+ std::cout << "---- Dump of Spine" << std::endl;
+
+ std::cout << "++++ Dump of Profile" << std::endl;
+ BRepTools::Dump(theProfile, std::cout);
+ std::cout << "---- Dump of Profile" << std::endl;
+
+ std::cout.precision(aPrecVal);
+#endif
+
GetSpineAndProfile(theSpine, theProfile);
myPipeShell.Nullify();
myTopBottom.Nullify();
myResult.Nullify();
+#ifdef BREPFILL_VOLUVED_DEBUG
+ std::cout << "Start Evolved. Toler = " << myFuzzyValue << std::endl;
+#endif
+
PerformSweep();
+
+#ifdef BREPFILL_VOLUVED_DEBUG
+ std::cout << "PerformSweep complete. Status = " << myErrorStatus << std::endl;
+#endif
+
GetLids();
+#ifdef BREPFILL_VOLUVED_DEBUG
+ std::cout << "GetLids complete. Status = " << myErrorStatus << std::endl;
+#endif
+
if ((myErrorStatus != BRepFill_Voluved_NotSolid) && !theSolidReq)
{
myResult = myPipeShell;
// Split interfered edges
BOPAlgo_PaveFiller aPF;
aPF.SetArguments(aLE);
- aPF.SetRunParallel(Standard_True);
+ aPF.SetRunParallel(isParallelComputation);
aPF.Perform();
if (aPF.HasErrors())
aBuilder.AddArgument(aS);
}
- aBuilder.SetRunParallel(Standard_True);
+ aBuilder.SetRunParallel(isParallelComputation);
aBuilder.PerformWithFiller(aPF);
if (aBuilder.HasErrors())
{
Handle(ShapeFix_Shape) aSFix = new ShapeFix_Shape;
aSFix->Init(myPipeShell);
+
+#ifdef BREPFILL_VOLUVED_DEBUG
+ char aBuff[10000];
+ Sprintf(aBuff, "%s%s", aDirPatch, "shape1.nbv");
+ BinTools::Write(myPipeShell, aBuff);
+#endif
+
+
aSFix->Perform();
myPipeShell = aSFix->Shape();
+#ifdef BREPFILL_VOLUVED_DEBUG
+ Sprintf(aBuff, "%s%s", aDirPatch, "shape2.nbv");
+ BinTools::Write(myPipeShell, aBuff);
+#endif
+
for (anExpF.Init(myPipeShell, TopAbs_FACE);
anExpF.More(); anExpF.Next())
{
aLF.Append(aF);
}
+#ifdef BREPFILL_VOLUVED_DEBUG
+ BRep_Builder aBB;
+ TopoDS_Compound aDebComp;
+ aBB.MakeCompound(aDebComp);
+ TopTools_ListIteratorOfListOfShape anItrDeb(aLF);
+ for (; anItrDeb.More(); anItrDeb.Next())
+ {
+ const TopoDS_Face &aF = TopoDS::Face(anItrDeb.Value());
+ aBB.Add(aDebComp, aF);
+ }
+
+ Sprintf(aBuff, "%s%s", aDirPatch, "shape3.nbv");
+ BinTools::Write(aDebComp, aBuff);
+#endif
+
// Split interfered faces
BOPAlgo_PaveFiller aPF;
aPF.SetArguments(aLF);
- aPF.SetRunParallel(Standard_True);
+ aPF.SetRunParallel(isParallelComputation);
aPF.SetFuzzyValue(myFuzzyValue);
aPF.Perform();
aBuilder.AddArgument(aS);
}
- aBuilder.SetRunParallel(Standard_True);
+ aBuilder.SetRunParallel(isParallelComputation);
aBuilder.PerformWithFiller(aPF);
myPipeShell = aBuilder.Shape();
}
}
+#ifdef BREPFILL_VOLUVED_DEBUG
+ Sprintf(aBuff, "%s%s", aDirPatch, "shape4.nbv");
+ BinTools::Write(myPipeShell, aBuff);
+#endif
+
aLF.Clear();
aMapF.Clear();
for (anExpF.Init(myPipeShell, TopAbs_FACE);
}
}
+#ifdef BREPFILL_VOLUVED_DEBUG
+ BRep_Builder aBB;
+ TopoDS_Compound aDebComp;
+ aBB.MakeCompound(aDebComp);
+ TopTools_ListIteratorOfListOfShape anItrDeb(aLF);
+ for (; anItrDeb.More(); anItrDeb.Next())
+ {
+ const TopoDS_Face &aF = TopoDS::Face(anItrDeb.Value());
+ aBB.Add(aDebComp, aF);
+ }
+
+ Sprintf(aBuff, "%s%s", aDirPatch, "shape5.nbv");
+ BinTools::Write(aDebComp, aBuff);
+#endif
+
BOPAlgo_MakerVolume aMV;
aMV.SetArguments(aLF);
aMV.SetFuzzyValue(myFuzzyValue);
aMV.SetIntersect(Standard_True);
- aMV.SetRunParallel(Standard_True);
+ aMV.SetRunParallel(isParallelComputation);
aMV.SetAvoidInternalShapes(Standard_True);
aMV.Perform();
}
myResult = aMV.Shape();
+
+#ifdef BREPFILL_VOLUVED_DEBUG
+ std::cout << "BuildSolid After VM." << std::endl;
+#endif
+
RemoveExcessSolids(aLSplits, myResult, aLF, aMV);
myErrorStatus = BRepFill_Voluved_OK;
BOPAlgo_MakerVolume aMV;
aMV.SetArguments(theArgsList);
aMV.SetIntersect(Standard_True);
- aMV.SetRunParallel(Standard_True);
+ aMV.SetRunParallel(isParallelComputation);
aMV.SetAvoidInternalShapes(Standard_True);
aMV.Perform();
// Split interfered edges
BOPAlgo_PaveFiller aPF;
aPF.SetArguments(aLE);
- aPF.SetRunParallel(Standard_True);
+ aPF.SetRunParallel(isParallelComputation);
aPF.Perform();
if (aPF.HasErrors())
aBuilder.AddArgument(aS);
}
- aBuilder.SetRunParallel(Standard_True);
+ aBuilder.SetRunParallel(isParallelComputation);
aBuilder.PerformWithFiller(aPF);
if (aBuilder.HasErrors())
{
aBAB.AddArgument(aSh);
}
- aBAB.SetRunParallel(Standard_True);
+ aBAB.SetRunParallel(isParallelComputation);
aBAB.SetNonDestructive(Standard_True);
aBAB.PerformWithFiller(aPF);
if (aBAB.HasErrors())
return 0;
}
+#include <BRepOffsetAPI_MakeEvolved.hxx>
+#include <ShapeFix_Wireframe.hxx>
+static Standard_Integer myCall(Draw_Interpretor&, Standard_Integer theNbArgs, const char** theArgVec)
+{
+ TopoDS_Wire extrudeWire = TopoDS::Wire(DBRep::Get(theArgVec[2]));
+ TopoDS_Wire toolWire = TopoDS::Wire(DBRep::Get(theArgVec[3]));
+
+ // ################################ Check and Fix Wire Gaps #########################################
+ if (1)
+ {
+ ShapeFix_Wireframe fix_tool(extrudeWire);
+ fix_tool.ModeDropSmallEdges() = Standard_True;
+ fix_tool.SetPrecision(Precision::Confusion()); //yes!
+ fix_tool.FixSmallEdges();
+ fix_tool.FixWireGaps();
+ extrudeWire = TopoDS::Wire(fix_tool.Shape());
+ }
+
+ // ################################ Extrude tool #########################################
+ BRepOffsetAPI_MakeEvolved mkEvolved = BRepOffsetAPI_MakeEvolved(extrudeWire, toolWire, GeomAbs_Arc, Standard_False, Standard_True, Standard_False, Standard_True, 0);
+
+ DBRep::Set(theArgVec[1], mkEvolved.Shape());
+
+ return 0;
+}
+
+//=======================================================================
+//function : FindGaps
+//purpose :
+//=======================================================================
+static Standard_Integer FindGaps(Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgV)
+{
+ if (theNArg < 3)
+ {
+ theDI << "Use: " << theArgV[0] << " result wire\n";
+ return 1;
+ }
+
+ const TopoDS_Wire aWir = TopoDS::Wire(DBRep::Get(theArgV[2]));
+
+ TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
+ TopExp::MapShapesAndAncestors(aWir, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
+
+ Standard_Real aMaxDist = RealFirst();
+
+ for (Standard_Integer i = 1; i <= aMapVE.Extent(); i++)
+ {
+ const TopoDS_Vertex &aV = TopoDS::Vertex(aMapVE.FindKey(i));
+
+ TopTools_ListOfShape aLE = aMapVE.FindFromIndex(i);
+
+ const TopoDS_Edge anE1 = TopoDS::Edge(aLE.First());
+ const TopoDS_Edge anE2 = TopoDS::Edge(aLE.Last());
+
+ const BRepAdaptor_Curve anAC1(anE1), anAC2(anE2);
+
+ const Standard_Real aPrm1 = BRep_Tool::Parameter(aV, anE1);
+ const Standard_Real aPrm2 = BRep_Tool::Parameter(aV, anE2);
+
+ gp_Pnt aP1, aP2;
+ anAC1.D0(aPrm1, aP1);
+ anAC2.D0(aPrm2, aP2);
+
+ char aBuff[100];
+ Sprintf(aBuff, "%sv%d", theArgV[1], i);
+ DBRep::Set(aBuff, aV);
+
+ const Standard_Real aDist = aP1.Distance(aP2);
+ aMaxDist = Max(aMaxDist, aDist);
+
+ theDI << aBuff << ": Dist = " << aDist << "\n";
+ }
+
+ theDI << "Max. gap is " << aMaxDist << "\n";
+
+ return 0;
+}
+
+//=======================================================================
+//function : VEProcess
+//purpose :
+//=======================================================================
+static Standard_Integer VEProcess(Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgV)
+{
+ if (theNArg < 3)
+ {
+ theDI << "Use: " << theArgV[0] << " result wire\n";
+ return 1;
+ }
+
+ const TopoDS_Wire aWir = TopoDS::Wire(DBRep::Get(theArgV[2]));
+
+ TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
+ TopExp::MapShapesAndAncestors(aWir, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
+
+ for (Standard_Integer i = 1; i <= aMapVE.Extent(); i++)
+ {
+ const TopoDS_Vertex &aV = TopoDS::Vertex(aMapVE.FindKey(i));
+
+ TopTools_ListOfShape aLE = aMapVE.FindFromIndex(i);
+
+ const TopoDS_Edge anE1 = TopoDS::Edge(aLE.First());
+ const TopoDS_Edge anE2 = TopoDS::Edge(aLE.Last());
+
+ const BRepAdaptor_Curve anAC1(anE1), anAC2(anE2);
+
+ const Standard_Real aPrm1 = BRep_Tool::Parameter(aV, anE1);
+ const Standard_Real aPrm2 = BRep_Tool::Parameter(aV, anE2);
+
+ gp_Pnt aP;
+ gp_Vec aT1, aT2;
+ anAC1.D1(aPrm1, aP, aT1);
+ anAC2.D1(aPrm2, aP, aT2);
+
+ Standard_Real anAngle = aT1.Angle(aT2);
+
+ if (anAngle > M_PI_2)
+ anAngle = M_PI - anAngle;
+
+ char aBuff[100];
+ Sprintf(aBuff, "%sv%d", theArgV[1], i);
+ DBRep::Set(aBuff, aV);
+
+ theDI << aBuff << " (" << BRep_Tool::Tolerance(aV) << "): A = " << anAngle << "\n";
+ }
+
+ return 0;
+}
+
+
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
__FILE__, OCC28887, group);
theCommands.Add("OCC28131", "OCC28131 name: creates face problematic for offset", __FILE__, OCC28131, group);
+ theCommands.Add("myCall", "myCall result spine profile", __FILE__, myCall, group);
+
+ theCommands.Add("findgaps", "findgaps result wire", __FILE__, FindGaps, group);
+ theCommands.Add("veproc", "veproc result wire", __FILE__, VEProcess, group);
+
return;
}