]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022664: [CEA 1253] MakePipeWithDifferentSections fails on a elbow pipe
authorskv <skv@opencascade.com>
Tue, 21 Jul 2015 15:29:07 +0000 (18:29 +0300)
committerskv <skv@opencascade.com>
Tue, 21 Jul 2015 15:29:07 +0000 (18:29 +0300)
19 files changed:
doc/salome/examples/complex_objs_ex05.py
doc/salome/gui/GEOM/images/pipe3.png
doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc
idl/GEOM_Gen.idl
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
src/GEOMImpl/GEOMImpl_IPipe.hxx
src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx
src/GEOMImpl/GEOMImpl_PipeDriver.cxx
src/GEOMImpl/GEOMImpl_PipeDriver.hxx
src/GEOMImpl/GEOMImpl_PrismDriver.cxx
src/GEOM_I/GEOM_I3DPrimOperations_i.cc
src/GEOM_I/GEOM_I3DPrimOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_PY/structelem/parts.py
src/GEOM_SWIG/geomBuilder.py
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PipeDlg.h

index f38f0816b6feeb868b48d8a04ebf56203813a155..f6681b587c798827bfd27ca6722e22db4fba2c3c 100644 (file)
@@ -18,18 +18,22 @@ circles.append(geompy.MakeCircle(vertices[1], edges[0], 40))
 circles.append(geompy.MakeCircle(vertices[2], edges[2], 30))
 circles.append(geompy.MakeCircle(vertices[3], edges[2], 20))
 
-# create pipe
-Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
+# create pipes
+Pipe1 = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
+Pipe2 = geompy.MakePipeWithDifferentSectionsBySteps(circles, vertices, Wire_1)
 
 # add objects in the study
 geompy.addToStudy(circles[0], "circles1")
 geompy.addToStudy(circles[1], "circles2")
 geompy.addToStudy(circles[2], "circles3")
 geompy.addToStudy(circles[3], "circles4")
-id_wire = geompy.addToStudy(Wire_1, "Path")
-id_pipe = geompy.addToStudy(Pipe, "Pipe")
+id_wire  = geompy.addToStudy(Wire_1, "Path")
+id_pipe1 = geompy.addToStudy(Pipe1, "Pipe1")
+id_pipe2 = geompy.addToStudy(Pipe2, "Pipe2")
 
 # display the wire(path) and the pipe
 gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1) 
+gg.createAndDisplayGO(id_pipe1)
+gg.createAndDisplayGO(id_pipe2)
+gg.setDisplayMode(id_pipe1,1)
+gg.setDisplayMode(id_pipe2,1)
index d1b7f403112e899f565dd7a357a33e951efaa125..c5c3149152a256cb0e62efc775af7a4aaebc1902 100644 (file)
Binary files a/doc/salome/gui/GEOM/images/pipe3.png and b/doc/salome/gui/GEOM/images/pipe3.png differ
index 07808936287ba6ee8e1b666213f0cec263aa5fd1..84260fe68dac34089737d6dcf4d9cf330bc57d92 100644 (file)
@@ -72,18 +72,33 @@ Additional controls:
 - If <b>With contact</b> is checked, the section is translated in contact with the spine.
 - If <b>With correction</b> is checked, the section is rotated to be orthogonal to the spine
 tangent in the corresponding point.
+- If <b>Step-by-step generation</b> is checked, the result is created
+step-by-step, i.e. it creates pipes between each pair of neighbor sections and
+fuses them into a single shape.
+
+\note If <b>Step-by-step generation</b> is checked, <b>With contact</b> and
+<b>With correction</b> controls are disabled as corrections of bases are
+not allowed in step-by-step mode.
 
 <b>Generate groups</b> checkbox - if checked allows to create groups of
 sub-shapes. For more details on groups creation please refer to
 \ref create_groups_page "this description".
 \n The \b Result of the operation will be a shell or a solid.
 
-\n <b>TUI Command:</b> <em>geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection,
+\n <b>TUI Commands:</b>
+- <em>geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection,
  IsGenerateGroups=False)</em>
 \n <b>Arguments:</b> Name + list of shapes (edges, planar wires, faces or shells) serving as base object + 
 list of locations (vertices) on the path corresponding specified list of the shapes + 
 1 shape (edge or wire) for definition of the path + 
 3 Boolean parameters (withContact, withCorrection, IsGenerateGroups).
+- <em>geompy.MakePipeWithDifferentSectionsBySteps(baseShape, locations, pathShape,
+ IsGenerateGroups=False)</em>
+\n <b>Arguments:</b> Name + list of shapes (edges, planar wires, faces or shells) serving as base object +
+list of locations (vertices) on the path corresponding specified list of the shapes +
+1 shape (edge or wire) for definition of the path +
+Boolean parameter.
+
 \n <b>Advanced options</b> \ref preview_anchor "Preview"
 
 \image html pipe3.png
index d7c6435627d13fbace57442ac53581c2f2d217d7..4b56df00176ddccbbba241bfdbf8f23a70b720e1 100644 (file)
@@ -1808,9 +1808,13 @@ module GEOM
      *                        should be equal to number of bases or list of locations can be empty.
      *  \param thePath - Path shape to extrude the base shape along it.
      *  \param theWithContact - the mode defining that the section is translated to be in
-     *                          contact with the spine.
+     *                          contact with the spine. Ignored if IsBySteps is set.
      *  \param theWithCorrection - defining that the section is rotated to be
-     *                                 orthogonal to the spine tangent in the correspondent point
+     *                                 orthogonal to the spine tangent in
+     *                          the correspondent point. Ignored if IsBySteps is set.
+     *  \param IsBySteps - flag that tells if the result should be created
+     *         step by step or as a whole. If IsBySteps is set no correction
+     *         of bases is allowed.
      *  \param IsGenerateGroups flag that tells if it is necessary to
      *         return groups (true) or not (false).
      *  \return The list of objects. The first one is a result pipe,
@@ -1823,6 +1827,7 @@ module GEOM
                                             in GEOM_Object thePath,
                                             in boolean theWithContact ,
                                             in boolean theWithCorrection,
+                                            in boolean IsBySteps,
                                             in boolean IsGenerateGroups);
 
     /*!
index d9ce747c715870867503c5a8083b3748863571c2..606714b1e23962125175886062c0cec4f6607158 100644 (file)
@@ -1428,6 +1428,10 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_GROUP_NAME_PREFIX</source>
         <translation>Group Names Prefix</translation>
     </message>
+    <message>
+        <source>GEOM_STEP_BY_STEP</source>
+        <translation>Step-by-step generation</translation>
+    </message>
     <message>
         <source>GEOM_PLANE</source>
         <translation>Plane</translation>
index 0174470713c4a57ffbb447e6702b9c16b4d836df..4f46c1bbdb41622b4a906d3672019e81f7a83240 100644 (file)
@@ -1828,6 +1828,7 @@ Handle(TColStd_HSequenceOfTransient)
                const Handle(GEOM_Object)                  &thePath,
                const bool                                  theWithContact,
                const bool                                  theWithCorrections,
+               const bool                                  IsBySteps,
                const bool                                  IsGenerateGroups)
 {
   SetErrorCode(KO);
@@ -1897,8 +1898,13 @@ Handle(TColStd_HSequenceOfTransient)
   aCI.SetBases(aSeqBases);
   aCI.SetLocations(aSeqLocs);
   aCI.SetPath(aRefPath);
-  aCI.SetWithContactMode(theWithContact);
-  aCI.SetWithCorrectionMode(theWithCorrections);
+
+  if (!IsBySteps) {
+    aCI.SetWithContactMode(theWithContact);
+    aCI.SetWithCorrectionMode(theWithCorrections);
+  }
+
+  aCI.SetIsBySteps(IsBySteps);
   aCI.SetGenerateGroups(IsGenerateGroups);
 
   //Compute the Pipe value
@@ -1930,7 +1936,11 @@ Handle(TColStd_HSequenceOfTransient)
     pyDump << aPipeDS;
   }
 
-  pyDump << " = geompy.MakePipeWithDifferentSections([";
+  if (IsBySteps) {
+    pyDump << " = geompy.MakePipeWithDifferentSectionsBySteps([";
+  } else {
+    pyDump << " = geompy.MakePipeWithDifferentSections([";
+  }
 
   for(i =1 ; i <= nbBases; i++) {
 
@@ -1962,7 +1972,11 @@ Handle(TColStd_HSequenceOfTransient)
     }
   }
 
-  pyDump<< "], "<<thePath<<","<<theWithContact << "," << theWithCorrections;
+  pyDump<< "], "<<thePath;
+
+  if (!IsBySteps) {
+    pyDump<<","<<theWithContact << "," << theWithCorrections;
+  }
 
   if (IsGenerateGroups) {
     pyDump << ", True";
index a0ae56e3790b0d0e3475ba0e69e55555850fadad..91f4f46bb3c7e296522305f8cf901acff9020300 100644 (file)
@@ -135,6 +135,7 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
                const Handle(GEOM_Object)                  &thePath,
                const bool                                  theWithContact,
                const bool                                  theWithCorrections,
+               const bool                                  IsBySteps,
                const bool                                  IsGenerateGroups);
 
   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeWithShellSections
index fc346c5f13d8359c1ccd921fec2634d133937f4d..3e0892f819baa00b4c7e991c26399213f7ee880a 100644 (file)
@@ -42,6 +42,7 @@
 #define PIPEDS_LIST_LOCATIONS  3
 #define PIPEDS_ARG_WITHCONTACT 4
 #define PIPEDS_ARG_WITHCORRECT 5
+#define PIPEDS_ARG_BY_STEPS    6
 
 // ---- GEOMImpl_IPipeShellSect
 #define PIPEDS_LIST_SUBBASES   6
index 902f0cf4d436aeb0ba1eafb50d23e5baac61e017..ad9b10db32b981c3dd760d50ec20bd514f13bce7 100644 (file)
@@ -73,6 +73,12 @@ class GEOMImpl_IPipeDiffSect : public GEOMImpl_IPipe
   int GetWithCorrectionMode()
   { return _func->GetInteger(PIPEDS_ARG_WITHCORRECT); }
 
+  void SetIsBySteps (int IsBySteps)
+  { _func->SetInteger(PIPEDS_ARG_BY_STEPS, IsBySteps); }
+
+  int GetIsBySteps()
+  { return _func->GetInteger(PIPEDS_ARG_BY_STEPS); }
+
 };
 
 #endif
index 31f53f8733646d575ccde04cd27e3d70967bc88f..cf660675f21080d4e5eaccf0a7fc0fdb6505ee33 100644 (file)
 #include <BRep_Builder.hxx>
 #include <BRepBuilderAPI_Copy.hxx>
 #include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeSolid.hxx>
 #include <BRepBuilderAPI_MakeWire.hxx>
 #include <BRepBuilderAPI_Sewing.hxx>
+#include <BRepClass3d_SolidClassifier.hxx>
 #include <BRepGProp.hxx>
 #include <GeomFill_Trihedron.hxx>
 #include <GeomFill_CorrectedFrenet.hxx>
@@ -686,6 +688,42 @@ static void FindFirstPairFaces(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
   FS2 = Fs(numface);
 }
 
+//=======================================================================
+//function : RemoveFaces
+//purpose  : This function returns theShapeFrom without faces of the shape
+//           theFacesToRm. It returns a shell if theShapeFrom is a solid or
+//           a compound otherwise. Auxilary for CreatePipeWithDifferentSections
+//           method.
+//=======================================================================
+static TopoDS_Shape RemoveFaces(const TopoDS_Shape &theShapeFrom,
+                                const TopoDS_Shape &theFacesToRm)
+{
+  TopTools_IndexedMapOfShape aMapFaces;
+  TopExp_Explorer            anExp(theShapeFrom, TopAbs_FACE);
+  BRep_Builder               aBuilder;
+  TopoDS_Shape               aResult;
+
+  if (theShapeFrom.ShapeType() == TopAbs_SOLID) {
+    // Create shell
+    aBuilder.MakeShell(TopoDS::Shell(aResult));
+  } else {
+    // Create compound
+    aBuilder.MakeCompound(TopoDS::Compound(aResult));
+  }
+
+  TopExp::MapShapes(theFacesToRm, TopAbs_FACE, aMapFaces);
+
+  for (; anExp.More(); anExp.Next()) {
+    const TopoDS_Shape &aFace = anExp.Current();
+
+    if (!aMapFaces.Contains(aFace)) {
+      aBuilder.Add(aResult, aFace);
+    }
+  }
+
+  return aResult;
+}
+
 //=======================================================================
 //function : CreatePipeWithDifferentSections
 //purpose  :
@@ -696,6 +734,7 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
                    const Handle(TopTools_HSequenceOfShape)  theHSeqLocs,
                    const Standard_Boolean                   theWithContact,
                    const Standard_Boolean                   theWithCorrect,
+                   const Standard_Boolean                   IsBySteps,
                          Handle(TColStd_HArray1OfInteger)  *theGroups)
 {
   TopoDS_Shape aShape;
@@ -883,49 +922,82 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
     }
   }
 
-  // check curvature of wire for condition that
-  // max summary angle between directions along
-  // wire path must be < 4*PI. If not - split wire
-  // and seguences of shapes, perform pipe for each
-  // and make sewing after that
-  double fp,lp;
-  gp_Pnt P1,P2;
-  gp_Vec Vec1,Vec2;
-  double SumAng = 0;
-  if ( Edges.Length() > 0 ) {
-    Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp);
-    C->D1(fp,P1,Vec1);
-    C->D1(lp,P2,Vec2);
-    SumAng = fabs(Vec1.Angle(Vec2));
-    Vec1 = Vec2;
-    P1 = P2;
-  }
   TColStd_SequenceOfInteger SplitEdgeNums,SplitLocNums;
-  int LastLoc = 1;
-  //cout<<"Edges.Length()="<<Edges.Length()<<endl;
-  for (i=2; i<=Edges.Length(); i++) {
-      TopoDS_Edge edge = TopoDS::Edge(Edges.Value(i));
-      double tol = BRep_Tool::Tolerance(edge);
-      Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
-      C->D1(lp,P2,Vec2);
-      double ang = fabs(Vec1.Angle(Vec2));
-      SumAng += ang;
-      if (SumAng>4*M_PI) {
-        SumAng = ang;
-        SplitEdgeNums.Append(i-1);
-        int j;
-        for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) {
-          TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j));
-          gp_Pnt P = BRep_Tool::Pnt(aVert);
-          if (P1.Distance(P) < tol) {
-            SplitLocNums.Append(j);
-            LastLoc = j;
-            break;
-          }
+
+  if (IsBySteps) {
+    // Fill SplitEdgeNums and SplitLocNums with intermediate location indices
+    // and corresponding edge indices.
+    Standard_Integer i = 1;
+    Standard_Integer j;
+    TopoDS_Vertex    aVert;
+    gp_Pnt           aP;
+
+    for (j = 2; j < aSeqLocs.Length(); j++) {
+      SplitLocNums.Append(j);
+      aVert = TopoDS::Vertex(aSeqLocs.Value(j));
+      aP    = BRep_Tool::Pnt(aVert);
+
+      while (i < Edges.Length()) {
+        Standard_Real      aFp;
+        Standard_Real      aLp;
+        TopoDS_Edge        anEdge = TopoDS::Edge(Edges.Value(i));
+        Standard_Real      aTol   = BRep_Tool::Tolerance(anEdge);
+        Handle(Geom_Curve) aC     = BRep_Tool::Curve(anEdge, aFp, aLp);
+        gp_Pnt             aPLast;
+
+        aC->D0(aLp, aPLast);
+        i++;
+
+        if (aP.Distance(aPLast) < aTol) {
+          SplitEdgeNums.Append(i - 1);
+          break;
         }
       }
+    }
+  } else {
+    // check curvature of wire for condition that
+    // max summary angle between directions along
+    // wire path must be < 4*PI. If not - split wire
+    // and seguences of shapes, perform pipe for each
+    // and make sewing after that
+    double fp,lp;
+    gp_Pnt P1,P2;
+    gp_Vec Vec1,Vec2;
+    double SumAng = 0;
+    if ( Edges.Length() > 0 ) {
+      Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp);
+      C->D1(fp,P1,Vec1);
+      C->D1(lp,P2,Vec2);
+      SumAng = fabs(Vec1.Angle(Vec2));
       Vec1 = Vec2;
       P1 = P2;
+    }
+    int LastLoc = 1;
+    //cout<<"Edges.Length()="<<Edges.Length()<<endl;
+    for (i=2; i<=Edges.Length(); i++) {
+        TopoDS_Edge edge = TopoDS::Edge(Edges.Value(i));
+        double tol = BRep_Tool::Tolerance(edge);
+        Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
+        C->D1(lp,P2,Vec2);
+        double ang = fabs(Vec1.Angle(Vec2));
+        SumAng += ang;
+        if (SumAng>4*M_PI) {
+          SumAng = ang;
+          SplitEdgeNums.Append(i-1);
+          int j;
+          for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) {
+            TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j));
+            gp_Pnt P = BRep_Tool::Pnt(aVert);
+            if (P1.Distance(P) < tol) {
+              SplitLocNums.Append(j);
+              LastLoc = j;
+              break;
+            }
+          }
+        }
+        Vec1 = Vec2;
+        P1 = P2;
+    }
   }
 
   bool isCreateGroups = (theGroups != NULL);
@@ -966,9 +1038,24 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
           Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid");
         }
 
-        BuildPipeShell(aBuilder);
+        Standard_Boolean isDone = BuildPipeShell(aBuilder);
+
+        if (isDone && NeedCreateSolid && nn == 1) {
+          // Make solid for the first step.
+          isDone = aBuilder.MakeSolid();
+        }
+
+        if (!isDone) {
+          Standard_ConstructionError::Raise("Pipe construction failure");
+        }
 
         TopoDS_Shape resShape = aBuilder.Shape();
+
+        if (NeedCreateSolid && nn == 1) {
+          // Remove top lid from the result.
+          resShape = RemoveFaces(resShape, aBuilder.LastShape());
+        }
+
         aSeqRes.Append(resShape);
 
         // Create groups.
@@ -1014,9 +1101,23 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
         Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid");
       }
 
-      BuildPipeShell(aBuilder);
+      Standard_Boolean isDone = BuildPipeShell(aBuilder);
+
+      if (isDone && NeedCreateSolid) {
+        isDone = aBuilder.MakeSolid();
+      }
+
+      if (!isDone) {
+        Standard_ConstructionError::Raise("Pipe construction failure");
+      }
 
       TopoDS_Shape resShape = aBuilder.Shape();
+
+      if (NeedCreateSolid) {
+        // Remove bottom lid from the result.
+        resShape = RemoveFaces(resShape, aBuilder.FirstShape());
+      }
+
       aSeqRes.Append(resShape);
 
       // Create groups.
@@ -1046,6 +1147,28 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
       aSewing->Perform();
       aShape = aSewing->SewedShape();
 
+      if (NeedCreateSolid && aShape.ShapeType() == TopAbs_SHELL) {
+        // Build a solid.
+        BRepBuilderAPI_MakeSolid aMkSolid;
+
+        aMkSolid.Add(TopoDS::Shell(aShape));
+
+        if (!aMkSolid.IsDone()) {
+          Standard_ConstructionError::Raise("Can't create solid pipe");
+        }
+
+        TopoDS_Solid                aSolid = aMkSolid.Solid();
+        BRepClass3d_SolidClassifier aSC(aSolid);
+
+        aSC.PerformInfinitePoint(Precision::Confusion());
+
+        if (aSC.State() == TopAbs_IN) {
+          aShape = aSolid.Reversed();
+        } else {
+          aShape = aSolid;
+        }
+      }
+
       if (isCreateGroups) {
         // Replase Group shapes by modified ones.
         TopTools_SequenceOfShape aSeqGroups[5];
@@ -3032,6 +3155,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const
     Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations ();
     Standard_Boolean aWithContact = (aCIDS->GetWithContactMode());
     Standard_Boolean aWithCorrect = (aCIDS->GetWithCorrectionMode());
+    Standard_Boolean isBySteps = aCIDS->GetIsBySteps();
 
     if (aCI) {
       delete aCI;
@@ -3079,7 +3203,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const
 
     aShape = CreatePipeWithDifferentSections
               (aWirePath, aHSeqBases, aHSeqLocs,
-               aWithContact, aWithCorrect, pGroups);
+               aWithContact, aWithCorrect, isBySteps, pGroups);
 
     if (isGenerateGroups) {
       // Store created groups.
@@ -3265,8 +3389,13 @@ GetCreationInformation(std::string&             theOperationName,
     AddParam( theParams, "Bases", aCI.GetBases() );
     AddParam( theParams, "Locations", aCI.GetLocations() );
     AddParam( theParams, "Path", aCI.GetPath() );
-    AddParam( theParams, "With contact", aCI.GetWithContactMode() );
-    AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() );
+
+    if (!aCI.GetIsBySteps()) {
+      AddParam( theParams, "With contact", aCI.GetWithContactMode() );
+      AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() );
+    }
+
+    AddParam( theParams, "Step by step", aCI.GetIsBySteps() );
     break;
   }
   case PIPE_SHELL_SECTIONS:
index 3a4deca6feed0c44274f19ca92fc2dc5a34a5a3f..7675369469e974b071a688c8235522e8e365141a 100644 (file)
@@ -88,6 +88,7 @@ public:
                    const Handle(TopTools_HSequenceOfShape)  theLocs,
                    const Standard_Boolean                   theWithContact,
                    const Standard_Boolean                   theWithCorrect,
+                   const Standard_Boolean                   IsBySteps,
                          Handle(TColStd_HArray1OfInteger)  *theGroups = NULL);
 
   Standard_EXPORT virtual
index 52f6d21092126981c0e0a40ea4701018eff7af49..48e5353ea0989379389548146902734337606ac3 100644 (file)
@@ -351,7 +351,8 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeScaledPrism (const TopoDS_Shape& theShape
   aLocs->Append(aShapeCDG_1);
   aLocs->Append(aShapeCDG_2);
 
-  aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections(aWirePath, aBases, aLocs, false, false);
+  aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
+              (aWirePath, aBases, aLocs, false, false, false);
 
   // 7. Make a solid, if possible
   if (theShapeBase.ShapeType() == TopAbs_FACE) {
index 3d5969f71571ec7c954cdfb0fc6ce5204e2cb123..41b415ded85820cca037777466bb8d5a5fcc77ad 100644 (file)
@@ -987,6 +987,7 @@ GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
                                   GEOM::GEOM_Object_ptr  thePath,
                                   CORBA::Boolean         theWithContact,
                                   CORBA::Boolean         theWithCorrections,
+                                  CORBA::Boolean         IsBySteps,
                                   CORBA::Boolean         IsGenerateGroups)
 {
   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
@@ -1029,7 +1030,7 @@ GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
     GetOperations()->MakePipeWithDifferentSections
               (aSeqBases, aSeqLocations,
                aPath, theWithContact,
-               theWithCorrections, IsGenerateGroups);
+               theWithCorrections, IsBySteps, IsGenerateGroups);
   if (!GetOperations()->IsDone() || aHSeq.IsNull())
     return aSeq._retn();
 
index d5d8ea84793a7c247cc8304019dc9398b880c9ed..3fe2951eb52c1a35e48cfbacef6d90024a150e5d 100644 (file)
@@ -186,6 +186,7 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
                                   GEOM::GEOM_Object_ptr  thePath,
                                   CORBA::Boolean         theWithContact,
                                   CORBA::Boolean         theWithCorrections,
+                                  CORBA::Boolean         IsBySteps,
                                   CORBA::Boolean         IsGenerateGroups);
 
   GEOM::ListOfGO* MakePipeWithShellSections
index bfd598ad5bff22a193d91391475952e50e3201f9..449a3c6b8ae3c8a325ed2c5459ccc3952ffbdee1 100644 (file)
@@ -1512,7 +1512,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections
   beginService( " GEOM_Superv_i::MakePipeWithDifferentSections" );
   MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections");
   get3DPrimOp();
-  GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections, false);
+  GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections, false, false);
   endService( " GEOM_Superv_i::MakePipeWithDifferentSections" );
   return aList[0];
 }
index 5ab2f2474623bcf2ade57c6332b0d7704739b262..ae1e59d0f6f205947937b8dceba306f5495861b8 100644 (file)
@@ -361,7 +361,8 @@ class Beam(StructuralElementPart):
         face2 = self.geom.MakeFace(wire2, True)
         shell = self.geom.MakePipeWithDifferentSections([wire1, wire2],
                                                         [point1, point2],
-                                                        path, False, False)
+                                                        path, False, False,
+                                                        False)
         closedShell = self.geom.MakeShell([face1, face2, shell])
         solid = self.geom.MakeSolid([closedShell])
         return solid
index 0e8257dec7d0b19e64e5e0608f521142fe376d73..d0eba918c6c9c39f200212a1871189d31225607b 100644 (file)
@@ -4037,7 +4037,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
                                                               theLocations, thePath,
                                                               theWithContact, theWithCorrection,
-                                                              IsGenerateGroups)
+                                                              False, IsGenerateGroups)
             RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
 
             if IsGenerateGroups:
@@ -4047,6 +4047,43 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(aList[0], theName, "pipe")
             return aList[0]
 
+        ## Create a shape by extrusion of the profile shape along
+        #  the path shape. This function is a version of
+        #  MakePipeWithShellSections() with the same parameters, except
+        #  eliminated theWithContact and theWithCorrection. So it is
+        #  possible to find the description of all parameters is in this
+        #  method. The difference is that this method performs the operation
+        #  step by step, i.e. it creates pipes between each pair of neighbor
+        #  sections and fuses them into a single shape.
+        #
+        #  @ref tui_creation_pipe_with_diff_sec "Example"
+        @ManageTransactions("PrimOp")
+        def MakePipeWithDifferentSectionsBySteps(self, theSeqBases,
+                                                 theLocations, thePath,
+                                                 IsGenerateGroups=False, theName=None):
+            """
+            Create a shape by extrusion of the profile shape along
+            the path shape. This function is a version of
+            MakePipeWithShellSections() with the same parameters, except
+            eliminated theWithContact and theWithCorrection. So it is
+            possible to find the description of all parameters is in this
+            method. The difference is that this method performs the operation
+            step by step, i.e. it creates pipes between each pair of neighbor
+            sections and fuses them into a single shape.
+            """
+            aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
+                                                              theLocations, thePath,
+                                                              False, False,
+                                                              True, IsGenerateGroups)
+            RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp)
+
+            if IsGenerateGroups:
+              self._autoPublish(aList, theName, "pipe")
+              return aList
+
+            self._autoPublish(aList[0], theName, "pipe")
+            return aList[0]
+
         ## Create a shape by extrusion of the profile shape along
         #  the path shape. The path shape can be a wire or an edge.
         #  the several profiles can be specified in the several locations of path.
index 33b43b09fb49b85ad2c4f82c940f233460f6abd5..703fe5ede00a17b6ba3600022b10fbeb3daba804 100644 (file)
 //=================================================================================
 GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
                                               bool modal, Qt::WindowFlags fl)
-  : GEOMBase_Skeleton  (theGeometryGUI, parent, modal, fl),
-    myGenGroupCheckGP  (0),
-    myPrefixLblGP      (0),
-    myPrefixEditGP     (0),
-    myGenGroupCheckGMP (0),
-    myPrefixLblGMP     (0),
-    myPrefixEditGMP    (0)
+  : GEOMBase_Skeleton    (theGeometryGUI, parent, modal, fl),
+    myGenGroupCheckGP    (0),
+    myPrefixLblGP        (0),
+    myPrefixEditGP       (0),
+    myStepByStepCheckGMP (0),
+    myGenGroupCheckGMP   (0),
+    myPrefixLblGMP       (0),
+    myPrefixEditGMP      (0)
 {
   QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE")));
   QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
@@ -124,15 +125,18 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
   // Add widgets for group generation
   QGridLayout *aLayoutGMP = (QGridLayout *)GroupMakePoints->GroupBox1->layout();
 
-  myGenGroupCheckGMP =
+  myStepByStepCheckGMP =
+    new QCheckBox(tr("GEOM_STEP_BY_STEP"), GroupMakePoints->GroupBox1);
+  myGenGroupCheckGMP   =
     new QCheckBox(tr("GEOM_GENERATE_GROUPS"), GroupMakePoints->GroupBox1);
-  myPrefixLblGMP     =
+  myPrefixLblGMP       =
     new QLabel (tr("GEOM_GROUP_NAME_PREFIX"), GroupMakePoints->GroupBox1);
-  myPrefixEditGMP    = new QLineEdit(GroupMakePoints->GroupBox1);
+  myPrefixEditGMP      = new QLineEdit(GroupMakePoints->GroupBox1);
 
-  aLayoutGMP->addWidget(myGenGroupCheckGMP, 8, 0, 1, 3);
-  aLayoutGMP->addWidget(myPrefixLblGMP,     9, 0, 1, 2);
-  aLayoutGMP->addWidget(myPrefixEditGMP,    9, 2);
+  aLayoutGMP->addWidget(myStepByStepCheckGMP, 8,  0, 1, 3);
+  aLayoutGMP->addWidget(myGenGroupCheckGMP,   9,  0, 1, 3);
+  aLayoutGMP->addWidget(myPrefixLblGMP,       10, 0, 1, 2);
+  aLayoutGMP->addWidget(myPrefixEditGMP,      10, 2);
 
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
@@ -201,8 +205,10 @@ void GenerationGUI_PipeDlg::Init()
   connect(GroupMakePoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupMakePoints->CheckBox1, SIGNAL(clicked()), this, SLOT(processPreview()));
   connect(GroupMakePoints->CheckBox2, SIGNAL(clicked()), this, SLOT(processPreview()));
-  connect(myGenGroupCheckGP,  SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool)));
-  connect(myGenGroupCheckGMP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool)));
+  connect(myStepByStepCheckGMP,       SIGNAL(clicked()), this, SLOT(processPreview()));
+  connect(myGenGroupCheckGP,    SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool)));
+  connect(myGenGroupCheckGMP,   SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool)));
+  connect(myStepByStepCheckGMP, SIGNAL(toggled(bool)), this, SLOT(StepByStepClicked(bool)));
 
   initName(tr("GEOM_PIPE"));
   resize(100,100);
@@ -250,6 +256,7 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId )
     GroupPoints->hide();
     GroupMakePoints->show();
     GroupMakePoints->PushButton1->click();
+    myStepByStepCheckGMP->setChecked(false);
     myGenGroupCheckGMP->setChecked(false);
     resetGenGroup(myGenGroupCheckGMP, false, true);
     break;
@@ -583,10 +590,16 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
                    myGenGroupCheckGMP->isChecked();
       }
 
+      bool isWithContact    = GroupMakePoints->CheckBox1->isEnabled() &&
+                              GroupMakePoints->CheckBox1->isChecked();
+      bool isWithCorrection = GroupMakePoints->CheckBox2->isEnabled() &&
+                              GroupMakePoints->CheckBox2->isChecked();
+
       aList = anOper->MakePipeWithDifferentSections
-                          (myBaseGO.in(), myLocationsGO.in(), myPath.get(), 
-                           GroupMakePoints->CheckBox1->isChecked(), 
-                           GroupMakePoints->CheckBox2->isChecked(), doGroups);
+                          (myBaseGO.in(), myLocationsGO.in(), myPath.get(),
+                           isWithContact, isWithCorrection,
+                           myStepByStepCheckGMP->isChecked(),
+                           doGroups);
 
       if (aList->length() > 0) {
         if (doGroups) {
@@ -706,6 +719,16 @@ void GenerationGUI_PipeDlg::GenGroupClicked(bool isChecked)
   resetGenGroup((QCheckBox *)sender(), isChecked, false);
 }
 
+//=================================================================================
+// function : StepByStepClicked
+// purpose  : Slot to treat checking "Step-by-step generation" check box.
+//=================================================================================
+void GenerationGUI_PipeDlg::StepByStepClicked(bool isChecked)
+{
+  GroupMakePoints->CheckBox1->setEnabled(!isChecked);
+  GroupMakePoints->CheckBox2->setEnabled(!isChecked);
+}
+
 //=================================================================================
 // function : updateGenGroup
 // purpose  : Update "Generate groups" widgets depending on the path.
index 4b2d88efdff68b6e0e93233e77433d820b7a09a0..341fb18f4f08710a39a9b72ab9bf5742149c955f 100644 (file)
@@ -81,6 +81,7 @@ private:
   QCheckBox                         *myGenGroupCheckGP;
   QLabel                            *myPrefixLblGP;
   QLineEdit                         *myPrefixEditGP;
+  QCheckBox                         *myStepByStepCheckGMP;
   QCheckBox                         *myGenGroupCheckGMP;
   QLabel                            *myPrefixLblGMP;
   QLineEdit                         *myPrefixEditGMP;
@@ -95,6 +96,7 @@ private slots:
   void                               ConstructorsClicked( int );
   void                               SelectionTypeButtonClicked();
   void                               GenGroupClicked(bool);
+  void                               StepByStepClicked(bool);
 };
 
 #endif // GENERATIONGUI_PIPEDLG_H