mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0025202: Incorrect value of IsClosed flag in shapes produced by some algorithms
Method BRep_Tool::IsClosed() extended to analyze closure of wires in addition to shells and solids. External and Internal edges and vertices are ignored in this check. Analysis of compounds is disabled. Update of flag Closed according to actual state is added in most places where new shells are constructed. Draw-command and test case for issue CR25202
This commit is contained in:
@@ -96,7 +96,10 @@ ShapeUpgrade_FaceDivideArea::ShapeUpgrade_FaceDivideArea(const TopoDS_Face& F)
|
||||
aB.Add(aCopyRes,aFace);
|
||||
}
|
||||
if(isModified)
|
||||
{
|
||||
aCopyRes.Closed (BRep_Tool::IsClosed (aCopyRes));
|
||||
Context()->Replace(aResult,aCopyRes);
|
||||
}
|
||||
myStatus |= aStatus;
|
||||
myResult = Context()->Apply ( aResult );
|
||||
return Status ( ShapeExtend_DONE );
|
||||
|
@@ -190,11 +190,9 @@ Standard_Boolean ShapeUpgrade_RemoveLocations::MakeNewShape(const TopoDS_Shape&
|
||||
aNewShape.Location(aL);
|
||||
}
|
||||
if(shtype != TopAbs_EDGE) {
|
||||
|
||||
theNewShape = aNewShape;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -251,8 +249,12 @@ Standard_Boolean ShapeUpgrade_RemoveLocations::MakeNewShape(const TopoDS_Shape&
|
||||
//Removing location from sub-shapes in dependance of LevelRemoving and re-building shape.
|
||||
|
||||
if(!isBound) {
|
||||
if(!aRebuild)
|
||||
aNewShape = theShape.EmptyCopied();
|
||||
if(!aRebuild)
|
||||
{
|
||||
aNewShape = theShape.EmptyCopied();
|
||||
// it is safe to simply copy Closed flag since this operation does not change topology
|
||||
aNewShape.Closed (theShape.Closed());
|
||||
}
|
||||
TopLoc_Location oldLoc,nullloc;
|
||||
oldLoc = theShape.Location();
|
||||
if(!oldLoc.IsIdentity())
|
||||
@@ -266,19 +268,18 @@ Standard_Boolean ShapeUpgrade_RemoveLocations::MakeNewShape(const TopoDS_Shape&
|
||||
Standard_Boolean isDoneSubShape = MakeNewShape(subshape,anAncShape,anewsubshape,isRemoveLoc);
|
||||
isDone = (isDone || isDoneSubShape);
|
||||
aB.Add(aNewShape,anewsubshape);
|
||||
|
||||
}
|
||||
if(isDone)
|
||||
aNewShape.Orientation(orient);
|
||||
else aNewShape = aShape;
|
||||
else
|
||||
aNewShape = aShape;
|
||||
myMapNewShapes.Bind(aShape,aNewShape);
|
||||
if(!theRemoveLoc && !oldLoc.IsIdentity())
|
||||
aNewShape.Location(oldLoc);
|
||||
|
||||
}
|
||||
theNewShape = aNewShape;
|
||||
|
||||
|
||||
|
||||
return (isDone || isBound);
|
||||
}
|
||||
|
||||
|
@@ -708,21 +708,6 @@ static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges,
|
||||
cout<<"can not make analitical union => make approximation"<<endl;
|
||||
#endif
|
||||
TopoDS_Edge E = GlueEdgesWithPCurves(aChain, VF, VL);
|
||||
/*
|
||||
TopoDS_Wire W;
|
||||
B.MakeWire(W);
|
||||
for(j=1; j<=aChain.Length(); j++) {
|
||||
TopoDS_Edge edge = TopoDS::Edge(aChain.Value(j));
|
||||
B.Add(W,edge);
|
||||
}
|
||||
Handle(BRepAdaptor_HCompCurve) Adapt = new BRepAdaptor_HCompCurve(W);
|
||||
Approx_Curve3d Conv(Adapt,Tol,GeomAbs_C1,9,1000);
|
||||
Handle(Geom_BSplineCurve) bc = Conv.Curve();
|
||||
TopoDS_Edge E;
|
||||
B.MakeEdge (E,bc,Precision::Confusion());
|
||||
B.Add (E,VF);
|
||||
B.Add (E,VL);
|
||||
*/
|
||||
aChain.SetValue(1,E);
|
||||
}
|
||||
else {
|
||||
@@ -936,10 +921,9 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
||||
} while (isNewFound);
|
||||
|
||||
// sorting any type of edges
|
||||
//aWire = TopoDS::Wire(aContext->Apply(aWire));
|
||||
aWire.Closed (BRep_Tool::IsClosed (aWire));
|
||||
aWire = TopoDS::Wire(myContext->Apply(aWire));
|
||||
|
||||
//TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
|
||||
TopoDS_Face tmpF = TopoDS::Face(myContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
|
||||
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
|
||||
sfw->FixReorder();
|
||||
@@ -1021,6 +1005,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
||||
TopoDS_Wire aW;
|
||||
B.MakeWire(aW);
|
||||
B.Add(aW,E);
|
||||
aW.Closed (Standard_True);
|
||||
B.Add(aResult,aW);
|
||||
}
|
||||
}
|
||||
@@ -1091,6 +1076,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
|
||||
B.MakeShell ( S );
|
||||
for ( i=1; i <= parts.Length(); i++ )
|
||||
B.Add ( S, parts(i) );
|
||||
S.Closed (BRep_Tool::IsClosed (S));
|
||||
CompRes = S;
|
||||
}
|
||||
else CompRes = parts(1);
|
||||
|
@@ -714,13 +714,17 @@ void ShapeUpgrade_WireDivide::Perform ()
|
||||
V1 = V;
|
||||
}
|
||||
if(numE)
|
||||
{
|
||||
resWire.Closed (BRep_Tool::IsClosed (resWire));
|
||||
Context()->Replace(E,resWire);
|
||||
}
|
||||
else
|
||||
Context()->Remove(E);
|
||||
}
|
||||
}
|
||||
if ( Status ( ShapeExtend_DONE ) ) {
|
||||
//smh#8
|
||||
newWire.Closed (BRep_Tool::IsClosed (newWire));
|
||||
TopoDS_Shape tmpW = Context()->Apply ( newWire ).Oriented(myWire.Orientation());
|
||||
myWire = TopoDS::Wire (tmpW );
|
||||
}
|
||||
|
Reference in New Issue
Block a user