1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
emv
fcfc4713a6 0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts
BRepFill_TrimShellCorner::MakeFacesSec() - When replacing a bound edge with a section wire make sure that edges in a wire are oriented correctly.
Test cases for the issue.
2019-06-24 12:16:12 +03:00
2 changed files with 40 additions and 21 deletions

View File

@@ -17,6 +17,7 @@
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAlgoAPI_Section.hxx>
@@ -175,6 +176,7 @@ static void RemoveEdges(const TopoDS_Compound& theSourceComp,
static Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve& theBCurves,
const TopoDS_Face& theSecPlane,
const BOPDS_PDS& theDS,
const Handle (IntTools_Context)& theContext,
TopoDS_Compound& theResult);
static Standard_Boolean GetUEdges(const Standard_Integer theIndex,
@@ -345,7 +347,7 @@ void BRepFill_TrimShellCorner::Perform()
}
}
else {
if(!MakeFacesSec(ii, theDS, anIndex1, anIndex2, i)) {
if(!MakeFacesSec(ii, theDS, aPF.Context(), anIndex1, anIndex2, i)) {
myHistMap.Clear();
return;
}
@@ -658,6 +660,7 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
Standard_Boolean
BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer theIndex,
const BOPDS_PDS& theDS,
const Handle (IntTools_Context)& theContext,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2,
const Standard_Integer theSSInterfIndex)
@@ -669,7 +672,7 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer
TopoDS_Compound aSecEdges;
TopoDS_Face aSecPlane;
if(!FilterSectionEdges(aBCurves, aSecPlane, theDS, aSecEdges))
if(!FilterSectionEdges(aBCurves, aSecPlane, theDS, theContext, aSecEdges))
return Standard_False;
//Extract vertices on the intersection of correspondent U-edges
@@ -787,11 +790,18 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer
aBB.MakeWire(aW);
TopTools_ListIteratorOfListOfShape aEIt(aListOfWireEdges);
for(; aEIt.More(); aEIt.Next()) {
TopoDS_Edge aFBE = TopoDS::Edge (aBoundEdge.Oriented (TopAbs_FORWARD));
for (; aEIt.More(); aEIt.Next())
{
if (!aBoundEdge.IsSame(aEIt.Value()))
aBB.Add(aW, aEIt.Value());
{
TopoDS_Edge aSplit = TopoDS::Edge (aEIt.Value());
if (BOPTools_AlgoTools::IsSplitToReverse (aSplit, aFBE, theContext))
aSplit.Reverse();
aBB.Add (aW, aSplit);
}
aSubstitutor->Replace(aBoundEdge.Oriented(TopAbs_FORWARD), aW);
}
aSubstitutor->Replace (aFBE, aW);
}
aSubstitutor->Apply(aFace);
@@ -1437,13 +1447,16 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
gp_Pnt2d ap = aCurve->Value(f);
Standard_Boolean bFirstFound = Standard_False;
Standard_Boolean bLastFound = Standard_False;
Standard_Boolean bforward = Standard_True;
if(ap.Distance(theFirstPoint) < aTolerance1) {
bforward = Standard_True;
if(theOrientedList.IsEmpty())
theOrientedList.Append(aEPrev.Oriented(TopAbs_FORWARD));
bFirstFound = Standard_True;
}
else if(ap.Distance(theLastPoint) < aTolerance1) {
bforward = Standard_False;
if(theOrientedList.IsEmpty())
theOrientedList.Append(aEPrev.Oriented(TopAbs_REVERSED));
bLastFound = Standard_True;
@@ -1451,31 +1464,36 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
ap = aCurve->Value(l);
if(ap.Distance(theLastPoint) < aTolerance2) {
bforward = Standard_True;
if(theOrientedList.IsEmpty())
theOrientedList.Append(aEPrev.Oriented(TopAbs_FORWARD));
bLastFound = Standard_True;
}
else if(ap.Distance(theFirstPoint) < aTolerance2) {
bforward = Standard_False;
if(theOrientedList.IsEmpty())
theOrientedList.Append(aEPrev.Oriented(TopAbs_REVERSED));
bFirstFound = Standard_True;
}
if (!theOrientedList.IsEmpty())
aEPrev = TopoDS::Edge (theOrientedList.Last());
for(; anIt.More(); anIt.Next()) {
const TopoDS_Edge& aE = TopoDS::Edge(anIt.Value());
TopoDS_Vertex aV11, aV12;
TopExp::Vertices(aEPrev, aV11, aV12, Standard_True);
TopExp::Vertices(aEPrev, aV11, aV12);
TopoDS_Vertex aV21, aV22;
TopExp::Vertices(aE, aV21, aV22, Standard_False);
TopExp::Vertices(aE, aV21, aV22);
TopAbs_Orientation anOri = TopAbs_FORWARD;
TopAbs_Orientation anOri =
(aV12.IsSame (aV21) || aV11.IsSame (aV22)) ? TopAbs_FORWARD : TopAbs_REVERSED;
if(aV12.IsSame(aV21) || aV11.IsSame(aV22)) {
anOri = (bforward) ? TopAbs_FORWARD : TopAbs_REVERSED;
}
else {
anOri = (bforward) ? TopAbs_REVERSED : TopAbs_FORWARD;
}
theOrientedList.Append(aE.Oriented(anOri));
aEPrev = TopoDS::Edge (theOrientedList.Last());
aEPrev = aE;
aTolerance1 = (aV21.IsNull()) ? Precision::Confusion() : BRep_Tool::Tolerance(aV21);
aTolerance2 = (aV22.IsNull()) ? Precision::Confusion() : BRep_Tool::Tolerance(aV22);
utol = aBAS.UResolution(aTolerance1);
@@ -1503,7 +1521,9 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape& theOrderedList
}
}
return bFirstFound && bLastFound;
if(!bFirstFound || !bLastFound)
return Standard_False;
return Standard_True;
}
// ----------------------------------------------------------------------------------------------------
@@ -2144,6 +2164,7 @@ void RemoveEdges(const TopoDS_Compound& theSourceComp,
Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve& theBCurves,
const TopoDS_Face& theSecPlane,
const BOPDS_PDS& theDS,
const Handle (IntTools_Context)& theContext,
TopoDS_Compound& theResult) {
theResult.Nullify();
@@ -2171,10 +2192,7 @@ Standard_Boolean FilterSectionEdges(const BOPDS_VectorOfCurve& theBCurves,
Standard_Real f = 0., l = 0.;
BRep_Tool::Range(anEdge, f, l);
anIntersector.SetBeanParameters(f, l);
//
Handle(IntTools_Context) aContext = new IntTools_Context;
anIntersector.SetContext(aContext);
//
anIntersector.SetContext(theContext);
anIntersector.Perform();
if(anIntersector.IsDone()) {

View File

@@ -35,7 +35,7 @@ class gp_Ax2;
class TopoDS_Face;
class TopoDS_Wire;
class TopoDS_Shape;
class IntTools_Context;
//! Trims sets of faces in the corner to make proper parts of pipe
class BRepFill_TrimShellCorner
@@ -80,6 +80,7 @@ private:
Standard_Boolean MakeFacesSec(const Standard_Integer theIndex,
const BOPDS_PDS& theDS,
const Handle (IntTools_Context)& theContext,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2,
const Standard_Integer theSSInterfIndex);