OCC22361 Incorrect result of BRepOffsetAPI_MakePipeShell algorithm: it tries to build...
authorJGV <>
Thu, 28 Apr 2011 15:43:38 +0000 (15:43 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:28:11 +0000 (19:28 +0400)
src/BRepFill/BRepFill_CompatibleWires.cxx
src/BRepFill/BRepFill_NSections.cdl
src/BRepFill/BRepFill_NSections.cxx
src/BRepFill/BRepFill_PipeShell.cdl
src/BRepFill/BRepFill_PipeShell.cxx

index a489c11..f32888c 100755 (executable)
@@ -13,6 +13,7 @@
 #include <BRepLib_FindSurface.hxx>
 #include <BRepLib_MakeWire.hxx>
 #include <BRepLib_MakeEdge.hxx>
+#include <BRepCheck_Wire.hxx>
 #include <BRepExtrema_DistShapeShape.hxx>
 #include <Bnd_Box.hxx>
 #include <BRepBndLib.hxx>
@@ -827,7 +828,9 @@ void BRepFill_CompatibleWires::
   Standard_Boolean allClosed = Standard_True;
   Standard_Integer i,ii,ideb=1,ifin=NbSects;
   for (i=1; i<=NbSects; i++) {
-    allClosed = (allClosed && myWork(i).Closed());
+    Handle(BRepCheck_Wire) Checker = new BRepCheck_Wire(TopoDS::Wire(myWork(i)));
+    allClosed = (allClosed && (Checker->Closed() == BRepCheck_NoError));
+    //allClosed = (allClosed && myWork(i).Closed());
   }
   if (!allClosed)
     Standard_NoSuchObject::Raise("BRepFill_CompatibleWires::SameNumberByPolarMethod : the wires must be closed");
index bcca3cf..f09cdff 100755 (executable)
@@ -13,8 +13,9 @@ class NSections from BRepFill inherits  SectionLaw  from  BRepFill
        
 uses 
  SectionLaw          from  GeomFill,  
- HArray1OfSectionLaw from  GeomFill, 
- BSplineSurface             from  Geom, 
+ HArray1OfSectionLaw from  GeomFill,
+ SequenceOfTrsf      from  GeomFill,
+ BSplineSurface      from  Geom, 
  HArray2OfShape      from  TopTools,  
  SequenceOfReal      from  TColStd,  
  SequenceOfShape     from  TopTools,  
@@ -31,10 +32,11 @@ is
      ---Purpose: Construct    
   returns NSections from BRepFill;  
    
-  Create (S  :  SequenceOfShape  from  TopTools; 
-         P  :  SequenceOfReal  from  TColStd; 
-         VF,VL :  Real; 
-          Build :  Boolean = Standard_True)   
+  Create (S      :  SequenceOfShape from  TopTools; 
+         Trsfs  :  SequenceOfTrsf  from  GeomFill; 
+         P      :  SequenceOfReal  from  TColStd; 
+         VF,VL  :  Real; 
+          Build  :  Boolean = Standard_True)   
      ---Purpose: Construct    
   returns NSections from BRepFill;  
    
@@ -79,7 +81,8 @@ is
 fields
   VFirst,  VLast : Real;
   myShapes:  SequenceOfShape  from  TopTools;
-  myParams:  SequenceOfReal  from  TColStd;   
+  myTrsfs:   SequenceOfTrsf   from  GeomFill;
+  myParams:  SequenceOfReal   from  TColStd;   
   myEdges:  HArray2OfShape from  TopTools;   
   mySurface:  BSplineSurface from  Geom;   
 end NSections;
index a3633a1..e5112c2 100755 (executable)
@@ -363,6 +363,7 @@ BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
 //=======================================================================
 
 BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
+                                       const GeomFill_SequenceOfTrsf& Transformations,
                                       const TColStd_SequenceOfReal & P,
                                       const Standard_Real VF,
                                       const Standard_Real VL,
@@ -389,6 +390,7 @@ BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
   if (ok) {
     myParams = P;
     myShapes = S;
+    myTrsfs = Transformations;
     VFirst = VF;
     VLast = VL;
     Init(P,Build);
@@ -434,7 +436,6 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
 //    if (! B.Degenerated(wexp.Current())) NbEdge++;
     if (! BRep_Tool::Degenerated(wexp.Current())) NbEdge++;
 
-  
   myEdges = new (TopTools_HArray2OfShape) (1, NbEdge, 1, NbSects);
   
   // On Remplit les tables
@@ -580,7 +581,7 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
  
       Standard_Real Ufirst = ii-1;
       Standard_Real Ulast = ii;
-      myLaws->ChangeValue(ii) = new (GeomFill_NSections)(NC,myParams,
+      myLaws->ChangeValue(ii) = new (GeomFill_NSections)(NC, myTrsfs, myParams,
                                                         Ufirst,Ulast,
                                                         VFirst,VLast,
                                                         mySurface);
@@ -724,7 +725,7 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
     for (Standard_Integer jj=1; jj<=myShapes.Length(); jj++) {
       NCompo.Append(mySurface->VIso(myParams(jj)));
     }
-    Law = new (GeomFill_NSections)(NCompo, myParams, 
+    Law = new (GeomFill_NSections)(NCompo, myTrsfs, myParams, 
                                   Ufirst, Ulast, 
                                   Vfirst, Vlast,
                                   mySurface);
index fd6fba6..1896196 100755 (executable)
@@ -10,7 +10,8 @@ class PipeShell from BRepFill inherits  TShared from MMgt
        ---Purpose: Perform general sweeping construction
 uses  
  Dir  from  gp,
- Ax2  from  gp, 
+ Ax2  from  gp,
+ Trsf from  gp,
  Function from Law,  
  ListOfShape  from  TopTools, 
  HArray2OfShape   from  TopTools,
@@ -236,6 +237,7 @@ is
     Place(me : mutable;  
          Sec  :  Section  from  BRepFill; 
           W    :  out  Wire   from  TopoDS; 
+          Trsf :  out  Trsf   from  gp; 
        param  :  out  Real  from  Standard)  is  private; 
           
     ResetLoc(me  :  mutable)  is  private;
index a76bfef..0829e8a 100755 (executable)
@@ -101,8 +101,8 @@ static Standard_Boolean ComputeSection(const TopoDS_Wire& W1,
   CW.SetPercent(0.1);
   CW.Perform();
   if (!CW.IsDone()) StdFail_NotDone::Raise("Uncompatible wires");
-  Handle(BRepFill_NSections) SL = new (BRepFill_NSections) (CW.Shape(),SR,0.,1.)
-;
+  GeomFill_SequenceOfTrsf EmptyTrsfs;
+  Handle(BRepFill_NSections) SL = new (BRepFill_NSections) (CW.Shape(),EmptyTrsfs,SR,0.,1.);
   Standard_Real US = p1/(p1+p2);
   SL->D0(US, Wres);
   return Standard_True;
@@ -831,7 +831,8 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape&   theShape,
  // Construction de la loi de section
   if (mySeq.Length() == 1) {
     Standard_Real p1;
-    Place(mySeq(1), theSect,p1);
+    gp_Trsf aTrsf;
+    Place(mySeq(1), theSect, aTrsf, p1);
     TopoDS_Wire aLocalShape = theSect;
     if (mySeq(1).IsLaw())
       mySection = new BRepFill_ShapeLaw(aLocalShape, myLaw);
@@ -844,9 +845,11 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape&   theShape,
     {
       TColStd_SequenceOfReal Param;
       TopTools_SequenceOfShape WSeq;
-      WSeq.Clear();
-      Param.Clear();
+      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.;
@@ -854,10 +857,11 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape&   theShape,
 //      for (Standard_Integer iseq=1;iseq<=mySeq.Length();iseq++) {
       Standard_Integer iseq;
       for (iseq=1;iseq<=mySeq.Length();iseq++) {
-       Place(mySeq(iseq), theSect, param);
+       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;
       }
@@ -949,7 +953,7 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape&   theShape,
       else {
        Standard_ConstructionError::Raise("PipeShell : uncompatible wires");
       }
-      mySection = new (BRepFill_NSections) (WorkingSections,Param,V1,V2);
+      mySection = new (BRepFill_NSections) (WorkingSections,Transformations,Param,V1,V2);
       
     }// else
 
@@ -983,6 +987,7 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape&   theShape,
 //=======================================================================
 void BRepFill_PipeShell::Place(const BRepFill_Section& Sec,
                               TopoDS_Wire& W,
+                               gp_Trsf& aTrsf,
                               Standard_Real& param)
 {
   BRepFill_SectionPlacement Place(myLocation, 
@@ -991,6 +996,7 @@ void BRepFill_PipeShell::Place(const BRepFill_Section& Sec,
                                  Sec.WithContact(),
                                  Sec.WithCorrection());
   W =  Sec.Wire();
+  aTrsf = Place.Transformation();
   TopLoc_Location Loc2(Place.Transformation()), Loc1;
   Loc1 = W.Location();
   W.Location(Loc2.Multiplied(Loc1));
@@ -1147,11 +1153,12 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
   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, param);
+      Place(mySeq(iseq), aSect, aTrsf, param);
 
       if(param < aparmin) {
        ideb = iseq;