mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0025068: ShapeAnalysis_FreeBounds::ConnectEdgesToWires returns wires with not valid Closed flag
Test case for issue CR25068
This commit is contained in:
parent
31cf9c5f7d
commit
189062565f
@ -199,6 +199,15 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
Handle(ShapeExtend_WireData)
|
||||
sewd = new ShapeExtend_WireData (TopoDS::Wire (arrwires->Value (1)));
|
||||
|
||||
Standard_Boolean isUsedManifoldMode = Standard_True;
|
||||
|
||||
if((sewd->NbEdges() < 1) && (sewd->NbNonManifoldEdges() > 0))
|
||||
{
|
||||
isUsedManifoldMode = Standard_False;
|
||||
sewd = new ShapeExtend_WireData (TopoDS::Wire (arrwires->Value (1)), Standard_True,
|
||||
isUsedManifoldMode);
|
||||
}
|
||||
|
||||
Handle(ShapeAnalysis_Wire) saw = new ShapeAnalysis_Wire;
|
||||
saw->Load (sewd);
|
||||
saw->SetPrecision (tolerance);
|
||||
@ -227,12 +236,6 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
ShapeAnalysis_Edge sae; //szv#4:S4163:12Mar99 moved
|
||||
Standard_Boolean done = Standard_False;
|
||||
|
||||
Standard_Boolean isUsedManifoldMode = Standard_True;
|
||||
|
||||
if((sewd->NbEdges() < 1) && (sewd->NbNonManifoldEdges() > 0))
|
||||
{
|
||||
isUsedManifoldMode = Standard_False;
|
||||
}
|
||||
|
||||
while (!done)
|
||||
{
|
||||
@ -241,10 +244,8 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
aSel.SetStop();
|
||||
Bnd_Box FVBox, LVBox;
|
||||
TopoDS_Vertex Vf, Vl;
|
||||
Vf = isUsedManifoldMode ? sae.FirstVertex(sewd->Edge(1)) :
|
||||
sae.FirstVertex(sewd->NonmanifoldEdge(1));
|
||||
Vl = isUsedManifoldMode ? sae.LastVertex(sewd->Edge(sewd->NbEdges())) :
|
||||
sae.LastVertex(sewd->NonmanifoldEdge(sewd->NbNonManifoldEdges()));
|
||||
Vf = sae.FirstVertex(sewd->Edge(1));
|
||||
Vl = sae.LastVertex(sewd->Edge(sewd->NbEdges()));
|
||||
|
||||
gp_Pnt pf, pl;
|
||||
pf = BRep_Tool::Pnt(Vf);
|
||||
@ -284,7 +285,7 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
|
||||
TopoDS_Wire aCurW = TopoDS::Wire (arrwires->Value (lwire));
|
||||
Handle(ShapeExtend_WireData) acurwd = new
|
||||
ShapeExtend_WireData ( TopoDS::Wire (arrwires->Value (lwire)));
|
||||
ShapeExtend_WireData ( TopoDS::Wire (arrwires->Value (lwire)), Standard_True, isUsedManifoldMode);
|
||||
sewd->Add (acurwd, (tail ? 0 : 1));
|
||||
}
|
||||
else
|
||||
@ -328,11 +329,42 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape,
|
||||
|
||||
//2.making wire
|
||||
TopoDS_Wire wire = sewd->Wire();
|
||||
if(isUsedManifoldMode)
|
||||
{
|
||||
if (!saw->CheckConnected (1) && saw->LastCheckStatus (ShapeExtend_OK))
|
||||
wire.Closed (Standard_True);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Try to check connection by number of free vertices
|
||||
TopTools_MapOfShape vmap;
|
||||
TopoDS_Iterator it(wire);
|
||||
|
||||
for(; it.More(); it.Next())
|
||||
{
|
||||
const TopoDS_Shape& E = it.Value();
|
||||
TopoDS_Iterator ite(E, Standard_False, Standard_True);
|
||||
for(; ite.More(); ite.Next())
|
||||
{
|
||||
const TopoDS_Shape& V = ite.Value();
|
||||
if (V.Orientation() == TopAbs_FORWARD ||
|
||||
V.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
// add or remove in the vertex map
|
||||
if (!vmap.Add(V)) vmap.Remove(V);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(vmap.IsEmpty())
|
||||
{
|
||||
wire.Closed(Standard_True);
|
||||
}
|
||||
}
|
||||
|
||||
owires->Append (wire);
|
||||
sewd->Clear();
|
||||
sewd->ManifoldMode() = isUsedManifoldMode;
|
||||
|
||||
// Recherche de la premier edge non traitee pour un autre wire.
|
||||
//Searching for first edge for next wire
|
||||
|
@ -64,7 +64,17 @@ TopoDS_Edge ShapeBuild_Edge::CopyReplaceVertices (const TopoDS_Edge& edge,
|
||||
TopTools_SequenceOfShape aNMVertices;
|
||||
TopoDS_Vertex newV1 = V1, newV2 = V2;
|
||||
if ( newV1.IsNull() || newV2.IsNull() ) {
|
||||
for ( TopoDS_Iterator it(edge); it.More(); it.Next() ) {
|
||||
TopoDS_Iterator it;
|
||||
if(edge.Orientation() == TopAbs_FORWARD ||
|
||||
edge.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
it.Initialize(edge, Standard_True, Standard_True);
|
||||
}
|
||||
else
|
||||
{
|
||||
it.Initialize(edge, Standard_False, Standard_True);
|
||||
}
|
||||
for ( ; it.More(); it.Next() ) {
|
||||
TopoDS_Vertex V = TopoDS::Vertex ( it.Value() );
|
||||
if ( V.Orientation() == TopAbs_FORWARD ) {
|
||||
if ( newV1.IsNull() ) newV1 = V;
|
||||
@ -95,7 +105,7 @@ TopoDS_Edge ShapeBuild_Edge::CopyReplaceVertices (const TopoDS_Edge& edge,
|
||||
//S4054, rln 17.11.98 annie_surf.igs entity D77, 3D and pcurve have different
|
||||
//ranges, after B.Range all the ranges become as 3D
|
||||
CopyRanges ( E, edge );
|
||||
/*
|
||||
/*
|
||||
for (BRep_ListIteratorOfListOfCurveRepresentation itcr
|
||||
((*((Handle(BRep_TEdge)*)&edge.TShape()))->ChangeCurves()); itcr.More(); itcr.Next()) {
|
||||
Handle(BRep_GCurve) GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
|
||||
@ -107,7 +117,7 @@ TopoDS_Edge ShapeBuild_Edge::CopyReplaceVertices (const TopoDS_Edge& edge,
|
||||
else if ( GC->IsCurveOnSurface() )
|
||||
B.Range (E, GC->Surface(), edge.Location().Multiplied (GC->Location()), first, last);//BUC50003 entity 132 edge 1
|
||||
}
|
||||
*/
|
||||
*/
|
||||
return E;
|
||||
}
|
||||
|
||||
@ -166,7 +176,7 @@ void ShapeBuild_Edge::CopyRanges (const TopoDS_Edge& toedge,
|
||||
const Standard_Real alpha,
|
||||
const Standard_Real beta) const
|
||||
{
|
||||
/* BRep_Builder B;
|
||||
/* BRep_Builder B;
|
||||
for (BRep_ListIteratorOfListOfCurveRepresentation itcr
|
||||
((*((Handle(BRep_TEdge)*)&fromedge.TShape()))->ChangeCurves()); itcr.More(); itcr.Next()) {
|
||||
Handle(BRep_GCurve) GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
|
||||
@ -178,7 +188,7 @@ void ShapeBuild_Edge::CopyRanges (const TopoDS_Edge& toedge,
|
||||
else if ( GC->IsCurveOnSurface() )
|
||||
B.Range ( toedge, GC->Surface(), fromedge.Location().Multiplied (GC->Location()), first, last);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
for (BRep_ListIteratorOfListOfCurveRepresentation fromitcr
|
||||
((*((Handle(BRep_TEdge)*)&fromedge.TShape()))->ChangeCurves()); fromitcr.More(); fromitcr.Next()) {
|
||||
Handle(BRep_GCurve) fromGC = Handle(BRep_GCurve)::DownCast(fromitcr.Value());
|
||||
@ -338,7 +348,7 @@ void ShapeBuild_Edge::RemovePCurve (const TopoDS_Edge& edge,
|
||||
{
|
||||
BRep_Builder B;
|
||||
Handle(Geom2d_Curve) c2dNull;
|
||||
//:S4136 Standard_Real tol = BRep_Tool::Tolerance ( edge );
|
||||
//:S4136 Standard_Real tol = BRep_Tool::Tolerance ( edge );
|
||||
if ( BRep_Tool::IsClosed ( edge, face ) )
|
||||
B.UpdateEdge ( edge, c2dNull, c2dNull, face, 0. ); //:S4136: tol
|
||||
else B.UpdateEdge ( edge, c2dNull, face, 0. ); //:S4136: tol
|
||||
@ -366,7 +376,7 @@ void ShapeBuild_Edge::RemovePCurve (const TopoDS_Edge& edge,
|
||||
{
|
||||
BRep_Builder B;
|
||||
Handle(Geom2d_Curve) c2dNull;
|
||||
//:S4136 Standard_Real tol = BRep_Tool::Tolerance ( edge );
|
||||
//:S4136 Standard_Real tol = BRep_Tool::Tolerance ( edge );
|
||||
if ( BRep_Tool::IsClosed ( edge, surf, loc ) )
|
||||
B.UpdateEdge ( edge, c2dNull, c2dNull, surf, loc, 0. ); //:S4136: tol
|
||||
else B.UpdateEdge ( edge, c2dNull, surf, loc, 0. ); //:S4136: tol
|
||||
@ -457,7 +467,7 @@ Standard_Boolean ShapeBuild_Edge::ReassignPCurve (const TopoDS_Edge& edge,
|
||||
Standard_Integer npcs = CountPCurves ( edge, sub );
|
||||
if ( npcs <1 ) B.UpdateEdge ( edge, pc, sub, 0. );
|
||||
else {
|
||||
//smh#8 Porting AIX
|
||||
//smh#8 Porting AIX
|
||||
TopoDS_Shape tmpshape = edge.Reversed();
|
||||
TopoDS_Edge erev = TopoDS::Edge (tmpshape);
|
||||
Standard_Real cf, cl;
|
||||
@ -573,7 +583,7 @@ void ShapeBuild_Edge::RemoveCurve3d (const TopoDS_Edge& edge) const
|
||||
{
|
||||
BRep_Builder B;
|
||||
Handle(Geom_Curve) c3dNull;
|
||||
//:S4136 Standard_Real tol = BRep_Tool::Tolerance (edge);
|
||||
//:S4136 Standard_Real tol = BRep_Tool::Tolerance (edge);
|
||||
B.UpdateEdge (edge, c3dNull, 0. ); //:S4136: tol
|
||||
}
|
||||
|
||||
@ -638,7 +648,7 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom_Curve)& curve,const TopLoc_Location& L) const
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom_Curve)& curve,const TopLoc_Location& L) const
|
||||
{
|
||||
MakeEdge (edge,curve, L, curve->FirstParameter(), curve->LastParameter());
|
||||
}
|
||||
@ -648,7 +658,7 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom_Curve)& curve,const TopLoc_Location& L,const Standard_Real p1,const Standard_Real p2) const
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom_Curve)& curve,const TopLoc_Location& L,const Standard_Real p1,const Standard_Real p2) const
|
||||
{
|
||||
BRepBuilderAPI_MakeEdge ME (curve, p1, p2);
|
||||
if (!ME.IsDone()) {
|
||||
@ -678,7 +688,7 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom2d_Curve)& pcurve,const TopoDS_Face& face) const
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom2d_Curve)& pcurve,const TopoDS_Face& face) const
|
||||
{
|
||||
MakeEdge (edge, pcurve, face, pcurve->FirstParameter(), pcurve->LastParameter());
|
||||
}
|
||||
@ -688,7 +698,7 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom2d_Curve)& pcurve,const TopoDS_Face& face,const Standard_Real p1,const Standard_Real p2) const
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom2d_Curve)& pcurve,const TopoDS_Face& face,const Standard_Real p1,const Standard_Real p2) const
|
||||
{
|
||||
TopLoc_Location L;
|
||||
const Handle(Geom_Surface)& S = BRep_Tool::Surface(face, L);
|
||||
@ -700,7 +710,7 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom2d_Curve)& pcurve,
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom2d_Curve)& pcurve,
|
||||
const Handle(Geom_Surface)& S,const TopLoc_Location& L) const
|
||||
{
|
||||
MakeEdge(edge, pcurve, S, L, pcurve->FirstParameter(), pcurve->LastParameter());
|
||||
@ -711,7 +721,7 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom2d_Curve)& pcurve,
|
||||
void ShapeBuild_Edge::MakeEdge(TopoDS_Edge& edge,const Handle(Geom2d_Curve)& pcurve,
|
||||
const Handle(Geom_Surface)& S,const TopLoc_Location& L,
|
||||
const Standard_Real p1,const Standard_Real p2) const
|
||||
{
|
||||
|
19
tests/bugs/heal/bug25068
Executable file
19
tests/bugs/heal/bug25068
Executable file
@ -0,0 +1,19 @@
|
||||
puts "============"
|
||||
puts "OCC25068"
|
||||
puts "============"
|
||||
puts ""
|
||||
###################################################
|
||||
## ShapeAnalysis_FreeBounds::ConnectEdgesToWires returns wires with not valid Closed flag
|
||||
###################################################
|
||||
|
||||
restore [locate_data_file bug24807_Compound.brep] a
|
||||
connectedges r a 1.e-7 0
|
||||
explode r
|
||||
|
||||
set info [whatis r_1]
|
||||
|
||||
if { [regexp "Closed" ${info}] == 1 } {
|
||||
puts "Error: Closed flag is not valid"
|
||||
} else {
|
||||
puts "OK: Closed flag is valid"
|
||||
}
|
@ -2,7 +2,7 @@ if {[string compare $command "ShapeConvertRev"] == 0 } {
|
||||
puts "TODO OCC23127 ALL: Error : The resulting shape is not correct"
|
||||
}
|
||||
if {[string compare $command "SplitAngle"] == 0 } {
|
||||
puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_9 "
|
||||
puts "TODO OCC23127 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
puts "TODO ?DEBUG_OCC24121 Debian60-64 Windows: Error: Exception in ShapeUpgrade_FaceDivide"
|
||||
}
|
||||
restore [locate_data_file CTO900_ger60598c.rle] a
|
||||
|
Loading…
x
Reference in New Issue
Block a user