0027386: BRepOffsetAPI_MakePipeShell does not provide history of generations
authorjgv <jgv@opencascade.com>
Mon, 17 Oct 2016 10:59:58 +0000 (13:59 +0300)
committerabv <abv@opencascade.com>
Thu, 3 Nov 2016 15:04:33 +0000 (18:04 +0300)
The method BRepOffsetAPI_MakePipeShell::Generated now returns generated shapes for sub-edges and sub-vertices of sections.

The method BRepFill_PipeShell::BuildHistory is redesigned: now it builds generated shapes for sub-edges and sub-vertices of sections.

New Draw command "gensweep" is added to sweep commands for testing of history building.

22 files changed:
src/BRepFill/BRepFill_CompatibleWires.cxx
src/BRepFill/BRepFill_NSections.cxx
src/BRepFill/BRepFill_PipeShell.cxx
src/BRepFill/BRepFill_PipeShell.hxx
src/BRepFill/BRepFill_Section.cxx
src/BRepFill/BRepFill_Section.hxx
src/BRepFill/BRepFill_Section.lxx
src/BRepFill/BRepFill_SectionLaw.cxx
src/BRepFill/BRepFill_SectionLaw.hxx
src/BRepFill/BRepFill_ShapeLaw.cxx
src/BRepFill/BRepFill_Sweep.cxx
src/BRepFill/BRepFill_Sweep.hxx
src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.hxx
src/BRepTest/BRepTest_SweepCommands.cxx
tests/bugs/modalg_6/bug27386_1 [new file with mode: 0644]
tests/bugs/modalg_6/bug27386_2 [new file with mode: 0644]
tests/bugs/modalg_6/bug27386_3 [new file with mode: 0644]
tests/bugs/modalg_6/bug27386_4 [new file with mode: 0644]
tests/bugs/modalg_6/bug27386_5 [new file with mode: 0644]
tests/bugs/modalg_6/bug27386_6 [new file with mode: 0644]
tests/bugs/modalg_6/bug27386_7 [new file with mode: 0644]
tests/bugs/modalg_6/bug27386_8 [new file with mode: 0644]

index 0404580..c0eab66 100644 (file)
@@ -58,6 +58,7 @@
 #include <TopoDS_Wire.hxx>
 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
 #include <TopTools_DataMapOfShapeListOfShape.hxx>
+#include <TopTools_DataMapOfShapeSequenceOfShape.hxx>
 #include <TopTools_HSequenceOfShape.hxx>
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
@@ -116,6 +117,30 @@ static void EdgesFromVertex (const TopoDS_Wire&   W,
 }
                                      
 #endif
+
+//=======================================================================
+//function : AddNewEdge
+//purpose  : for <theEdge> find all newest edges
+//           in <theEdgeNewEdges> recursively
+//=======================================================================
+
+static void AddNewEdge(const TopoDS_Shape& theEdge,
+                       const TopTools_DataMapOfShapeSequenceOfShape& theEdgeNewEdges,
+                       TopTools_ListOfShape& ListNewEdges)
+{
+  if (theEdgeNewEdges.IsBound(theEdge))
+  {
+    const TopTools_SequenceOfShape& NewEdges = theEdgeNewEdges(theEdge);
+    for (Standard_Integer i = 1; i <= NewEdges.Length(); i++)
+    {
+      TopoDS_Shape anEdge = NewEdges(i);
+      AddNewEdge(anEdge, theEdgeNewEdges, ListNewEdges);
+    }
+  }
+  else
+    ListNewEdges.Append(theEdge);
+}
+
 static void SeqOfVertices (const TopoDS_Wire&   W,
                           TopTools_SequenceOfShape& S)
 {
@@ -430,7 +455,8 @@ static Standard_Boolean EdgeIntersectOnWire (const gp_Pnt& P1,
                                             const TopTools_DataMapOfShapeListOfShape& Map,
                                             const TopoDS_Wire&   W,
                                             TopoDS_Vertex& Vsol,
-                                            TopoDS_Wire&   newW)
+                                            TopoDS_Wire&   newW,
+                                             TopTools_DataMapOfShapeSequenceOfShape& theEdgeNewEdges)
 {
 
   BRepTools_WireExplorer anExp;
@@ -479,9 +505,7 @@ static Standard_Boolean EdgeIntersectOnWire (const gp_Pnt& P1,
     // is the solution a new vertex ?
     NewVertex = (DSS.SupportTypeShape2(isol) != BRepExtrema_IsVertex);
     if (NewVertex) {
-      TopoDS_Shape aLocalShape = DSS.SupportOnShape2(isol);
-      TopoDS_Edge E = TopoDS::Edge(aLocalShape);
-//      TopoDS_Edge E = TopoDS::Edge(DSS.SupportOnShape2(isol));
+      TopoDS_Edge E = TopoDS::Edge(DSS.SupportOnShape2(isol));
       Standard_Real tol = Precision::PConfusion();
       Standard_Real first,last,param;
       BRep_Tool::Range(E,first,last);
@@ -512,6 +536,8 @@ static Standard_Boolean EdgeIntersectOnWire (const gp_Pnt& P1,
       TopoDS_Shape aLocalShape = DSS.SupportOnShape2(isol);
       TopoDS_Edge E = TopoDS::Edge(aLocalShape);
 //      TopoDS_Edge E = TopoDS::Edge(DSS.SupportOnShape2(isol));
+      TopTools_SequenceOfShape EmptySeq;
+      theEdgeNewEdges.Bind(E, EmptySeq);
       Standard_Real first,last,param;
       DSS.ParOnEdgeS2(isol,param);
       BRep_Tool::Range(E,first,last);
@@ -526,6 +552,7 @@ static Standard_Boolean EdgeIntersectOnWire (const gp_Pnt& P1,
          SR.Clear();
          SR.Append(param);
          TrimEdge(E,SR,first,last,SO,SE);
+          theEdgeNewEdges(E) = SE;
          TopoDS_Vertex VV1,VV2;
          TopExp::Vertices(TopoDS::Edge(SE.Value(1)),VV1,VV2);
          if (TopExp::FirstVertex(E).IsSame(VV1)
@@ -855,9 +882,11 @@ void BRepFill_CompatibleWires::
   // initialisation 
   Standard_Integer NbSects=myWork.Length();
   BRepTools_WireExplorer anExp;
-  
+  TopTools_DataMapOfShapeSequenceOfShape EdgeNewEdges;
+
   Standard_Boolean allClosed = Standard_True;
   Standard_Integer i,ii,ideb=1,ifin=NbSects;
+
   for (i=1; i<=NbSects; i++) {
     Handle(BRepCheck_Wire) Checker = new BRepCheck_Wire(TopoDS::Wire(myWork(i)));
     allClosed = (allClosed && (Checker->Closed() == BRepCheck_NoError));
@@ -974,8 +1003,8 @@ void BRepFill_CompatibleWires::
       if (Pnew.Distance(Pos->Value(i-1))>Precision::Confusion()) {
        Standard_Real percent = myPercent;
        NewVertex = EdgeIntersectOnWire(Pos->Value(i-1),Pnew,percent,
-                                   RMap,TopoDS::Wire(myWork(i-1)),
-                                   Vsol,newwire);
+                                        RMap,TopoDS::Wire(myWork(i-1)),
+                                        Vsol,newwire,EdgeNewEdges);
        if (NewVertex) myWork(i-1) = newwire;
        RMap(Vi).Append(Vsol);
       }
@@ -1058,8 +1087,8 @@ void BRepFill_CompatibleWires::
        if (Pnew.Distance(Pos->Value(i+1))>Precision::Confusion()) {
          Standard_Real percent = myPercent;
          NewVertex = EdgeIntersectOnWire(Pos->Value(i+1),Pnew,percent,
-                                     MapVLV,TopoDS::Wire(myWork(i+1)),
-                                     Vsol,newwire);
+                                          MapVLV,TopoDS::Wire(myWork(i+1)),
+                                          Vsol,newwire,EdgeNewEdges);
          MapVLV(VRoot).Append(Vsol);
          if (NewVertex) myWork(i+1) = newwire;
        }
@@ -1211,6 +1240,19 @@ void BRepFill_CompatibleWires::
     Standard_NoSuchObject::Raise("BRepFill_CompatibleWires::SameNumberByPolarMethod failed");
   }
 
+  //Fill <myMap>
+  TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itmap(myMap);
+  for (; itmap.More(); itmap.Next())
+  {
+    TopoDS_Shape anEdge = itmap.Key();
+    TopTools_ListOfShape ListOfNewEdges;
+
+    //for each edge of <myMap> find all newest edges
+    //in <EdgeNewEdges> recursively
+    AddNewEdge(anEdge, EdgeNewEdges, ListOfNewEdges);
+    
+    myMap(anEdge) = ListOfNewEdges;
+  }
 }
 
 //=======================================================================
index 6696f8a..e291a26 100644 (file)
@@ -449,7 +449,7 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
   
   // Fill tables
   uclosed = Standard_True;
-  for (jj=ideb;jj<=ifin;jj++){
+  for (jj = ideb; jj <= ifin; jj++){
 
     W = TopoDS::Wire(myShapes(jj));
     
@@ -458,7 +458,11 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
       
 //      if ( ! B.Degenerated(E)) {
       if ( ! BRep_Tool::Degenerated(E)) {
-       myEdges->SetValue(ii,jj, E);
+       myEdges->SetValue(ii, jj, E);
+        if (E.Orientation() == TopAbs_FORWARD)
+          myIndices.Bind(E, ii);
+        else
+          myIndices.Bind(E, -ii);
       }
     }
 
@@ -600,7 +604,6 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
  
 }
 
-
 //=======================================================================
 //function : IsVertex
 //purpose  :
index 95ec9e5..d975770 100644 (file)
@@ -68,6 +68,7 @@
 #include <StdFail_NotDone.hxx>
 #include <TColgp_HArray1OfPnt2d.hxx>
 #include <TColStd_HArray1OfReal.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
 #include <TopExp.hxx>
 #include <TopLoc_Location.hxx>
 #include <TopoDS.hxx>
@@ -92,11 +93,9 @@ static Standard_Boolean Affich = 0;
 
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_DataMapOfIntegerShape.hxx>
 #include <TopoDS_Compound.hxx>
 
-static Standard_Boolean UpdateMap(const TopoDS_Shape&                 theKey,
-                                 const TopoDS_Shape&                 theValue,
-                                 TopTools_DataMapOfShapeListOfShape& theMap);
 
 static Standard_Boolean BuildBoundaries(const BRepFill_Sweep&               theSweep,
                                        const Handle(BRepFill_SectionLaw)&  theSection,
@@ -920,12 +919,13 @@ const TopoDS_Shape& BRepFill_PipeShell::LastShape() const
 void BRepFill_PipeShell::Generated(const TopoDS_Shape&   theShape,
                                   TopTools_ListOfShape& theList) 
 {
-  //   Standard_NotImplemented::Raise("Generated:Pas Fait"); 
+  //   Standard_NotImplemented::Raise("Generated:Pas Fait");
+  
   theList.Clear();
 
   if(myGenMap.IsBound(theShape)) {
     theList = myGenMap.Find(theShape);
-  } 
+  }
 }
 
 //=======================================================================
@@ -943,7 +943,7 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape&   theShape,
  
   //Check set of section for right configuration of punctual sections
   Standard_Integer i;
-  TopoDS_Iterator iter;;
+  TopoDS_Iterator iter;
   for (i = 2; i <= mySeq.Length()-1; i++)
     {
       Standard_Boolean wdeg = Standard_True;
@@ -1005,122 +1005,152 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape&   theShape,
     else 
       mySection = new BRepFill_ShapeLaw(aLocalShape);
 // mySection = new (BRepFill_ShapeLaw) (TopoDS::Wire(theSect));
-    }   
-  else 
+    
+    WSeq.Append(theSect);
+    //Simple case of single section
+    myIndOfSec.Append(1);
+    TopoDS_Iterator itw(theSect);
+    for (; itw.More(); itw.Next())
     {
-      TColStd_SequenceOfReal Param;
-      TopTools_SequenceOfShape WSeq;
-      GeomFill_SequenceOfTrsf Transformations;
-      //WSeq.Clear();
-      //Param.Clear();
-      Standard_Integer NbL = myLocation->NbLaw();
-      gp_Trsf aTrsf;
-      Standard_Real V1, V2, param;
-      myLocation->CurvilinearBounds(NbL, V1, V2);
-      V1 = 0.;
-      Standard_Integer ideb = 0, ifin = 0;
-//      for (Standard_Integer iseq=1;iseq<=mySeq.Length();iseq++) {
-      Standard_Integer iseq;
-      for (iseq=1;iseq<=mySeq.Length();iseq++) {
-       Place(mySeq(iseq), theSect, aTrsf, param);
-       Param.Append(param);
-       WSeq.Append(theSect);
-//     WSeq.Append(TopoDS::Wire(theSect));
-        Transformations.Append(aTrsf);
-        if (param==V1) ideb = iseq;
-        if (param==V2) ifin = iseq;
+      const TopoDS_Shape& anEdge = itw.Value();
+      TopTools_ListOfShape Elist;
+      Elist.Append(anEdge);
+      myEdgeNewEdges.Bind(anEdge, Elist);
+    }
+    ///////////////////////////////
+  }   
+  else 
+  {
+    TColStd_SequenceOfReal Param;
+    TColStd_SequenceOfInteger IndSec;
+    GeomFill_SequenceOfTrsf Transformations;
+    Standard_Integer NbL = myLocation->NbLaw();
+    gp_Trsf aTrsf;
+    Standard_Real V1, V2, param;
+    myLocation->CurvilinearBounds(NbL, V1, V2);
+    V1 = 0.;
+    Standard_Integer ideb = 0, ifin = 0;
+    Standard_Integer iseq;
+    for (iseq = 1; iseq <= mySeq.Length(); iseq++) {
+      IndSec.Append(iseq);
+      Place(mySeq(iseq), theSect, aTrsf, param);
+      Param.Append(param);
+      WSeq.Append(theSect);
+      Transformations.Append(aTrsf);
+      if (param==V1) ideb = iseq;
+      if (param==V2) ifin = iseq;
+    }
+    
+    
+    // looping sections ?
+    if (myLocation->IsClosed()) {
+      if (ideb>0) {
+        // place the initial section at the final position 
+        Param.Append(V2);
+        WSeq.Append(WSeq(ideb));
       }
-      
-
-      // looping sections ?
-      if (myLocation->IsClosed()) {
-        if (ideb>0) {
-          // place the initial section at the final position 
-          Param.Append(V2);
-          WSeq.Append(WSeq(ideb));
+      else if (ifin>0) {
+        // place the final section at the initial position
+        Param.Append(V1);
+        WSeq.Append(WSeq(ifin));
+      }
+      else {
+        // it is necessary to find a medium section to impose by V1 and by V2
+        Standard_Real pmin = RealLast(), pmax = RealFirst();
+        TopoDS_Wire Wmin, Wmax;
+        for (iseq = 1; iseq <= WSeq.Length(); iseq++) {
+          if (Param.Value(iseq)<pmin) {
+            pmin = Param.Value(iseq);
+            Wmin = TopoDS::Wire(WSeq.Value(iseq));
+          }
+          if (Param.Value(iseq)>pmax) {
+            pmax = Param.Value(iseq);
+            Wmax = TopoDS::Wire(WSeq.Value(iseq));
+          }
         }
-        else if (ifin>0) {
-          // place the final section at the initial position
+        // medium section between Wmin and Wmax
+        TopoDS_Wire Wres;
+        Standard_Real dmin = Abs(pmin-V1);
+        Standard_Real dmax = Abs(pmax-V2);
+        if (ComputeSection(Wmin,Wmax,dmin,dmax,Wres)) {
+          // impose section Wres at the beginning and the end
           Param.Append(V1);
-          WSeq.Append(WSeq(ifin));
+          WSeq.Append(Wres);
+          IndSec.Append(WSeq.Length());
+          Param.Append(V2);
+          WSeq.Append(Wres);
+          IndSec.Append(WSeq.Length());
         }
-        else {
-          // it is necessary to find a medium section to impose by V1 and by V2
-          Standard_Real pmin = Param.Value(1), pmax = Param.Value(1);
-          TopoDS_Wire Wmin = TopoDS::Wire(WSeq.Value(1)), Wmax;
-          for (iseq=2;iseq<=WSeq.Length();iseq++) {
-            if (Param.Value(iseq)<pmin) {
-              pmin = Param.Value(iseq);
-              Wmin = TopoDS::Wire(WSeq.Value(iseq));
-            }
-            if (Param.Value(iseq)>pmax) {
-              pmax = Param.Value(iseq);
-              Wmax = TopoDS::Wire(WSeq.Value(iseq));
-            }
-          }
-          // medium section between Wmin and Wmax
-          TopoDS_Wire Wres;
-          Standard_Real dmin = Abs(pmin-V1);
-          Standard_Real dmax = Abs(pmax-V2);
-          if (ComputeSection(Wmin,Wmax,dmin,dmax,Wres)) {
-            // impose section Wres at the beginning and the end
-            Param.Append(V1);
-            WSeq.Append(Wres);
-            Param.Append(V2);
-            WSeq.Append(Wres);
-            
+      }
+    }
+    
+    // parse sections by increasing parameter
+    Standard_Boolean play_again = Standard_True;
+    while (play_again) {
+      play_again = Standard_False;
+      for (iseq=1;iseq<=WSeq.Length();iseq++) {
+        for (Standard_Integer jseq=iseq+1;jseq<=WSeq.Length();jseq++) {
+          if (Param.Value(iseq) > Param.Value(jseq)) {
+            Param.Exchange(iseq,jseq);
+            WSeq.Exchange(iseq,jseq);
+            IndSec.Exchange(iseq,jseq);
+            play_again = Standard_True;
           }
-          
         }
       }
-
-      // parse sections by increasing parameter
-      Standard_Boolean play_again = Standard_True;
-      while (play_again) {
-       play_again = Standard_False;
-       for (iseq=1;iseq<=WSeq.Length();iseq++) {
-         for (Standard_Integer jseq=iseq+1;jseq<=WSeq.Length();jseq++) {
-           if (Param.Value(iseq)>Param.Value(jseq)) {
-             Param.Exchange(iseq,jseq);
-             WSeq.Exchange(iseq,jseq);
-             play_again = Standard_True;
-           }
-         }
-       }
-      }
-
+    }
+    //Fill the array of real indices of sections
+    for (Standard_Integer ii = 1; ii <= mySeq.Length(); ii++)
+      for (Standard_Integer jj = 1; jj <= IndSec.Length(); jj++)
+        if (IndSec(jj) == ii)
+        {
+          myIndOfSec.Append(jj);
+          break;
+        }
+    
 #ifdef DRAW
-  if ( Affich) {
-    char*  name = new char[100];
-    Standard_Integer NBSECT = 0;
-    for (Standard_Integer i=1;i<=WSeq.Length();i++) {
-      NBSECT++;
-      sprintf(name,"WSeq_%d",NBSECT);
-      DBRep::Set(name,TopoDS::Wire(WSeq.Value(i)));
+    if ( Affich) {
+      char*  name = new char[100];
+      Standard_Integer NBSECT = 0;
+      for (Standard_Integer i=1;i<=WSeq.Length();i++) {
+        NBSECT++;
+        sprintf(name,"WSeq_%d",NBSECT);
+        DBRep::Set(name,TopoDS::Wire(WSeq.Value(i)));
+      }
     }
-  }
 #endif
-      
-      
-
-      //  Calculate work sections 
-      TopTools_SequenceOfShape WorkingSections;
-      WorkingSections.Clear();
-      TopTools_DataMapOfShapeListOfShape WorkingMap;
-      WorkingMap.Clear();
-      BRepFill_CompatibleWires Georges(WSeq);
-      Georges.SetPercent(0.1);
-      Georges.Perform(Standard_False);
-      if (Georges.IsDone()) {
-       WorkingSections = Georges.Shape();
-       WorkingMap = Georges.Generated();
-      }
-      else {
-       Standard_ConstructionError::Raise("PipeShell : uncompatible wires");
+    
+    
+    
+    //  Calculate work sections 
+    TopTools_SequenceOfShape WorkingSections;
+    WorkingSections.Clear();
+    TopTools_DataMapOfShapeListOfShape WorkingMap;
+    BRepFill_CompatibleWires Georges(WSeq);
+    Georges.SetPercent(0.1);
+    Georges.Perform(Standard_False);
+    if (Georges.IsDone()) {
+      WorkingSections = Georges.Shape();
+      WorkingMap = Georges.Generated();
+      //For each sub-edge of each section
+      //we save its splits
+      for (Standard_Integer ii = 1; ii <= WSeq.Length(); ii++)
+      {
+        TopExp_Explorer Explo(WSeq(ii), TopAbs_EDGE);
+        for (; Explo.More(); Explo.Next())
+        {
+          const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
+          TopTools_ListOfShape aNewEdges = Georges.GeneratedShapes(anEdge);
+          myEdgeNewEdges.Bind(anEdge, aNewEdges);
+        }
       }
-      mySection = new (BRepFill_NSections) (WorkingSections,Transformations,Param,V1,V2);
-      
-    }// else
+    }
+    else {
+      Standard_ConstructionError::Raise("PipeShell : uncompatible wires");
+    }
+    mySection = new (BRepFill_NSections) (WorkingSections,Transformations,Param,V1,V2);
+    
+  }// else
 
   //  modify the law of location if contact
   if ( (myTrihedron == GeomFill_IsGuidePlanWithContact)
@@ -1192,187 +1222,211 @@ void BRepFill_PipeShell::Place(const BRepFill_Section& Sec,
 
 //=======================================================================
 //function : BuildHistory
-//purpose  : Builds history for edges of spine, 
-//           for built bottom shape of sweep,
-//           for boundary vertices of bottom shape of sweep,
-//           for boundary profiles
+//purpose  : Builds history for edges and vertices 
+//           of sections
 //=======================================================================
 void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep) 
 {
-  Handle(TopTools_HArray2OfShape) aFaces = theSweep.SubShape();
-  Handle(TopTools_HArray2OfShape) aVEdges = theSweep.Sections();
-  Handle(TopTools_HArray2OfShape) aUEdges = theSweep.InterFaces();
-  Standard_Integer i = 0, j = 0;
-  Standard_Boolean bPrevModified = Standard_False;
-
-  for(i = 1; i <= mySection->NbLaw(); i++) {
-    if((!aVEdges->Value(i, 1).IsNull()) && (aVEdges->Value(i, 1).ShapeType() == TopAbs_FACE)) {
-      bPrevModified = Standard_True;
-      break;
-    }
-  }
-
-  for(j = myLocation->NbLaw(); j >= 1; j--) {
-    TopTools_ListOfShape aListOfFace;
-
-    if(bPrevModified) {
-      for(i = 1; i <= mySection->NbLaw(); i++) {
-       Standard_Integer lessindex = j + 1;
-       lessindex = (lessindex > myLocation->NbLaw()) ? 1 : lessindex;
-
-       if((!aVEdges->Value(i, lessindex).IsNull()) && (aVEdges->Value(i, lessindex).ShapeType() == TopAbs_FACE)) {
-         aListOfFace.Append(aVEdges->Value(i, lessindex));
-         const TopoDS_Shape& aBottomEdge = aVEdges->Value(i, 1);
-
-         if((!aBottomEdge.IsNull()) && (aBottomEdge.ShapeType() == TopAbs_EDGE)) {
-           UpdateMap(aBottomEdge, aVEdges->Value(i, lessindex), myGenMap);
-         }
-       }
-      }
+  //Filling of <myGenMap>
+  const Handle(TopTools_HArray2OfShape)& anUEdges = theSweep.InterFaces();
+  BRep_Builder BB;
+  
+  TopTools_DataMapOfIntegerShape IndWireMap;
+  
+  Standard_Integer indw, inde;
+  TopoDS_Iterator itw;
+  for (indw = 1; indw <= mySeq.Length(); indw++)
+  {
+    const TopoDS_Wire& aSection = mySeq(indw).Wire();
+    Standard_Boolean IsPunctual = mySeq(indw).IsPunctual();
+    if (IsPunctual)
+    {
+      //for punctual sections (first or last)
+      //we take all the wires generated along the path
+      TopExp_Explorer Explo(aSection, TopAbs_VERTEX);
+      const TopoDS_Shape& VerSection = Explo.Current();
+      TopTools_ListOfShape Elist;
+      for (Standard_Integer i = 1; i <= anUEdges->UpperRow(); i++)
+        for (Standard_Integer j = 1; j <= anUEdges->UpperCol(); j++)
+          Elist.Append(anUEdges->Value(i,j));
+      myGenMap.Bind(VerSection, Elist);
+      continue;
     }
-    bPrevModified = Standard_False;
-
-    for(i = 1; i <= mySection->NbLaw(); i++) {
-      if((!aVEdges->Value(i, j).IsNull()) && (aVEdges->Value(i, j).ShapeType() == TopAbs_FACE)) {
-       aListOfFace.Append(aVEdges->Value(i, j));
-       bPrevModified = Standard_True;
-
-       const TopoDS_Shape& aBottomEdge = aVEdges->Value(i, 1);
-
-       if((!aBottomEdge.IsNull()) && (aBottomEdge.ShapeType() == TopAbs_EDGE)) {
-         UpdateMap(aBottomEdge, aVEdges->Value(i, j), myGenMap);
-       }
-      }
-
-      if(aFaces->Value(i, j).ShapeType() == TopAbs_FACE) {
-       aListOfFace.Append(aFaces->Value(i, j));
-       const TopoDS_Shape& aBottomEdge = aVEdges->Value(i, 1);
-
-       if((!aBottomEdge.IsNull()) && (aBottomEdge.ShapeType() == TopAbs_EDGE)) {
-         UpdateMap(aBottomEdge, aFaces->Value(i, j), myGenMap);
-       }
+    //Take the real index of section on the path
+    Standard_Integer IndOfW = myIndOfSec(indw);
+    const TopoDS_Wire& theWire = TopoDS::Wire(WSeq(IndOfW));
+    BRepTools_WireExplorer wexp_sec(aSection);
+    for (inde = 1; wexp_sec.More(); wexp_sec.Next())
+    {
+      const TopoDS_Edge& anEdge = TopoDS::Edge(wexp_sec.Current());
+      if (BRep_Tool::Degenerated(anEdge))
+        continue;
+
+      TopoDS_Shell aShell;
+      BB.MakeShell(aShell);
+      TopoDS_Vertex aVertex [2];
+      TopExp::Vertices(anEdge, aVertex[0], aVertex[1]);
+      Standard_Integer SignOfAnEdge =
+        (anEdge.Orientation() == TopAbs_FORWARD)? 1 : -1;
+      
+      //For each non-degenerated inde-th edge of <aSection>
+      //we find inde-th edge in <theWire>
+      TopoDS_Edge theEdge;
+      BRepTools_WireExplorer wexp(theWire);
+      for (Standard_Integer i = 1; wexp.More(); wexp.Next())
+      {
+        theEdge = TopoDS::Edge(wexp.Current());
+        if (BRep_Tool::Degenerated(anEdge))
+          continue;
+        if (i == inde)
+          break;
+        i++;
       }
-    }
 
-    if(!myGenMap.IsBound(myLocation->Edge(j)))
-      myGenMap.Bind(myLocation->Edge(j), aListOfFace);
-    else
-      myGenMap.ChangeFind(myLocation->Edge(j)).Append(aListOfFace);
-
-    // build history for free booundaries.begin
-    if(!mySection->IsUClosed()) {
-      TopoDS_Compound aFaceComp;
-      BRep_Builder aB;
-      aB.MakeCompound(aFaceComp);
-      TopTools_ListIteratorOfListOfShape anIt(aListOfFace);
-
-      for(; anIt.More(); anIt.Next()) {
-       aB.Add(aFaceComp, anIt.Value());
+      //Take the list of splits for <theEdge>
+      const TopTools_ListOfShape& NewEdges = myEdgeNewEdges(theEdge);
+      Standard_Integer SignOfANewEdge = 0, SignOfIndex = 0;
+      TopTools_ListIteratorOfListOfShape iter(NewEdges);
+      for (; iter.More(); iter.Next())
+      {
+        const TopoDS_Edge& aNewEdge = TopoDS::Edge(iter.Value());
+        SignOfANewEdge = (aNewEdge.Orientation() == TopAbs_FORWARD)? 1 : -1;
+        Standard_Integer anIndE = mySection->IndexOfEdge(aNewEdge);
+        SignOfIndex = (anIndE > 0)? 1 : -1;
+        anIndE = Abs(anIndE);
+        //For an edge generated shape is a "tape" -
+        //a shell usually containing this edge and
+        //passing from beginning of path to its end
+        TopoDS_Shape aTape = theSweep.Tape(anIndE);
+        TopoDS_Iterator itsh(aTape);
+        for (; itsh.More(); itsh.Next())
+          BB.Add(aShell, itsh.Value());
       }
-      TopTools_IndexedDataMapOfShapeListOfShape aMapEF;
-      TopExp::MapShapesAndAncestors(aFaceComp, TopAbs_EDGE, TopAbs_FACE, aMapEF);
-      Standard_Integer eit = 0;
-
-      for(eit = aUEdges->LowerRow(); eit <= aUEdges->UpperRow(); eit++) {
-       const TopoDS_Shape& aShape = aUEdges->Value(eit, j);
-
-       if(aMapEF.Contains(aShape)) {
-         const TopTools_ListOfShape& aList = aMapEF.FindFromKey(aShape);
-
-         if(aList.Extent() < 2) {
-           UpdateMap(myLocation->Edge(j), aShape, myGenMap);
-
-           TopoDS_Shape aGenVertex;
-           TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
-           
-           for(i = 1; i <= mySection->NbLaw(); i++) {
-             const TopoDS_Shape& aBottomEdge = aVEdges->Value(i, aVEdges->LowerCol());
 
-             if((!aBottomEdge.IsNull()) && (aBottomEdge.ShapeType() == TopAbs_EDGE)) {
-               TopExp::MapShapesAndAncestors(aBottomEdge, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
-             }
-           }
-           const TopoDS_Shape& aFreeEdge = aUEdges->Value(eit, aUEdges->LowerCol());
-           TopExp::MapShapesAndAncestors(aFreeEdge, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
-           TopExp_Explorer anExpV(aFreeEdge, TopAbs_VERTEX);
-
-           for(; anExpV.More(); anExpV.Next()) {
-             if(aMapVE.Contains(anExpV.Current())) {
-               const TopTools_ListOfShape& aListOfV = aMapVE.FindFromKey(anExpV.Current());
-
-               if(aListOfV.Extent() >= 2) {
-                 aGenVertex = anExpV.Current();
-               }
-             }
-           }
-
-           if(!aGenVertex.IsNull()) {
-             UpdateMap(aGenVertex, aShape, myGenMap);
-           }
-         }
-       }
+      //Processing of vertices of <anEdge>
+      //We should choose right index in <anUEdges>
+      //for each vertex of edge 
+      Standard_Integer ToReverse = SignOfAnEdge * SignOfANewEdge * SignOfIndex;
+      Standard_Integer UIndex [2];
+      UIndex[0] = Abs(mySection->IndexOfEdge(NewEdges.First()));
+      UIndex[1] = Abs(mySection->IndexOfEdge(NewEdges.Last())) + ToReverse;
+      if (ToReverse == -1)
+      {
+        UIndex[0]++;
+        UIndex[1]++;
       }
-      // end for(eit = aUEdges->LowerRow...
-    }
-    // build history for free booundaries.end
-  }
-
-  // build history for boundary section wires. begin
-
-  if(!mySeq.IsEmpty()) {
-    Standard_Integer iseq;
-    TopoDS_Wire aSect;
-    gp_Trsf aTrsf;
-    Standard_Real param = 0., aparmin = RealLast(), aparmax = -RealLast();
-    Standard_Integer ideb = 1, ifin = mySeq.Length();
-
-    for (iseq = 1;iseq <= mySeq.Length(); iseq++) {
-      Place(mySeq(iseq), aSect, aTrsf, param);
-
-      if(param < aparmin) {
-       ideb = iseq;
-       aparmin = param;
+      if (mySection->IsUClosed())
+      {
+        if (UIndex[0] > mySection->NbLaw())
+          UIndex[0] = 1;
+        if (UIndex[1] > mySection->NbLaw())
+          UIndex[1] = 1;
       }
+      //if (SignOfAnEdge * SignOfANewEdge == -1)
+      if (SignOfAnEdge   == -1 ||
+          SignOfANewEdge == -1)
+      { Standard_Integer Tmp = UIndex[0]; UIndex[0] = UIndex[1]; UIndex[1] = Tmp; }
+
+      TopTools_IndexedDataMapOfShapeListOfShape VEmap;
+      TopExp::MapShapesAndAncestors(aShell, TopAbs_VERTEX, TopAbs_EDGE, VEmap);
+      for (Standard_Integer kk = 0; kk < 2; kk++)
+      {
+        if (myGenMap.IsBound(aVertex[kk]))
+          continue;
+        if (IndWireMap.IsBound(UIndex[kk]))
+        {
+          TopTools_ListOfShape Wlist;
+          Wlist.Append(IndWireMap(UIndex[kk]));
+          myGenMap.Bind(aVertex[kk], Wlist);
+          continue;
+        }
+        
+        //Collect u-edges
+        TopTools_SequenceOfShape SeqEdges;
+        Standard_Integer jj;
+        for (jj = 1; jj <= anUEdges->UpperCol(); jj++)
+          SeqEdges.Append(anUEdges->Value(UIndex[kk], jj));
+
+        //Assemble the wire ("rail" along the path)
+        //checking for possible holes
+        //(they appear with option "Round Corner")
+        //and filling them
+        //Missed edges are taken from <aShell>
+        TopoDS_Wire aWire;
+        BB.MakeWire(aWire);
+        const TopoDS_Edge& FirstEdge = TopoDS::Edge(SeqEdges(1));
+        if (FirstEdge.IsNull())
+          continue;
+        BB.Add(aWire, FirstEdge);
+        TopoDS_Vertex FirstVertex, CurVertex;
+        TopExp::Vertices(FirstEdge, FirstVertex, CurVertex);
+        TopoDS_Edge CurEdge;
+        for (jj = 2; jj <= SeqEdges.Length(); jj++)
+        {
+          CurEdge = TopoDS::Edge(SeqEdges(jj));
+          TopoDS_Vertex Vfirst, Vlast;
+          TopExp::Vertices(CurEdge, Vfirst, Vlast);
+          if (CurVertex.IsSame(Vfirst))
+            CurVertex = Vlast;
+          else //a hole
+          {
+            const TopTools_ListOfShape& Elist = VEmap.FindFromKey(Vfirst);
+            TopTools_ListIteratorOfListOfShape itl(Elist);
+            for (; itl.More(); itl.Next())
+            {
+              const TopoDS_Edge& Candidate = TopoDS::Edge(itl.Value());
+              if (Candidate.IsSame(CurEdge))
+                continue;
+              TopoDS_Vertex V1, V2;
+              TopExp::Vertices(Candidate, V1, V2);
+              if (V1.IsSame(CurVertex) || V2.IsSame(CurVertex))
+              {
+                BB.Add(aWire, Candidate);
+                break;
+              }
+            }
+          }
+          CurVertex = Vlast;
+          BB.Add(aWire, CurEdge);
+        } //for (jj = 2; jj <= SeqEdges.Length(); jj++)
+        //case of closed wire
+        if (mySection->IsVClosed() &&
+            !CurVertex.IsSame(FirstVertex))
+        {
+          const TopTools_ListOfShape& Elist = VEmap.FindFromKey(CurVertex);
+          TopTools_ListIteratorOfListOfShape itl(Elist);
+          for (; itl.More(); itl.Next())
+          {
+            const TopoDS_Edge& Candidate = TopoDS::Edge(itl.Value());
+            if (Candidate.IsSame(CurEdge))
+              continue;
+            TopoDS_Vertex V1, V2;
+            TopExp::Vertices(Candidate, V1, V2);
+            if (V1.IsSame(FirstVertex) || V2.IsSame(FirstVertex))
+            {
+              BB.Add(aWire, Candidate);
+              break;
+            }
+          }
+        }
+        TopTools_ListOfShape Wlist;
+        Wlist.Append(aWire);
+        myGenMap.Bind(aVertex[kk], Wlist);
+        //Save already built wire with its index
+        IndWireMap.Bind(UIndex[kk], aWire);
+      } //for (Standard_Integer kk = 0; kk < 2; kk++)
+      ////////////////////////////////////
+      
+      TopTools_ListOfShape ListShell;
+      ListShell.Append(aShell);
+      myGenMap.Bind(anEdge, ListShell);
+      ////////////////////////
 
-      if(param > aparmax) {
-       ifin = iseq;
-       aparmax = param;
-      }
+      inde++;
     }
-    
-    UpdateMap(mySeq(ideb).Wire(), myFirst, myGenMap);
-    UpdateMap(mySeq(ifin).Wire(), myLast, myGenMap);
   }
-  // build history for boundary section wires. end
 }
 
-// ---------------------------------------------------------------------------------
-// static function: UpdateMap
-// purpose:
-// ---------------------------------------------------------------------------------
-Standard_Boolean UpdateMap(const TopoDS_Shape&                 theKey,
-                          const TopoDS_Shape&                 theValue,
-                          TopTools_DataMapOfShapeListOfShape& theMap) {
-
-  if(!theMap.IsBound(theKey)) {
-    TopTools_ListOfShape thelist;
-    theMap.Bind(theKey, thelist);
-  }
-  TopTools_ListOfShape& aList = theMap.ChangeFind(theKey);
-  TopTools_ListIteratorOfListOfShape anIt(aList);
-  Standard_Boolean found = Standard_False;
-
-  for(; anIt.More(); anIt.Next()) {
-    if(theValue.IsSame(anIt.Value())) {
-      found = Standard_True;
-      break;
-    }
-  }
-
-  if(!found)
-    aList.Append(theValue);
-  return !found;
-}
 
 // ---------------------------------------------------------------------------------
 // static function: BuildBoundaries
index 342f013..c2301f7 100644 (file)
@@ -34,6 +34,8 @@
 #include <MMgt_TShared.hxx>
 #include <BRepFill_TypeOfContact.hxx>
 #include <TopTools_ListOfShape.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
 class Law_Function;
 class BRepFill_LocationLaw;
 class BRepFill_SectionLaw;
@@ -213,6 +215,9 @@ private:
   TopoDS_Shape myLast;
   TopoDS_Shape myShape;
   BRepFill_SequenceOfSection mySeq;
+  TopTools_SequenceOfShape WSeq;
+  TColStd_SequenceOfInteger  myIndOfSec;
+  TopTools_DataMapOfShapeListOfShape myEdgeNewEdges;
   TopTools_DataMapOfShapeListOfShape myGenMap;
   Standard_Real myTol3d;
   Standard_Real myBoundTol;
index e1674c2..5cff512 100644 (file)
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
 
-BRepFill_Section::BRepFill_Section() :islaw(0), contact(0), correction(0)
+BRepFill_Section::BRepFill_Section() :islaw(0),
+                                      ispunctual(0),
+                                      contact(0),
+                                      correction(0)
 {
 }
 
@@ -33,13 +36,16 @@ BRepFill_Section::BRepFill_Section(const TopoDS_Shape& Profile,
                                   const Standard_Boolean WithContact,
                                   const Standard_Boolean WithCorrection) 
                                   : vertex(V),
-                                   islaw(0),contact(WithContact),
+                                   islaw(0),
+                                    ispunctual(0),
+                                    contact(WithContact),
                                    correction(WithCorrection)
 {
   if (Profile.ShapeType() == TopAbs_WIRE)
     wire = TopoDS::Wire(Profile);
   else if (Profile.ShapeType() == TopAbs_VERTEX)
     {
+      ispunctual = Standard_True;
       TopoDS_Vertex aVertex = TopoDS::Vertex(Profile);
       BRep_Builder BB;
       
index 2857809..ede9091 100644 (file)
@@ -49,6 +49,8 @@ public:
   
     Standard_Boolean IsLaw() const;
   
+    Standard_Boolean IsPunctual() const;
+  
     Standard_Boolean WithContact() const;
   
     Standard_Boolean WithCorrection() const;
@@ -69,10 +71,10 @@ private:
   TopoDS_Wire wire;
   TopoDS_Vertex vertex;
   Standard_Boolean islaw;
+  Standard_Boolean ispunctual;
   Standard_Boolean contact;
   Standard_Boolean correction;
 
-
 };
 
 
index 35c4756..5b80bc9 100644 (file)
@@ -29,6 +29,11 @@ inline Standard_Boolean  BRepFill_Section::IsLaw() const
   return islaw;
 }
 
+inline Standard_Boolean  BRepFill_Section::IsPunctual() const
+{
+  return ispunctual;
+}
+
 inline Standard_Boolean  BRepFill_Section::WithContact() const
 {
   return contact;
index 516cf42..2ea7248 100644 (file)
@@ -61,6 +61,15 @@ Standard_Integer BRepFill_SectionLaw::NbLaw() const
 }
 
 //=======================================================================
+//function : Indices
+//purpose  :
+//=======================================================================
+Standard_Integer BRepFill_SectionLaw::IndexOfEdge(const TopoDS_Shape& anEdge) const
+{
+  return myIndices(anEdge);
+}
+
+//=======================================================================
 //function : IsUClosed
 //purpose  : 
 //=======================================================================
index ba26ed0..8d5dfcf 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_Type.hxx>
 
 #include <GeomFill_HArray1OfSectionLaw.hxx>
+#include <TopTools_DataMapOfShapeInteger.hxx>
 #include <Standard_Boolean.hxx>
 #include <BRepTools_WireExplorer.hxx>
 #include <MMgt_TShared.hxx>
@@ -33,7 +34,6 @@ class TopoDS_Shape;
 class TopoDS_Wire;
 class TopoDS_Edge;
 
-
 class BRepFill_SectionLaw;
 DEFINE_STANDARD_HANDLE(BRepFill_SectionLaw, MMgt_TShared)
 
@@ -48,6 +48,8 @@ public:
   
   Standard_EXPORT const Handle(GeomFill_SectionLaw)& Law (const Standard_Integer Index) const;
   
+  Standard_EXPORT Standard_Integer IndexOfEdge(const TopoDS_Shape& anEdge) const;
+  
   Standard_EXPORT virtual Standard_Boolean IsConstant() const = 0;
   
   Standard_EXPORT Standard_Boolean IsUClosed() const;
@@ -56,7 +58,7 @@ public:
   
   Standard_EXPORT Standard_Boolean IsDone() const;
   
-  //! Say if the input sahpe is a  vertex.
+  //! Say if the input shape is a  vertex.
   Standard_EXPORT virtual Standard_Boolean IsVertex() const = 0;
   
   Standard_EXPORT virtual Handle(GeomFill_SectionLaw) ConcatenedLaw() const = 0;
@@ -85,6 +87,7 @@ protected:
   Standard_Boolean uclosed;
   Standard_Boolean vclosed;
   Standard_Boolean myDone;
+  TopTools_DataMapOfShapeInteger myIndices;
 
 
 private:
index b95baae..fbe040b 100644 (file)
@@ -144,6 +144,7 @@ void BRepFill_ShapeLaw::Init(const Standard_Boolean Build)
       Handle(Geom_Curve) C = BRep_Tool::Curve(E,First,Last);
       if( !C.IsNull() ) {
        myEdges->SetValue(ii, E);
+        myIndices.Bind(E, ii);
        if(Build) {
          //Handle(Geom_Curve) C = BRep_Tool::Curve(E,First,Last);
          if (E.Orientation() == TopAbs_REVERSED) {
index 7037f12..0b46b68 100644 (file)
@@ -2733,6 +2733,14 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
     myUEdges = new (TopTools_HArray2OfShape) (1, NbLaw+1, 1, NbPath);
     myVEdges = new (TopTools_HArray2OfShape) (1, NbLaw, 1, NbPath+1); 
     myFaces = new (TopTools_HArray2OfShape) (1, NbLaw, 1, NbPath);
+    myTapes = new (TopTools_HArray1OfShape) (1, NbLaw);
+    BRep_Builder BB;
+    for (Standard_Integer i = 1; i <= NbLaw; i++)
+    {
+      TopoDS_Shell aShell;
+      BB.MakeShell(aShell);
+      myTapes->ChangeValue(i) = aShell;
+    }
     Handle (TopTools_HArray2OfShape) Bounds =  
       new (TopTools_HArray2OfShape) (1, NbLaw, 1, 2);
  
@@ -2869,6 +2877,14 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
       }
     }
 
+    for (ii = 1; ii <= NbLaw; ii++)
+      for (jj = 1; jj <= NbPath; jj++)
+      {
+        const TopoDS_Shape& aFace = myFaces->Value(ii,jj);
+        if (!aFace.IsNull() && aFace.ShapeType() == TopAbs_FACE)
+          BB.Add(myTapes->ChangeValue(ii), aFace);
+      }
+
     // Is it Closed ?
     if (myLoc->IsClosed() && mySec->IsUClosed()) {
       //Check
@@ -2945,6 +2961,15 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
 }
 
 //=======================================================================
+//function : Tape
+//purpose  : returns the Tape corresponding to Index-th edge of section
+//=======================================================================
+TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
+{
+  return myTapes->Value(Index);
+}
+
+//=======================================================================
 //function : PerformCorner
 //purpose  : Trim and/or loop a corner
 //======================================================================
@@ -3152,6 +3177,8 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
          if (B) {
            myAuxShape.Append(FF);
            myVEdges->ChangeValue(ii, I2) = FF;
+            BRep_Builder BB;
+            BB.Add(myTapes->ChangeValue(ii), FF);
            HasFilling = Standard_True;
          }
          if (ii==1) BordFirst = Bord1;
index 618de7c..b3b003a 100644 (file)
@@ -111,6 +111,8 @@ public:
   
   Standard_EXPORT Handle(TopTools_HArray2OfShape) Sections() const;
 
+  //! returns the Tape corresponding to Index-th edge of section
+  Standard_EXPORT TopoDS_Shape Tape(const Standard_Integer Index) const;
 
 
 
@@ -161,6 +163,7 @@ private:
   TopTools_DataMapOfShapeShape myVEdgesModified;
   Handle(TopTools_HArray2OfShape) myFaces;
   TopTools_ListOfShape myAuxShape;
+  Handle(TopTools_HArray1OfShape) myTapes;
   Standard_Real Error;
   TopoDS_Wire FirstShape;
   TopoDS_Wire LastShape;
index f79c5d2..513acae 100644 (file)
@@ -55,12 +55,9 @@ class Law_Function;
 //! - normal defined by a guiding contour.
 //! The two global approaches can also be combined.
 //! You can also close the surface later in order to form a solid.
-//! Warning: In this version some limitation exist
-//! -- We can add only 1 Section (else Standard_NotImplemented is raised
+//! Warning: some limitations exist
 //! -- Mode with auxilary spine is incompatible with hometetic laws
 //! -- Mode with auxilary spine and keep contact produce only CO surface.
-//! -- Transition treatement is implemented only with the option <BRepBuilderAPI_Transformed>
-//! Normaly all these limitations have to be deleted in mext version.
 class BRepOffsetAPI_MakePipeShell  : public BRepPrimAPI_MakeSweep
 {
 public:
@@ -259,28 +256,7 @@ public:
   //! Returns a list of new shapes generated from the shape
   //! S by the shell-generating algorithm.
   //! This function is redefined from BRepOffsetAPI_MakeShape::Generated.
-  //! S can be an edge of the given Spine (see Constructor),
-  //! it can be an edge or a boundary vertex of a shape
-  //! returned by the method FirstShape(), it can also be a
-  //! Profile (see method Add()) closest to the beginning or
-  //! the end of the Spine.
-  //! If S is an edge of the given Spine, then method
-  //! Generated() returns a list of generated faces and a list
-  //! of edges from a free boundary (if it exists) of the
-  //! resulting shell.
-  //! If S is an edge of the start shape (see FirstShape()),
-  //! method Generated() returns a list of faces generated
-  //! along the whole spine from the given edge.
-  //! If S is a boundary vertex of the start shape (see
-  //! FirstShape()), method Generated() returns a list of
-  //! edges from the free boundary of the resulting shell,
-  //! generated along the whole spine.
-  //! If S is a Profile closest to the beginning of the Spine,
-  //! method Generated() returns the start shape, that can
-  //! also be obtained by method FirstShape().
-  //! If S is a Profile closest to the end of the Spine, method
-  //! Generated() returns the end shape, that can also be
-  //! obtained by method LastShape().
+  //! S can be an edge or a vertex of a given Profile (see methods Add).
   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
   
   Standard_EXPORT Standard_Real ErrorOnSurface() const;
index de1a750..1c225ca 100644 (file)
@@ -758,6 +758,45 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
 }
 
 //=======================================================================
+//function : gensweep
+//purpose  : returns generated shape for subshape of a section of sweep
+//           Sweep must be done previously
+//=======================================================================
+static Standard_Integer gensweep(Draw_Interpretor&,
+                                 Standard_Integer n, const char** a)
+{
+  if (n != 3)
+  {
+    cout<<"Usage: gensweep res subshape_of_profile, sweep must be done"<<endl;
+    return 1;
+  }
+  if (!Sweep->IsDone())
+  {
+    cout<<"Sweep is not done"<<endl;
+    return 1;
+  }
+  TopoDS_Shape aShape = DBRep::Get(a[2]);
+  if (aShape.IsNull())
+  {
+    cout<<"Null subshape"<<endl;
+    return 1;
+  }
+  TopTools_ListOfShape Shells = Sweep->Generated(aShape);
+  TopoDS_Compound aCompound;
+  BRep_Builder BB;
+  BB.MakeCompound(aCompound);
+  TopTools_ListIteratorOfListOfShape itsh(Shells);
+  for (; itsh.More(); itsh.Next())
+  {
+    const TopoDS_Shape& aShell = itsh.Value();
+    BB.Add(aCompound, aShell);
+  }
+
+  DBRep::Set(a[1], aCompound);
+  return 0;
+}
+
+//=======================================================================
 //  simulsweep
 //=======================================================================
 static Standard_Integer simulsweep(Draw_Interpretor& di,
@@ -891,9 +930,12 @@ void  BRepTest::SweepCommands(Draw_Interpretor& theCommands)
                  "deletesweep wire, To delete a section",
                  __FILE__,deletesweep,g);
 
-  theCommands.Add("buildsweep", "builsweep [r] [option] [Tol] , no args to get help"
+ theCommands.Add("buildsweep", "builsweep [r] [option] [Tol] , no args to get help",
                  __FILE__,buildsweep,g);
 
+ theCommands.Add("gensweep", "gensweep res subshape_of_profile",
+                 __FILE__,gensweep,g);
+
   theCommands.Add("simulsweep", "simulsweep r [n] [option]"
                  __FILE__,simulsweep,g);
   theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]"
diff --git a/tests/bugs/modalg_6/bug27386_1 b/tests/bugs/modalg_6/bug27386_1
new file mode 100644 (file)
index 0000000..6a9df80
--- /dev/null
@@ -0,0 +1,32 @@
+puts "============"
+puts "OCC27386"
+puts "============"
+puts ""
+#####################################################################
+# BRepOffsetAPI_MakePipeShell does not provide history of generations
+#####################################################################
+
+
+restore [locate_data_file bug27386_s.brep] sp
+restore [locate_data_file bug27386_p.brep] pr
+explode pr
+donly sp pr_1
+
+mksweep sp
+setsweep -CN -0.0101004948353626 0 0.999948988700964
+addsweep pr_1
+buildsweep q
+
+explode pr_1
+
+gensweep r1 pr_1_1
+gensweep r2 pr_1_2
+gensweep r3 pr_1_3
+gensweep r4 pr_1_4
+
+explode pr_1 v
+
+gensweep r1 pr_1_1
+gensweep r2 pr_1_2
+gensweep r3 pr_1_3
+gensweep r4 pr_1_4
diff --git a/tests/bugs/modalg_6/bug27386_2 b/tests/bugs/modalg_6/bug27386_2
new file mode 100644 (file)
index 0000000..d3fd93f
--- /dev/null
@@ -0,0 +1,66 @@
+puts "============"
+puts "OCC27386"
+puts "============"
+puts ""
+#####################################################################
+# BRepOffsetAPI_MakePipeShell does not provide history of generations
+#####################################################################
+
+
+restore [locate_data_file bug27386_sp.brep] sp
+restore [locate_data_file bug27386_pr1.brep] pr1
+restore [locate_data_file bug27386_pr2.brep] pr2
+restore [locate_data_file bug27386_pr3.brep] pr3
+
+mksweep sp
+addsweep pr3
+addsweep pr1
+addsweep pr2
+buildsweep q
+
+explode pr1
+explode pr2
+explode pr3
+
+gensweep r1_1 pr1_1
+gensweep r1_2 pr1_2
+gensweep r1_3 pr1_3
+gensweep r1_4 pr1_4
+
+gensweep r2_1 pr2_1
+gensweep r2_2 pr2_2
+gensweep r2_3 pr2_3
+
+gensweep r3_1 pr3_1
+
+checknbshapes r1_1 -face 1
+checkprops r1_1 -s 1070.74
+checknbshapes r1_2 -face 2
+checkprops r1_2 -s 1210.46
+checknbshapes r1_3 -face 2
+checkprops r1_3 -s 1506.95
+checknbshapes r1_4 -face 3
+checkprops r1_4 -s 1210.02
+checknbshapes r2_1 -face 3
+checkprops r2_1 -s 1776.97
+checknbshapes r2_2 -face 2
+checkprops r2_2 -s 1777.4
+checknbshapes r2_3 -face 3
+checkprops r2_3 -s 1443.8
+checknbshapes r3_1 -face 8
+checkprops r3_1 -s 4998.17
+
+explode pr1 v
+explode pr2 v
+explode pr3 v
+
+gensweep r1_1 pr1_1
+gensweep r1_2 pr1_2
+gensweep r1_3 pr1_3
+gensweep r1_4 pr1_4
+
+gensweep r2_1 pr2_1
+gensweep r2_2 pr2_2
+gensweep r2_3 pr2_3
+
+gensweep r3_1 pr3_1
diff --git a/tests/bugs/modalg_6/bug27386_3 b/tests/bugs/modalg_6/bug27386_3
new file mode 100644 (file)
index 0000000..20319f8
--- /dev/null
@@ -0,0 +1,55 @@
+puts "============"
+puts "OCC27386"
+puts "============"
+puts ""
+#####################################################################
+# BRepOffsetAPI_MakePipeShell does not provide history of generations
+#####################################################################
+
+
+restore [locate_data_file bug27386_sp.brep] sp
+polyline pr1 -5 0 0  -5 -5 0  5 -5 0  5 0 0
+restore [locate_data_file bug27386_pr2.brep] pr2
+explode pr2
+wire pr2 pr2_1 pr2_2
+circle cc 0 100 0  5
+trim cc cc 0 pi
+mkedge pr3 cc
+wire pr3 pr3
+donly sp pr1 pr2 pr3
+
+
+mksweep sp
+addsweep pr3
+addsweep pr1
+addsweep pr2
+buildsweep q
+
+explode pr1
+explode pr2
+explode pr3
+
+gensweep r1_1 pr1_1
+gensweep r1_2 pr1_2
+gensweep r1_3 pr1_3
+
+gensweep r2_1 pr2_1
+gensweep r2_2 pr2_2
+
+gensweep r3_1 pr3_1
+
+explode pr1 v
+explode pr2 v
+explode pr3 v
+
+gensweep r1_1 pr1_1
+gensweep r1_2 pr1_2
+gensweep r1_3 pr1_3
+gensweep r1_4 pr1_4
+
+gensweep r2_1 pr2_1
+gensweep r2_2 pr2_2
+gensweep r2_3 pr2_3
+
+gensweep r3_1 pr3_1
+gensweep r3_2 pr3_2
diff --git a/tests/bugs/modalg_6/bug27386_4 b/tests/bugs/modalg_6/bug27386_4
new file mode 100644 (file)
index 0000000..56a6343
--- /dev/null
@@ -0,0 +1,34 @@
+puts "============"
+puts "OCC27386"
+puts "============"
+puts ""
+#####################################################################
+# BRepOffsetAPI_MakePipeShell does not provide history of generations
+#####################################################################
+
+
+restore [locate_data_file bug27386_sp.brep] sp
+restore [locate_data_file bug27386_pr2.brep] pr2
+explode sp v
+donly sp sp_1 pr2 sp_2
+
+mksweep sp
+addsweep sp_1
+addsweep pr2
+addsweep sp_2
+buildsweep q
+
+explode pr2
+
+gensweep r1 pr2_1
+gensweep r2 pr2_2
+gensweep r3 pr2_3
+
+explode pr2 v
+
+gensweep r1 pr2_1
+gensweep r2 pr2_2
+gensweep r3 pr2_3
+
+gensweep r4 sp_1
+gensweep r5 sp_2
diff --git a/tests/bugs/modalg_6/bug27386_5 b/tests/bugs/modalg_6/bug27386_5
new file mode 100644 (file)
index 0000000..c581984
--- /dev/null
@@ -0,0 +1,42 @@
+puts "============"
+puts "OCC27386"
+puts "============"
+puts ""
+#####################################################################
+# BRepOffsetAPI_MakePipeShell does not provide history of generations
+#####################################################################
+
+
+circle cc 0 0 0 100
+circle c1 0 100 0  1 0 0  10
+polyline pr2 0 -90 0  0 -100 10  0 -110 0  0 -100 -10  0 -90 0
+mkedge sp cc
+wire sp sp
+mkedge pr1 c1
+wire pr1 pr1
+donly sp pr1 pr2
+
+mksweep sp
+addsweep pr2
+addsweep pr1
+buildsweep q
+
+explode pr1
+explode pr2
+
+gensweep r1_1 pr1_1
+
+gensweep r2_1 pr2_1
+gensweep r2_2 pr2_2
+gensweep r2_3 pr2_3
+gensweep r2_4 pr2_4
+
+explode pr1 v
+explode pr2 v
+
+gensweep r1_1 pr1_1
+
+gensweep r2_1 pr2_1
+gensweep r2_2 pr2_2
+gensweep r2_3 pr2_3
+gensweep r2_4 pr2_4
diff --git a/tests/bugs/modalg_6/bug27386_6 b/tests/bugs/modalg_6/bug27386_6
new file mode 100644 (file)
index 0000000..308f070
--- /dev/null
@@ -0,0 +1,46 @@
+puts "============"
+puts "OCC27386"
+puts "============"
+puts ""
+#####################################################################
+# BRepOffsetAPI_MakePipeShell does not provide history of generations
+#####################################################################
+
+
+circle cc 0 0 0 100
+circle c1 0 100 0  1 0 0  10
+polyline pr2 0 -90 0  0 -100 10  0 -110 0  0 -100 -10  0 -90 0
+mkedge sp cc
+wire sp sp
+mkedge pr1 c1
+wire pr1 pr1
+explode sp v
+donly sp pr1 pr2 sp_1
+
+mksweep sp
+addsweep sp_1
+addsweep pr1
+addsweep pr2
+buildsweep q
+
+explode pr1
+explode pr2
+
+gensweep r1_1 pr1_1
+
+gensweep r2_1 pr2_1
+gensweep r2_2 pr2_2
+gensweep r2_3 pr2_3
+gensweep r2_4 pr2_4
+
+explode pr1 v
+explode pr2 v
+
+gensweep r1_1 pr1_1
+
+gensweep r2_1 pr2_1
+gensweep r2_2 pr2_2
+gensweep r2_3 pr2_3
+gensweep r2_4 pr2_4
+
+gensweep r3 sp_1
diff --git a/tests/bugs/modalg_6/bug27386_7 b/tests/bugs/modalg_6/bug27386_7
new file mode 100644 (file)
index 0000000..1cc7c38
--- /dev/null
@@ -0,0 +1,29 @@
+puts "============"
+puts "OCC27386"
+puts "============"
+puts ""
+#####################################################################
+# BRepOffsetAPI_MakePipeShell does not provide history of generations
+#####################################################################
+
+
+restore [locate_data_file OCC1477-1.brep] sp
+restore [locate_data_file OCC1477-2.brep] pr
+
+mksweep sp
+addsweep pr
+buildsweep q -R
+
+explode pr
+
+gensweep r1 pr_1
+gensweep r2 pr_2
+gensweep r3 pr_3
+gensweep r4 pr_4
+
+explode pr v
+
+gensweep r1 pr_1
+gensweep r2 pr_2
+gensweep r3 pr_3
+gensweep r4 pr_4
diff --git a/tests/bugs/modalg_6/bug27386_8 b/tests/bugs/modalg_6/bug27386_8
new file mode 100644 (file)
index 0000000..6f326f7
--- /dev/null
@@ -0,0 +1,29 @@
+puts "============"
+puts "OCC27386"
+puts "============"
+puts ""
+#####################################################################
+# BRepOffsetAPI_MakePipeShell does not provide history of generations
+#####################################################################
+
+
+polyline sp 0 0 0 10 0 0 10 0 10 10 10 10 0 10 10 0 10 0 0 0 0
+polyline pr 0 -2 -2 0 2 -2 0 2 2 0 -2 2 0 -2 -2
+
+mksweep sp
+addsweep pr
+buildsweep q -R
+
+explode pr
+
+gensweep r1 pr_1
+gensweep r2 pr_2
+gensweep r3 pr_3
+gensweep r4 pr_4
+
+explode pr v
+
+gensweep r1 pr_1
+gensweep r2 pr_2
+gensweep r3 pr_3
+gensweep r4 pr_4