]> OCCT Git - occt-copy.git/commitdiff
0025202: Incorrect value of IsClosed flag in shapes produced by some algorithms
authorabv <abv@opencascade.com>
Wed, 8 Oct 2014 14:52:07 +0000 (18:52 +0400)
committerbugmaster <bugmaster@opencascade.com>
Fri, 10 Oct 2014 12:28:36 +0000 (16:28 +0400)
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

53 files changed:
src/AIS/AIS_ColoredShape.cxx
src/BOPAlgo/BOPAlgo_BuilderSolid.cxx
src/BOPAlgo/BOPAlgo_Builder_3.cxx
src/BOPAlgo/BOPAlgo_ShellSplitter.cxx
src/BRep/BRep_Tool.cdl
src/BRep/BRep_Tool.cxx
src/BRepAlgo/BRepAlgo_Loop.cxx
src/BRepCheck/BRepCheck_Shell.cxx
src/BRepFeat/BRepFeat_MakeLinearForm.cxx
src/BRepFeat/BRepFeat_MakeRevolutionForm.cxx
src/BRepFeat/BRepFeat_RibSlot.cxx
src/BRepFill/BRepFill.cxx
src/BRepFill/BRepFill_Draft.cxx
src/BRepFill/BRepFill_Generator.cxx
src/BRepFill/BRepFill_Pipe.cxx
src/BRepFill/BRepFill_TrimShellCorner.cxx
src/BRepLib/BRepLib_MakeShell.cxx
src/BRepLib/BRepLib_MakeSolid.cxx
src/BRepPrim/BRepPrim_GWedge.cxx
src/BRepPrim/BRepPrim_OneAxis.cxx
src/BRepSweep/BRepSweep_NumLinearRegularSweep.cxx
src/BRepTest/BRepTest_FeatureCommands.cxx
src/BRepTools/BRepTools_ReShape.cxx
src/DBRep/DBRep.cxx
src/LocOpe/LocOpe_BuildShape.cxx
src/LocOpe/LocOpe_SplitShape.cxx
src/QABugs/QABugs_13.cxx
src/QABugs/QABugs_14.cxx
src/QABugs/QABugs_19.cxx
src/QABugs/QABugs_3.cxx
src/ShapeBuild/ShapeBuild_ReShape.cxx
src/ShapeFix/ShapeFix_FaceConnect.cxx
src/ShapeFix/ShapeFix_Shell.cxx
src/ShapeProcess/ShapeProcess_ShapeContext.cxx
src/ShapeUpgrade/ShapeUpgrade_FaceDivideArea.cxx
src/ShapeUpgrade/ShapeUpgrade_RemoveLocations.cxx
src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx
src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx
src/StepToTopoDS/StepToTopoDS_Builder.cxx
src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx
src/StepToTopoDS/StepToTopoDS_TranslatePolyLoop.cxx
src/StepToTopoDS/StepToTopoDS_TranslateShell.cxx
src/StepToTopoDS/StepToTopoDS_TranslateVertexLoop.cxx
src/TNaming/TNaming_Name.cxx
src/TestTopOpe/TestTopOpe_OtherCommands.cxx
src/TopOpeBRep/TopOpeBRep_ShapeIntersector.cxx
src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1_2.cxx
src/XCAFPrs/XCAFPrs.cxx
src/XSControl/XSControl_Utils.cxx
tests/bugs/moddata_3/bug25202_1 [new file with mode: 0755]
tests/bugs/moddata_3/bug25202_2 [new file with mode: 0755]
tests/bugs/moddata_3/bug25202_3 [new file with mode: 0755]
tests/bugs/moddata_3/bug25202_4 [new file with mode: 0755]

index d6784a74b690a424c5f0c38f0ac97b566bbfcefe..84e8afd594bc8544e5aee669086f8607af398088 100644 (file)
@@ -369,6 +369,7 @@ Standard_Boolean AIS_ColoredShape::dispatchColors (const TopoDS_Shape&        th
   // iterate on sub-shapes
   BRep_Builder aBBuilder;
   TopoDS_Shape aShapeCopy = theSubshapeToParse.EmptyCopied();
+  aShapeCopy.Closed (theSubshapeToParse.Closed());
   Standard_Boolean isSubOverride = Standard_False;
   Standard_Integer nbDef = 0;
   for (TopoDS_Iterator it (theSubshapeToParse); it.More(); it.Next())
index c285298a93297bb9c381f7274101148bfe214e65..42b079a7849f389388e35b60025b616d209cfedb 100644 (file)
@@ -559,6 +559,7 @@ void BOPAlgo_BuilderSolid::PerformLoops()
         }
       }
     }
+    aShell.Closed (BRep_Tool::IsClosed (aShell));
     myLoopsInternal.Append(aShell);
   }
 }
@@ -1018,6 +1019,7 @@ void MakeInternalShells(const BOPCol_MapOfShape& theMF,
         }
       }
     }
+    aShell.Closed (BRep_Tool::IsClosed (aShell));
     theShells.Append(aShell);
   }
 }
index d729ef8222b490ed2e7d05569b82adb6c64ebe2e..decfb308d9f50f118c6c3f4040045b59707c4f21 100644 (file)
@@ -475,6 +475,7 @@ void BOPAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
     } //for (; aIt2.More(); aIt2.Next()) {
     //
     if (iFlag) {
+      aShD.Closed (BRep_Tool::IsClosed (aShD));
       aBB.Add(theDraftSolid, aShD);
     }
   } //for (; aIt1.More(); aIt1.Next()) {
index b1b8a3b1b76f7edca99a1cbab607c331406b161f..a27392f55d23056d9d8b738be6c6b40dd877166d 100644 (file)
@@ -38,9 +38,6 @@
 #include <BOPTools_AlgoTools.hxx>
 #include <BOPTools_CoupleOfShape.hxx>
 
-//
-static
-  Standard_Boolean IsClosedShell(const TopoDS_Shell& );
 //
 static
   void MakeShell(const BOPCol_ListOfShape& , 
@@ -444,12 +441,14 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
       } // for (; aExp.More(); aExp.Next()) {
     } // for (; aItS.More(); aItS.Next()) {
     //
-    if (IsClosedShell(aShell)) {
+    if (BRep_Tool::IsClosed(aShell)) {
+      aShell.Closed (Standard_True);
       myLoops.Append(aShell);
     }
     else {
       RefineShell(aShell);
-      if (IsClosedShell(aShell)) {
+      if (BRep_Tool::IsClosed(aShell)) {
+        aShell.Closed (Standard_True);
         myLoops.Append(aShell);
       }
     }
@@ -556,48 +555,7 @@ void RefineShell(TopoDS_Shell& theShell)
     aBB.Remove(theShell, aFB);
   }
 }
-//=======================================================================
-//function : IsClosedShell
-//purpose  : 
-//=======================================================================
-Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell)
-{
-  Standard_Integer i, aNbE;
-  Standard_Boolean bRet;
-  TopoDS_Iterator aIt;
-  TopExp_Explorer aExp;
-  BOPCol_MapOfShape aM;
-  // 
-  bRet=Standard_False;
-  //
-  aIt.Initialize(theShell);
-  for(i=0; aIt.More(); aIt.Next(), ++i) {
-    const TopoDS_Shape& aF=aIt.Value();
-    //
-    aExp.Init(aF, TopAbs_EDGE);
-    for (; aExp.More(); aExp.Next()) {
-      const TopoDS_Edge& aE=(*(TopoDS_Edge*)(&aExp.Current()));
-      if (BRep_Tool::Degenerated(aE)) {
-        continue;
-      }
-      //
-      if (aE.Orientation()==TopAbs_INTERNAL) {
-        continue;
-      }
-      if (!aM.Add(aE)) {
-        aM.Remove(aE);
-      }
-    }
-  }
-  //
-  if(i) {
-    aNbE=aM.Extent();
-    if (!aNbE) {
-      bRet=!bRet; 
-    }
-  }
-  return bRet;
-}
+
 //=======================================================================
 //function : MakeShells
 //purpose  : 
@@ -622,7 +580,7 @@ void BOPAlgo_ShellSplitter::MakeShells()
       //
       const BOPCol_ListOfShape& aLF=aCB.Shapes();
       MakeShell(aLF, aShell);
-      aShell.TShape()->Closed(Standard_True);
+      aShell.Closed(Standard_True);
       myShells.Append(aShell);
     }
     else {
@@ -641,8 +599,8 @@ void BOPAlgo_ShellSplitter::MakeShells()
     const BOPCol_ListOfShape& aLS=aCB.Loops();
     aIt.Initialize(aLS);
     for (; aIt.More(); aIt.Next()) {
-      const TopoDS_Shape& aShell=aIt.Value();
-      aShell.TShape()->Closed(Standard_True);
+      TopoDS_Shape& aShell=aIt.ChangeValue();
+      aShell.Closed(Standard_True);
       myShells.Append(aShell);
     }
   }
index 3e7de745ce3d5e0175cff89fe919b07ef846058f..84c6c8170476288bd40dbb1eb788bc91aee64a22 100644 (file)
@@ -53,10 +53,10 @@ is
     -----------------------------------------------------------
     -----------------------------------------------------------
     IsClosed (myclass; S : Shape from TopoDS) returns Boolean from Standard;
-    
-       ---Purpose: Returns <True>  if S if flaged Closed, if S is a
-       --          Solid,Shell or Compound  returns <True> is S has no free boundaries.
-
+       ---Purpose: If S is Solid or Shell, returns True if it has no free boundaries (edges).
+               --          If S is Wire, returns True if it has no free ends (vertices).
+               --          (Internal and External sub-shepes are ignored in this check.)
+               --          For other shape types returns S.Closed().
        
     -----------------------------------------------------------
     -----------------------------------------------------------
@@ -603,7 +603,5 @@ is
     raises
        NullObject from Standard;
 
-    
-
 end Tool;
 
index ac3875e8b71aaf21974a2e7586726e0687b803d6..f025a1740759b32ff9a9823fb0a17f5919d03bca 100644 (file)
@@ -32,6 +32,7 @@
 #include <BRep_PolygonOnClosedTriangulation.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Iterator.hxx>
+#include <TopoDS_Wire.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopExp.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <Poly_Polygon2D.hxx>
 #include <Poly_PolygonOnTriangulation.hxx>
 
+#include <NCollection_Map.hxx>
+#include <NCollection_IncAllocator.hxx>
+#include <TopTools_ShapeMapHasher.hxx>
+
 //modified by NIZNHY-PKV Fri Oct 17 14:13:29 2008f
 static 
   Standard_Boolean IsPlane(const Handle(Geom_Surface)& aS);
@@ -1446,24 +1451,37 @@ gp_Pnt2d  BRep_Tool::Parameters(const TopoDS_Vertex& V,
 }
 //=======================================================================
 //function : IsClosed
-//purpose  : Returns <True>  if S if flaged Closed, if S is a
-//           Solid,Shell or Compound  returns <True> is S has no free boundaries.
+//purpose  : 
 //=======================================================================
-Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Shape& S)
+Standard_Boolean BRep_Tool::IsClosed (const TopoDS_Shape& theShape)
 {
-  if (S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_SOLID ||
-      S.ShapeType() == TopAbs_COMPOUND) {
-    TopTools_MapOfShape M;
-    TopExp_Explorer exp;
-    for (exp.Init(S,TopAbs_EDGE); exp.More(); exp.Next()) {
-//    for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
+  if (theShape.ShapeType() == TopAbs_SHELL || theShape.ShapeType() == TopAbs_SOLID)
+  {
+    NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> aMap (101, new NCollection_IncAllocator);
+    for (TopExp_Explorer exp (theShape, TopAbs_EDGE); exp.More(); exp.Next())
+    {
       const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
-      if (BRep_Tool::Degenerated(E)) continue;
-      if (!M.Add(E)) M.Remove(E);
+      if (BRep_Tool::Degenerated(E) || E.Orientation() == TopAbs_INTERNAL || E.Orientation() == TopAbs_EXTERNAL)
+        continue;
+      if (!aMap.Add(E))
+        aMap.Remove(E);
     }
-    if ( M.IsEmpty()) return 1;
+    return aMap.IsEmpty();
   }
-  return (S.Closed());
+  else if (theShape.ShapeType() == TopAbs_WIRE)
+  {
+    NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> aMap (101, new NCollection_IncAllocator);
+    for (TopExp_Explorer exp (theShape, TopAbs_VERTEX); exp.More(); exp.Next())
+    {
+      const TopoDS_Shape& V = exp.Current();
+      if (V.Orientation() == TopAbs_INTERNAL || V.Orientation() == TopAbs_EXTERNAL)
+        continue;
+      if (!aMap.Add(V))
+        aMap.Remove(V);
+    }
+    return aMap.IsEmpty();
+  }
+  return theShape.Closed();
 }
 
 //modified by NIZNHY-PKV Fri Oct 17 14:09:58 2008 f 
@@ -1495,3 +1513,4 @@ Standard_Boolean IsPlane(const Handle(Geom_Surface)& aS)
   //
   return bRet;
 }
+
index 5eee8790365590e89fd169fd74208ff28bd94f54..187d7a8eeb36e38e9b963ba04b8cbfdbc39f2f26 100644 (file)
@@ -658,7 +658,10 @@ void BRepAlgo_Loop::Perform()
       }
 
     if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
+    {
+      NW.Closed (Standard_True);
       myNewWires.Append (NW);
+    }
 #ifdef DEBUG_ALGO
     else {
       cout <<"BRepAlgo_Loop: Open Wire"<<endl;
index 83668638a245820a415bb6ca972b8a55ee8ad97d..f69548167cdc6bb00de84517dd54dfa14079b481 100644 (file)
@@ -919,10 +919,11 @@ Standard_Integer BRepCheck_Shell::NbConnectedSet(TopTools_ListOfShape& theSets)
            }
          }
          if (!newCur) {
-          theSets.Append(CurShell);
-          CurShell.Nullify();
-          newCur=Standard_True;
-          BRB.MakeShell(CurShell);
+            CurShell.Closed (BRep_Tool::IsClosed (CurShell));
+            theSets.Append(CurShell);
+            CurShell.Nullify();
+            newCur=Standard_True;
+            BRB.MakeShell(CurShell);
          }
        }
        if (theFaces.IsEmpty()) break;
index 97968c2a36547caeb8cd551cea65699d4d0151c8..a9366b8480dbe92cce423b5c4690b2dc33fb5a82 100644 (file)
@@ -707,6 +707,7 @@ void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
   if(Sliding) {
     TopoDS_Face F;
     BB.MakeFace(F, myPln, myTol);
+    w.Closed (BRep_Tool::IsClosed (w));
     BB.Add(F, w);
 //    BRepLib_MakeFace F(myPln->Pln(),w, Standard_True);
     mySkface = F;
@@ -768,6 +769,7 @@ void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
     for(; it.More(); it.Next()) {
       BB.Add(comp, it.Value());
     }
+    comp.Closed (BRep_Tool::IsClosed (comp));
     
     mySUntil = comp;
 
index 5d14b7090bacb582f2e2af8b74745901a3fc054b..bee84acf156bb8baec0a57d207fc6953b0a530e4 100644 (file)
@@ -831,6 +831,7 @@ void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
   if(Sliding) {
     TopoDS_Face F;
     BB.MakeFace(F, myPln, myTol);
+    w.Closed (BRep_Tool::IsClosed (w));
     BB.Add(F, w);
     mySkface = F;
     myPbase  = mySkface;
@@ -914,6 +915,7 @@ void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
        break;
       } 
     }
+    Wiwiwi.Closed (BRep_Tool::IsClosed (Wiwiwi));
     
     BRepLib_MakeFace newbndface(myPln->Pln(), Wiwiwi, Standard_True);
     TopoDS_Face NewBndFace = TopoDS::Face(newbndface.Shape());
@@ -993,6 +995,7 @@ void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
     for(; it.More(); it.Next()) {
       BB.Add(comp, it.Value());
     }
+    comp.Closed (BRep_Tool::IsClosed (comp));
     
     mySUntil = comp;
    
index e40320a8d3c96725b6352392db2953625094d48d..5d8609cd6f0cb570d394204f7c17a14a32497e3a 100644 (file)
@@ -2297,6 +2297,7 @@ Standard_Boolean BRepFeat_RibSlot::NoSlidingProfile(TopoDS_Face& Prof,
     BB.Add(w, e);
   }
   
+  w.Closed (BRep_Tool::IsClosed (w));
   BRepLib_MakeFace fa(myPln->Pln(), w, Standard_True);
   TopoDS_Face fac = TopoDS::Face(fa.Shape());
   
index 95feb61426a59007e9ee43a00add42dfa948f70c..e3055c9cf591217861db52148eca6a4ef48a75ec 100644 (file)
@@ -122,6 +122,7 @@ static void MakeWire(const TopTools_Array1OfShape& Edges,
     }
   }
   newwire.Orientation(TopAbs_FORWARD);
+  newwire.Closed (Standard_True);
 }
 
 static void CutEdge(const TopoDS_Edge&    CurrentEdge,
@@ -349,6 +350,7 @@ TopoDS_Face BRepFill::Face(const TopoDS_Edge& Edge1,
   B.Add(W,Edge4);
   B.Add(W,Edge2.Reversed());
   B.Add(W,Edge3);
+  W.Closed (Standard_True);
 
   B.Add(Face,W);
 
@@ -562,6 +564,7 @@ TopoDS_Shell BRepFill::Shell(const TopoDS_Wire& Wire1,
     B.Add(W,Edge4);
     B.Add(W,Edge2.Reversed());
     B.Add(W,Edge3);
+    W.Closed (Standard_True);
     
     B.Add(Face,W);
     
@@ -617,6 +620,7 @@ TopoDS_Shell BRepFill::Shell(const TopoDS_Wire& Wire1,
     B.SameRange(Edge4,Standard_False);
   }
   
+  Shell.Closed (BRep_Tool::IsClosed (Shell));
   BRepLib::SameParameter(Shell);
   return Shell;
 }
index a0a0ee855a6eebed4e25d8d838aa95396a080841..35a90d4e9be5cf943451f42edd28755205326e99 100644 (file)
@@ -616,6 +616,7 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B,
       TopoDS_Shell S;
       B.MakeShell(S);
       B.Add(S, StopShape);
+      S.Closed (BRep_Tool::IsClosed (S));
       B.MakeSolid(Sol2);
       B.Add(Sol2, S); // shell => solid (for fusion)
       break;
index 0ddbfd5ba3fa81928675bd8d492b0c470c63d7b5..e919b39b524bf8b8046d079d03f247d3a9661120 100644 (file)
@@ -381,14 +381,10 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
   }
 
   // create the new surface
-  TopoDS_Shell shell;
   TopoDS_Face face;
   TopoDS_Wire W;
   TopoDS_Edge edge1, edge2, edge3, edge4, couture;
 
-  BRep_Builder B;
-  B.MakeShell(shell);
-
   TopoDS_Wire newW1, newW2;
   BRep_Builder BW1, BW2;
   BW1.MakeWire(newW1);
index 8d8e5eef89afb3b32383bdffa7d25979d02ede7a..0cd81f3d6fcb33c89c65a4840f33a773283b8182 100644 (file)
@@ -589,6 +589,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
        W.Closed(LastShape.Closed());
        TheLast = W;
       }
+      result.Closed (BRep_Tool::IsClosed (result));
       break;
     }
          
@@ -603,6 +604,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
       if ( !mySpine.Closed() && !TheFirst.IsNull()) {
         B.Add(result, TheFirst.Reversed());
       }
+      result.Closed (BRep_Tool::IsClosed (result));
       break;
     }
 
index 23cb58149bdd682e2ad913b644608cbce7336b7e..716ae2a7bbb359e13aef1121e93ff1a764b2feac 100644 (file)
@@ -285,6 +285,7 @@ void BRepFill_TrimShellCorner::Perform()
     for(ii = myFaces->LowerRow(); ii <= myFaces->UpperRow(); ii++) {
       aBB.Add(aShell, myFaces->Value(ii, jj));
     }
+    aShell.Closed (BRep_Tool::IsClosed (aShell));
 
     if(jj == myFaces->LowerCol()) {
       myShape1 = aShell;
index c1a9dc8d40cf7efd648c70aa9f4d5af2d5936f4b..446f887b1d085b0d33f1466d113e7f835087a35f 100644 (file)
@@ -353,6 +353,7 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S,
   // codage des courbes 3d et regularites.
   BRepLib::BuildCurves3d(myShape,tol);
   BRepLib::EncodeRegularity(myShape);
+  myShape.Closed (BRep_Tool::IsClosed (myShape));
   
   myError = BRepLib_ShellDone;
   Done();
index abbd9d72cf5b60a844a5bf90a369de431a892c92..6d1f6c908c2e21d353f760d6eb5922589c02f52f 100644 (file)
@@ -63,6 +63,7 @@ BRepLib_MakeSolid::BRepLib_MakeSolid(const TopoDS_CompSolid& S)
   for(; aFaceIter.More(); aFaceIter.Next()) {
     B.Add(aShell, aFaceIter.Key());
   }
+  aShell.Closed (BRep_Tool::IsClosed (aShell));
 
   B.Add(myShape,aShell);
 
index f4ced3893a1ba011f327cad0b6e7e7fefdd38db6..1b8762a1251de01942a7e29927542e4840f97eea 100644 (file)
@@ -318,6 +318,7 @@ const TopoDS_Shell& BRepPrim_GWedge::Shell() {
     if (HasFace(BRepPrim_ZMax))
       myBuilder.AddShellFace(myShell,Face(BRepPrim_ZMax));
 
+    myShell.Closed (BRep_Tool::IsClosed (myShell));
     myBuilder.CompleteShell(myShell);
     ShellBuilt = Standard_True;
   }
index b7bace22a4bb87a977ef5c1a03b80c6401228182..596dc949dec23ebde6b0eb64cc7b643bc9e7f568 100644 (file)
@@ -291,6 +291,7 @@ const TopoDS_Shell& BRepPrim_OneAxis::Shell()
       myBuilder.AddShellFace(myShell,EndFace());
     }
 
+    myShell.Closed (BRep_Tool::IsClosed (myShell));
     myBuilder.CompleteShell(myShell);
     ShellBuilt = Standard_True;
   }
index 8b4566f478b45a06e834cdff8be3d2c119e30eca..21c5c3048958fec50288a2448ffcc3dc5d883e1b 100644 (file)
@@ -337,6 +337,7 @@ TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS,
        SetContinuity(aGenS,aDirS);
       }        
       if (aGenSType==TopAbs_FACE){
+        newShell.Closed (BRep_Tool::IsClosed (newShell));
        TopoDS_Shape temp = SplitShell(newShell);
        TopAbs_Orientation Or = DirectSolid(aGenS,aDirS);
        Lt.Init(temp);
@@ -392,6 +393,7 @@ TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS,
     }
     myBuiltShapes(iGenS,iDirS) = Standard_True;
   }
+  myShapes(iGenS,iDirS).Closed (BRep_Tool::IsClosed (myShapes(iGenS,iDirS)));
   return myShapes(iGenS,iDirS);
 }
 
index c4df4eb29707bcf19361a86f11c9ba9b07bc8c1c..97acc216d067368dece91cdadfaa99e3442876ae 100644 (file)
@@ -433,6 +433,7 @@ static Standard_Integer PRW(Draw_Interpretor& theCommands,
     for (it.Initialize(lleft);it.More();it.Next()) {
       B.Add(Sh,TopoDS::Face(it.Value()));
     }
+    Sh.Closed (BRep_Tool::IsClosed (Sh));
     thePFace.Init(S,Sh,F,V,fuse,Standard_True);
     ToPrism = Sh;
   }
@@ -590,6 +591,7 @@ static Standard_Integer PRF(Draw_Interpretor& theCommands,
        B.Add(She,F);
       }
     }
+    She.Closed (BRep_Tool::IsClosed (She));
     thePFace.Init(S,She,TopoDS_Face(),V,fuse,Standard_False);
     ToPrism = She;
   }
@@ -1197,6 +1199,7 @@ static Standard_Integer ROW(Draw_Interpretor& theCommands,
     for (it.Initialize(lleft);it.More();it.Next()) {
       B.Add(Sh,TopoDS::Face(it.Value()));
     }
+    Sh.Closed (BRep_Tool::IsClosed (Sh));
     theRFace.Init(S,Sh,F,theAxis,fuse,Standard_True);
     ToRotate = Sh;
   }
@@ -1341,6 +1344,7 @@ static Standard_Integer ROF(Draw_Interpretor& theCommands,
        B.Add(She,F);
       }
     }
+    She.Closed (BRep_Tool::IsClosed (She));
     theRFace.Init(S,She,TopoDS_Face(),theAxis,fuse,Standard_False);
     ToRotate = She;
   }
index a21b745eccfabe61eaca4a381e5c052a5edaea1d..4e17db8896f29c4daa144bd11d517daa1df8bc1d 100644 (file)
@@ -371,9 +371,14 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
        B.Add (S,newsh);
       }
     }
+
     if ( (modif < 0 && buildmode < 2) || (modif == 0 && buildmode < 1) )
       return C;
-    else return S;
+    else
+    {
+      S.Closed (BRep_Tool::IsClosed (S));
+      return S;
+    }
   }
 
   if (st == TopAbs_SHELL) {
@@ -406,7 +411,11 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
     }
     if ( (modif < 0 && buildmode < 2) || (modif == 0 && buildmode < 1) )
       return C;
-    else return S;
+    else
+    {
+      S.Closed (BRep_Tool::IsClosed (S));
+      return S;
+    }
   }
   cout<<"BRepTools_ReShape::Apply NOT YET IMPLEMENTED"<<endl;
   return shape;
@@ -543,8 +552,10 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
   }
 
   result.Orientation(orien);
+  result.Closed (BRep_Tool::IsClosed (result));
   myStatus = locStatus;
   Replace ( shape, result );
+
   return result;
 }
 
index b89e2bd417d170478f9fb542bb66dc39fd99f519..ea104a6ce8d56d21fe4348b2a96c2ef8f02921bb 100644 (file)
@@ -688,8 +688,9 @@ static Standard_Integer invert(Draw_Interpretor& ,
   
   BRep_Builder B;
   TopoDS_Shape NS = S.EmptyCopied();
-  TopoDS_Iterator itr(S);
+  NS.Closed (S.Closed());
 
+  TopoDS_Iterator itr(S);
   while (itr.More()) {
     B.Add(NS,itr.Value().Reversed());
     itr.Next();
index 5fa3133b622317adf05d0bdd5c568930b547460d..51e2f193be3d592157c3443a0084fb1cbd44a01e 100644 (file)
@@ -150,6 +150,7 @@ void LocOpe_BuildShape::Perform(const TopTools_ListOfShape& L)
        B.Add(newSh,FaceRef);
        Propagate(FaceRef,newSh,mapF,mapIf);
       }
+      newSh.Closed (BRep_Tool::IsClosed (newSh));
       if (!Manifold) {
        lshell.Append(newSh.Oriented(TopAbs_INTERNAL));
       }
index 29045e0b4c6d155461ed5707db36c03cba25cb16..9782bca94a17aaa591c7a3bdd4bde927c4d120b9 100644 (file)
@@ -1233,6 +1233,7 @@ Standard_Boolean LocOpe_SplitShape::Rebuild(const TopoDS_Shape& S)
         B.Add(result,itr.Value().Oriented(orient));
       }
     }
+    result.Closed (BRep_Tool::IsClosed(result));
     myMap(S).Append(result);
   }
   else {
index 9ac2e8892cc9a21711d03468226b3e10c2582949..312f2524722ef41818c48a8d012e88ef06c031c0 100644 (file)
@@ -301,6 +301,7 @@ static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc,
 
   B.Add(TubeShell,Face1.Reversed());
   B.Add(TubeShell,Face2);
+  TubeShell.Closed (BRep_Tool::IsClosed (TubeShell));
 
   B.MakeSolid(wallSolid);
   B.Add(wallSolid,TubeShell);
index e2c8d32513be3d83f2a3e32afddd7f36abc0f1dc..47683f576c106d788d6ed5e28ac5440f74f06fe0 100644 (file)
@@ -260,6 +260,7 @@ static Standard_Integer BUC60854 (Draw_Interpretor& /*di*/, Standard_Integer arg
   BB.MakeShell(TopoDS::Shell(aShell));
   TopTools_ListIteratorOfListOfShape anIter(aLeftPart);
   for(; anIter.More(); anIter.Next()) BB.Add(aShell, anIter.Value());
+  aShell.Closed (BRep_Tool::IsClosed (aShell));
   DBRep::Set(argv[1],aShell);
   return 0;
 }
index f324843d597b9cbbbe4765a51493257b3cea7719..54aa72baef12e71a9c293b0e8d9798f26201cf4c 100755 (executable)
@@ -2778,6 +2778,89 @@ static Standard_Integer OCC23010 (Draw_Interpretor& di, Standard_Integer argc, c
   return 0;
 }
 
+//=======================================================================
+//function : OCC25202
+//purpose  :
+//=======================================================================
+#include <ShapeBuild_ReShape.hxx>
+static Standard_Integer OCC25202 ( Draw_Interpretor& theDI,
+                                  Standard_Integer theArgN,
+                                  const char** theArgVal)
+{
+  //  0      1    2     3     4     5     6 
+  //reshape res shape numF1 face1 numF2 face2
+  if(theArgN < 7)
+    {
+      theDI << "Use: reshape res shape numF1 face1 numF2 face2\n";
+      return 1;
+    }
+
+  TopoDS_Shape aShape = DBRep::Get(theArgVal[2]);
+  const Standard_Integer  aNumOfRE1 = Draw::Atoi(theArgVal[3]),
+                          aNumOfRE2 = Draw::Atoi(theArgVal[5]);
+  TopoDS_Face aShapeForRepl1 = TopoDS::Face(DBRep::Get(theArgVal[4])),
+              aShapeForRepl2 = TopoDS::Face(DBRep::Get(theArgVal[6]));
+
+  if(aShape.IsNull())
+  {
+    theDI << theArgVal[2] << " is null shape\n";
+    return 1;
+  }
+
+  if(aShapeForRepl1.IsNull())
+  {
+    theDI << theArgVal[4] << " is not a replaced type\n";
+    return 1;
+  }
+
+  if(aShapeForRepl2.IsNull())
+  {
+    theDI << theArgVal[6] << " is not a replaced type\n";
+    return 1;
+  }
+
+
+  TopoDS_Shape aReplacedShape;
+  ShapeBuild_ReShape aReshape;
+
+  //////////////////// explode (begin)
+  TopTools_MapOfShape M;
+  M.Add(aShape);
+  Standard_Integer aNbShapes = 0;
+  for (TopExp_Explorer ex(aShape,TopAbs_FACE); ex.More(); ex.Next())
+    {
+      const TopoDS_Shape& Sx = ex.Current();
+      Standard_Boolean added = M.Add(Sx);
+      if (added)
+       {
+         aNbShapes++;
+         if(aNbShapes == aNumOfRE1)
+           {
+             aReplacedShape = Sx;
+
+             aReshape.Replace(aReplacedShape, aShapeForRepl1);
+           }
+
+         if(aNbShapes == aNumOfRE2)
+           {
+             aReplacedShape = Sx;
+
+             aReshape.Replace(aReplacedShape, aShapeForRepl2);
+           }
+       }
+    }
+  //////////////////// explode (end)
+
+  if(aReplacedShape.IsNull())
+    {
+      theDI << "There is not any shape for replacing.\n";
+    }
+
+  DBRep::Set (theArgVal[1],aReshape.Apply (aShape,TopAbs_WIRE,2));
+
+  return 0;
+}
+
 /*****************************************************************************/
 
 void QABugs::Commands_19(Draw_Interpretor& theCommands) {
@@ -2834,5 +2917,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
   theCommands.Add ("OCC23010", "OCC23010 STEP_file", __FILE__, OCC23010, group);
   theCommands.Add ("OCC25043", "OCC25043 shape", __FILE__, OCC25043, group);
   theCommands.Add ("OCC24606", "OCC24606 : Tests ::FitAll for V3d view ('vfit' is for NIS view)", __FILE__, OCC24606, group);
+  theCommands.Add ("OCC25202", "OCC25202 res shape numF1 face1 numF2 face2", __FILE__, OCC25202, group);
   return;
 }
index f3313bbcef7c4e3323428bae33de4b24b40859f9..b4438aff674b3809cc41d252166059aa45911851 100644 (file)
@@ -734,6 +734,7 @@ static Standard_Integer BUC60811(Draw_Interpretor& di, Standard_Integer argc, co
   TopoDS_Shell shell;
   B.MakeShell(shell);
   B.Add(shell, bzf1); 
+  shell.Closed (BRep_Tool::IsClosed (shell));
   B.MakeSolid(solid);
   B.Add(solid,shell); 
   gp_Dir D(0, 0, 1.0f); 
@@ -1775,6 +1776,7 @@ static Standard_Integer BUC60951_(Draw_Interpretor& di, Standard_Integer argc, c
     TopoDS_Face face = TopoDS::Face(list.FindKey(i));
     builder.Add(shell, face);
   }
+  shell.Closed (BRep_Tool::IsClosed (shell));
 
   BRepPrimAPI_MakeHalfSpace half(shell, gp_Pnt(0, 0, 20));
   TopoDS_Solid sol = half.Solid();
index 7cd238d6a79d0b1661217bd4ea28273a4a287486..a82f68297f6328630a02414f086c15e4e741f6ec 100644 (file)
@@ -21,6 +21,7 @@
 #include <TopoDS_Iterator.hxx>
 #include <TopExp_Explorer.hxx>
 #include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
 #include <ShapeExtend.hxx>
 #include <ShapeBuild_Edge.hxx>
 #include <TopoDS.hxx>
@@ -69,8 +70,8 @@ TopoDS_Shape ShapeBuild_ReShape::Apply (const TopoDS_Shape& shape,
   // if shape replaced, apply modifications to the result recursively 
   Standard_Boolean aConsLoc = ModeConsiderLocation();
   if ( (aConsLoc && ! newsh.IsPartner (shape)) || 
-      (!aConsLoc &&! newsh.IsSame ( shape )) ) {
-  
+      (!aConsLoc &&! newsh.IsSame ( shape )) )
+  {
     TopoDS_Shape res = Apply ( newsh, until );
     myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE1 );
     return res;
@@ -124,8 +125,10 @@ TopoDS_Shape ShapeBuild_ReShape::Apply (const TopoDS_Shape& shape,
     sbe.CopyRanges ( TopoDS::Edge ( result ), TopoDS::Edge ( shape ));
   }
   result.Orientation(orient);
+  result.Closed (BRep_Tool::IsClosed (result));
   myStatus = locStatus;
   Replace ( shape, result );
+
   return result;
 }
 
index 6aa226b3794f539c4827126892f6d6478d0cce7c..6dea09dcd981743779f9d2908de7681af79a72b6 100644 (file)
@@ -543,6 +543,7 @@ ShapeFix_FaceConnect::ShapeFix_FaceConnect() {}
          if (SFF->FixOrientation(MapWires)) EmpFace = SFF->Face();
          theBuilder.Add(theShell,EmpFace);
        }
+        theShell.Closed (BRep_Tool::IsClosed (theShell));
        result = theShell;
 
        if (!theRepVertices.IsEmpty()) {
index 82837b0032af506dc761063a8dda2e5f50cdd3f6..5a03b46644b89ca963b1bd0debe0d829c4b43560 100644 (file)
@@ -269,11 +269,12 @@ static  Standard_Boolean GetShells(TopTools_SequenceOfShape& Lface,
       }
       j++;
       B.Add(nshell,F1);
+      nshell.Closed (BRep_Tool::IsClosed (nshell));
       aMapFaceShells.Bind(F1,nshell);
       Lface.Remove(i);
       
       // if closed shell is obtained it adds to sequence of shells and new shell begin to construct.
-      if(isMultiConnex && BRep_Tool::IsClosed(nshell)) {
+      if(isMultiConnex && nshell.Closed()) {
         aSeqShells.Append(nshell);
         TopoDS_Shell nshellnext;
         B.MakeShell(nshellnext);
index 24d7707e60987aa778dac751d24c385f4988e374..8b60bb7ffc26c435608ba7a1636619b0aedfcc01 100644 (file)
@@ -208,7 +208,11 @@ static void RecModif (const TopoDS_Shape &S,
        }
        else B.Add ( result, sh );
       }
-      if ( modif ) res = result;
+      if ( modif )
+      {
+        result.Closed (BRep_Tool::IsClosed (result));
+        res = result;
+      }
     }
     
     if ( res != r ) map.Bind ( S.Located(aNullLoc), res );
index e39349b786d784035ad87e95fd420b6536b2107e..12ea362a5cb12ff7b26ee1c5e3efdbaa54909057 100644 (file)
@@ -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 ); 
index 60f73dc75a90bdfe5f2aa6b4605a4b1c136dcf0e..d199cd5f8b1a1ced2498c800720fd469cf034af0 100644 (file)
@@ -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);
 }
 
index f6b9ebffcefc12e0a9128de6f6a0eb1568e68572..66c86f1bc30443d98810ab63341eb257416872f3 100644 (file)
@@ -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);
index db7692a60bd5374f4e32690a6ce0570ee7bfaa73..9a3a497b69d2dfee36e0bfa875c7062630347d93 100644 (file)
@@ -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 );
   }
index 60a57d908da87f7f398646c641e0a5ae82b682a4..d016b5500a658ad52c78b7c0f655799a5de67603 100644 (file)
@@ -614,6 +614,7 @@ void StepToTopoDS_Builder::Init (const Handle(StepShape_EdgeBasedWireframeModel)
       B.Add ( W, E );
     }
     if ( W.IsNull() ) continue;
+    W.Closed (BRep_Tool::IsClosed (W));
     B.Add ( C, W );
     if ( myResult.IsNull() ) myResult = W;
     else myResult = C;
@@ -675,6 +676,7 @@ void StepToTopoDS_Builder::Init (const Handle(StepShape_FaceBasedSurfaceModel)&
       B.Add ( S, F );
     }
     if ( S.IsNull() ) continue;
+    S.Closed (BRep_Tool::IsClosed (S));
     B.Add ( C, S );
     if ( myResult.IsNull() ) myResult = S;
     else myResult = C;
index f8dc4802e735f9b879569ebc4b4e953bb410f9d4..f4cbd87f22ace74da502f02324eecdd06132e009 100644 (file)
@@ -675,6 +675,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
     TP->AddFail(EL,"At least one edge failed : wire not done");
     return;
   }
+  W.Closed (BRep_Tool::IsClosed (W));
   aTool.Bind(EL, W);
   
   // ----------------------------------------------
index febeeae1c4c34c0fe3a72ff20c78b2fa7154bf33..bf613012dc5db1bc950d72f548563c954f21326b 100644 (file)
@@ -170,6 +170,7 @@ void StepToTopoDS_TranslatePolyLoop::Init(const Handle(StepShape_PolyLoop)& PL,
       GP1 = GP2;
       V1  = V2;
     }
+    W.Closed (BRep_Tool::IsClosed (W));
     aTool.Bind(PL, W);
     myResult = W;
     myError  = StepToTopoDS_TranslatePolyLoopDone;
index b315530fb2b60bb9c512f7e216c14c0eebf3c582..4b4542ed37db4c8ffd2d05fb562d90a2ba96bc06 100644 (file)
@@ -103,6 +103,7 @@ void StepToTopoDS_TranslateShell::Init
        TP->AddWarning(StepFace," Face is not of FaceSurface Type; not mapped to TopoDS");
       }
     }
+    Sh.Closed (BRep_Tool::IsClosed (Sh));
     myResult = Sh;
     aTool.Bind(CFS, myResult);
     myError  = StepToTopoDS_TranslateShellDone;
index 37efffd88ffc2acda5f08ca13ec71f99b7360bab..46e50e31c8bd27c3306f340b7a1f1aea46d0fcb6 100644 (file)
@@ -89,6 +89,7 @@ void StepToTopoDS_TranslateVertexLoop::Init(const Handle(StepShape_VertexLoop)&
     B.Degenerated(E, Standard_True);
 
     B.MakeWire(W);
+    W.Closed (Standard_True);
     B.Add(W, E);
     aTool.Bind(VL, W);
     myResult = W;
index 7caca2eb264c36939212dfe3419f15e86ac9caaa..172a3a75a2dc3284cd64480bac4df1d529472ea9 100644 (file)
@@ -465,6 +465,7 @@ static TopoDS_Shape ShapeWithType(const TopoDS_Shape     theShape,
       TopoDS_Shell aShell;
       aShellBuilder.MakeShell(aShell);
       for(;aListIter.More();aListIter.Next()) aShellBuilder.Add(aShell,TopoDS::Face(aListIter.Value()));
+      aShell.Closed (BRep_Tool::IsClosed (aShell));
       if (theType == TopAbs_SHELL) return aShell;
       aShapes.Clear(); // don't break: we can do something more of it
       aShapes.Append(aShell);
index 2352b914ffed9abc8085a710cccaddab5be8c551..2912d68bd59e6460e255a827ce1f9bc1ce9db7fa 100644 (file)
@@ -187,6 +187,7 @@ Standard_Integer MKSOLSHE(Draw_Interpretor&, Standard_Integer narg, const char**
     if (S.IsNull()) continue;
     if (S.ShapeType() == TopAbs_FACE) {
       BB.Add(she,S);
+      she.Closed (BRep_Tool::IsClosed (she));
       yaface = Standard_True;
     }
   }
index eb1eb3ab324b3b70f11edd348d02e9dda9f726f1..ac37b94d5a27d4719d6cbbf22b5d038b6c3f1433 100644 (file)
@@ -1283,6 +1283,7 @@ static TopoDS_Solid GetNewSolid(const TopoDS_Shape& S, TopoDS_Face& F)
   newShellBuilder.MakeShell( newShell );
   newShellBuilder.Add( newShell, hsFace );
   newShellBuilder.Add( newShell, infFace );
+  newShell.Closed (BRep_Tool::IsClosed (newShell));
 
   BRep_Builder newSolidBuilder;
   newSolidBuilder.MakeSolid( newSolid );
index fd5b1ed3851f0de02c1229533bcc1557bbdb9ea3..6eb13c1a2eea133be983ac0adc00274874dc8c75 100644 (file)
@@ -140,6 +140,7 @@ Standard_Integer TopOpeBRepBuild_Builder1::CorrectResult2d(TopoDS_Shape& aResult
        }
        // Add wires
        aWire.Orientation(Wori);
+        aWire.Closed (BRep_Tool::IsClosed (aWire));
        BB.Add (aFace, aWire);
       }
       
@@ -148,8 +149,10 @@ Standard_Integer TopOpeBRepBuild_Builder1::CorrectResult2d(TopoDS_Shape& aResult
     }
 
     aShell.Orientation(S.Orientation());
+    aShell.Closed (BRep_Tool::IsClosed(aShell));
     BB.Add (aSolid, aShell);
   }
+  aSolid.Closed (BRep_Tool::IsClosed(aSolid));
   aResult=aSolid;
 
   //update section curves 
index ab338629a05289773d2f2ea16f61ee0e0b464e23..fd7956e58761b586f90196597034588e1524e299 100644 (file)
@@ -250,6 +250,7 @@ Standard_Boolean XCAFPrs::DispatchStyles (const TopoDS_Shape &shape,
   // iterate on subshapes
   BRep_Builder B;
   TopoDS_Shape copy = shape.EmptyCopied();
+  copy.Closed (shape.Closed());
   Standard_Boolean suboverride = Standard_False;
   Standard_Integer nbDef = 0;
   for ( TopoDS_Iterator it(shape); it.More(); it.Next() ) {
index 4e256eb9fea37f8e38b70a66caf3c036a945e199..2a88a43e3c2fc689bcad6e2b24e98147745febe9 100644 (file)
@@ -429,6 +429,7 @@ static const Standard_ExtString   voidext = { 0 };
     TopoDS_Shell S;
     B.MakeShell (S);
     B.Add (S,shape);  // ne passe pas ! : TopoDS::Face(shape));
+    S.Closed (BRep_Tool::IsClosed (S));
     return S;
   }
 
diff --git a/tests/bugs/moddata_3/bug25202_1 b/tests/bugs/moddata_3/bug25202_1
new file mode 100755 (executable)
index 0000000..7acf0ec
--- /dev/null
@@ -0,0 +1,33 @@
+puts "========"
+puts "CR25202"
+puts "========"
+puts ""
+#########################################
+## Incorrect value of IsClosed flag in shapes produced by some algorithms
+#########################################
+
+pload QAcommands
+
+box b 100 100 100
+vertex v1 0 0 50
+explode b v
+edge ee1 b_2 v1
+edge ee2 v1 b_1
+explode b e
+wire ww1 ee1 ee2 b_2 b_3 b_4
+wire ww2 ee1 ee2 b_9 b_10 b_5
+mkplane ff1 ww1
+mkplane ff2 ww2
+explode b f
+#Replaced edge lies between b_1 and b_3 faces.
+
+OCC25202 result b 1 ff1 3 ff2
+
+set info [whatis result]
+if { [regexp {Closed} ${info}] } {
+    puts "OK : value of IsClosed flag is correct"
+} else {
+    puts "Error : value of IsClosed flag is not correct"
+}
+
+set 2dviewer 1
diff --git a/tests/bugs/moddata_3/bug25202_2 b/tests/bugs/moddata_3/bug25202_2
new file mode 100755 (executable)
index 0000000..6c519b2
--- /dev/null
@@ -0,0 +1,21 @@
+puts "========"
+puts "CR25202"
+puts "========"
+puts ""
+#########################################
+## Incorrect value of IsClosed flag in shapes produced by some algorithms
+#########################################
+
+box b 100 100 100
+explode b sh
+trotate b_1 0 0 0 1 0 0 45
+removeloc result b_1
+
+set info [whatis result]
+if { [regexp {Closed} ${info}] } {
+    puts "OK : value of IsClosed flag is correct"
+} else {
+    puts "Error : value of IsClosed flag is not correct"
+}
+
+set 2dviewer 1
diff --git a/tests/bugs/moddata_3/bug25202_3 b/tests/bugs/moddata_3/bug25202_3
new file mode 100755 (executable)
index 0000000..ba1cc56
--- /dev/null
@@ -0,0 +1,21 @@
+puts "========"
+puts "CR25202"
+puts "========"
+puts ""
+#########################################
+## Incorrect value of IsClosed flag in shapes produced by some algorithms
+#########################################
+
+plane pp 0 0 0 0 0 1
+trim pp pp 0 100 0 100
+mkface ff pp
+prism result ff 0 0 20
+
+set info [whatis result]
+if { [regexp {Closed} ${info}] } {
+    puts "OK : value of IsClosed flag is correct"
+} else {
+    puts "Error : value of IsClosed flag is not correct"
+}
+
+set 2dviewer 1
diff --git a/tests/bugs/moddata_3/bug25202_4 b/tests/bugs/moddata_3/bug25202_4
new file mode 100755 (executable)
index 0000000..84ff551
--- /dev/null
@@ -0,0 +1,22 @@
+puts "========"
+puts "CR25202"
+puts "========"
+puts ""
+#########################################
+## Incorrect value of IsClosed flag in shapes produced by some algorithms
+#########################################
+
+circle cc 0 100 0 20
+mkedge ee cc
+wire ww ee
+mkplane ff ww
+revol result ff 0 0 0 1 0 0 90
+
+set info [whatis result]
+if { [regexp {Closed} ${info}] } {
+    puts "OK : value of IsClosed flag is correct"
+} else {
+    puts "Error : value of IsClosed flag is not correct"
+}
+
+set 2dviewer 1