mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0025479: BRepTools::Clean() cleans all edge polygons, even related to different shapes
This commit is contained in:
parent
32a15d12db
commit
d0a994c7f1
@ -667,43 +667,36 @@ Standard_Boolean BRepTools::Read(TopoDS_Shape& Sh,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepTools::Clean(const TopoDS_Shape& S)
|
void BRepTools::Clean(const TopoDS_Shape& theShape)
|
||||||
{
|
{
|
||||||
BRep_Builder B;
|
BRep_Builder aBuilder;
|
||||||
TopExp_Explorer ex;
|
Handle(Poly_Triangulation) aNullTriangulation;
|
||||||
Handle(Poly_Triangulation) TNULL, T;
|
Handle(Poly_PolygonOnTriangulation) aNullPoly;
|
||||||
Handle(Poly_PolygonOnTriangulation) PolyNULL, Poly;
|
|
||||||
|
|
||||||
if (!S.IsNull()) {
|
if (theShape.IsNull())
|
||||||
TopLoc_Location L;
|
return;
|
||||||
for (ex.Init(S,TopAbs_FACE);ex.More();ex.Next()) {
|
|
||||||
const TopoDS_Face& F = TopoDS::Face(ex.Current());
|
|
||||||
B.UpdateFace(F, TNULL);
|
|
||||||
}
|
|
||||||
for (ex.Init(S, TopAbs_EDGE); ex.More(); ex.Next()) {
|
|
||||||
const TopoDS_Edge& E = TopoDS::Edge(ex.Current());
|
|
||||||
// agv 21.09.01 : Inefficient management of Locations -> improve performance
|
|
||||||
// do {
|
|
||||||
// BRep_Tool::PolygonOnTriangulation(E, Poly, T, L);
|
|
||||||
// B.UpdateEdge(E, PolyNULL, T, L);
|
|
||||||
// } while(!Poly.IsNull());
|
|
||||||
//
|
|
||||||
Handle(BRep_CurveRepresentation) cr;
|
|
||||||
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
|
|
||||||
BRep_ListOfCurveRepresentation& lcr = TE -> ChangeCurves();
|
|
||||||
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
|
|
||||||
|
|
||||||
// find and remove all representations
|
TopExp_Explorer aFaceIt(theShape, TopAbs_FACE);
|
||||||
while (itcr.More()) {
|
for (; aFaceIt.More(); aFaceIt.Next())
|
||||||
cr = itcr.Value();
|
{
|
||||||
if (cr->IsPolygonOnTriangulation())
|
const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
|
||||||
lcr.Remove(itcr);
|
|
||||||
else
|
TopLoc_Location aLoc;
|
||||||
itcr.Next();
|
const Handle(Poly_Triangulation)& aTriangulation =
|
||||||
}
|
BRep_Tool::Triangulation(aFace, aLoc);
|
||||||
TE->Modified(Standard_True);
|
|
||||||
// agv : fin
|
if (aTriangulation.IsNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Nullify edges
|
||||||
|
TopExp_Explorer aEdgeIt(aFace, TopAbs_EDGE);
|
||||||
|
for (; aEdgeIt.More(); aEdgeIt.Next())
|
||||||
|
{
|
||||||
|
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
|
||||||
|
aBuilder.UpdateEdge(aEdge, aNullPoly, aTriangulation, aLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aBuilder.UpdateFace(aFace, aNullTriangulation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user