Salome HOME
0022289: EDF 2623 GEOM: Make "MakePipeWithDifferentsSections" available from GUI...
authorvsr <vsr@opencascade.com>
Mon, 2 Dec 2013 14:46:16 +0000 (14:46 +0000)
committervsr <vsr@opencascade.com>
Mon, 2 Dec 2013 14:46:16 +0000 (14:46 +0000)
13 files changed:
doc/salome/gui/GEOM/images/pipe.png
doc/salome/gui/GEOM/images/pipe2.png
doc/salome/gui/GEOM/images/pipe3.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/pipe3_init.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/pipe3_res.png [new file with mode: 0644]
doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc
src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx
src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h
src/BasicGUI/BasicGUI_CurveDlg.cxx
src/GEOMBase/GEOMBase.cxx
src/GEOMBase/GEOMBase.h
src/GEOMImpl/GEOMImpl_PipeDriver.cxx
src/GenerationGUI/GenerationGUI_PipeDlg.cxx

index e256ba197e30b2ce4f91469b436f9dd054a08e1e..e7caa83948a41088c1acab9c4a9e19cbba1effca 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/pipe.png and b/doc/salome/gui/GEOM/images/pipe.png differ
index b1f4637b83200a67fec8b3e0a9621008d927cff6..5dbf37736cfa6334ef94a3d28337ecdd011c15f4 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/pipe2.png and b/doc/salome/gui/GEOM/images/pipe2.png differ
diff --git a/doc/salome/gui/GEOM/images/pipe3.png b/doc/salome/gui/GEOM/images/pipe3.png
new file mode 100644 (file)
index 0000000..2d0f132
Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipe3.png differ
diff --git a/doc/salome/gui/GEOM/images/pipe3_init.png b/doc/salome/gui/GEOM/images/pipe3_init.png
new file mode 100644 (file)
index 0000000..c195e4d
Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipe3_init.png differ
diff --git a/doc/salome/gui/GEOM/images/pipe3_res.png b/doc/salome/gui/GEOM/images/pipe3_res.png
new file mode 100644 (file)
index 0000000..113302f
Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipe3_res.png differ
index 4af2ea093bf2a14c0f50fee2ef91208fe3d79db3..a11fb975e5a0d01aa67dbb1da472c7fb1e8494f0 100644 (file)
@@ -54,6 +54,35 @@ BiNormal direction to perform the extrusion.
 
 \image html pipebinormalsn.png "Extrusion of a face with BiNormal parameter"
 
+\n Third, to create a shape by extrusion of the profile shapes along the path shape, 
+you can define the <b>Base Object</b>s (edges, planar wires, faces or shells), which will be extruded, 
+the <b>Locations</b> (vertices that specify locations on the <b>Path Object</b> corresponding to the
+specified <b>Base Object</b>s; list of the <b>Locations</b> should be either empty or of the same
+length as list of <b>Base Object</b>s) and the <b>Path Object</b> (edge or wire) along which the
+<b>Base Object</b> will be extruded.
+
+Additional controls:
+- <b>With contact</b> checkbox - if checked, the section is translated to be in contact with the spine.
+- <b>With correction</b> checkbox - if checked, the section is rotated to be orthogonal to the spine
+tangent in the corresponding point.
+
+\n The \b Result of the operation will be a GEOM_Object (shell or solid).
+
+\n <b>TUI Command:</b> <em>geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection)</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 + 
+2 bool parameters (withContact, withCorrection).
+\n <b>Advanced options</b> \ref preview_anchor "Preview"
+
+\image html pipe3.png
+
+<b>Example:</b>
+
+\image html pipe3_init.png "Initial objects"
+
+\image html pipe3_init1.png "Extrusion of the profile shapes along the path shape"
+
 Our <b>TUI Scripts</b> provide you with useful examples of creation of
 \ref tui_creation_pipe "Complex Geometric Objects".
 
index 9a1d4107b173815a9250871eb2dc7d3165f4cef6..50a8f8db22f17de667edc18753b737afcc3ea868 100644 (file)
@@ -217,7 +217,7 @@ bool AdvancedGUI_SmoothingSurfaceDlg::execute (ObjectList& objects)
 void AdvancedGUI_SmoothingSurfaceDlg::SelectionIntoArgument()
 {
   QList<GEOM::GeomObjPtr> points = getSelected( TopAbs_VERTEX, -1 );
-  synchronize( myPoints, points );
+  GEOMBase::Synchronize( myPoints, points );
   if ( !myPoints.isEmpty()  )
     GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
   else
@@ -236,30 +236,3 @@ void AdvancedGUI_SmoothingSurfaceDlg::SetEditCurrentArgument()
   myEditCurrentArgument->setFocus();
   SelectionIntoArgument();
 }
-
-void AdvancedGUI_SmoothingSurfaceDlg::synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right )
-{
-  // 1. remove items from the "left" list that are not in the "right" list
-  QMutableListIterator<GEOM::GeomObjPtr> it1( left );
-  while ( it1.hasNext() ) {
-    GEOM::GeomObjPtr o1 = it1.next();
-    bool found = false;
-    QMutableListIterator<GEOM::GeomObjPtr> it2( right );
-    while ( it2.hasNext() && !found )
-      found = o1 == it2.next();
-    if ( !found )
-      it1.remove();
-  }
-  // 2. add items from the "right" list that are not in the "left" list (to keep selection order)
-  it1 = right;
-  while ( it1.hasNext() ) {
-    GEOM::GeomObjPtr o1 = it1.next();
-    bool found = false;
-    QMutableListIterator<GEOM::GeomObjPtr> it2( left );
-    while ( it2.hasNext() && !found )
-      found = o1 == it2.next();
-    if ( !found )
-      left << o1;
-  }
-}
-
index 1d84d830e91f96be9d63a074ef4676f25eac6fdb..87b33beee1c789e17b8fdae56942c6cdd9954a07 100644 (file)
@@ -50,7 +50,6 @@ protected:
 private:
   void                               Init();
   void                               enterEvent( QEvent* );
-  void                               synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
 
 private:
   DlgRef_1Sel*                 GroupPoints;
index 4cd535b4dbf6823155178ad2b675f1a01d2fc7b9..c9d6a06a7ade23fa1b54560ec4877e166995be5c 100644 (file)
@@ -347,43 +347,13 @@ bool BasicGUI_CurveDlg::ClickOnApply()
   return true;
 }
 
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose  : Called when selection as changed or other case
-//=================================================================================
-static void synchronize (QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right)
-{
-  // 1. remove items from the "left" list that are not in the "right" list
-  QMutableListIterator<GEOM::GeomObjPtr> it1 (left);
-  while (it1.hasNext()) {
-    GEOM::GeomObjPtr o1 = it1.next();
-    bool found = false;
-    QMutableListIterator<GEOM::GeomObjPtr> it2( right );
-    while ( it2.hasNext() && !found )
-      found = o1 == it2.next();
-    if ( !found )
-      it1.remove();
-  }
-  // 2. add items from the "right" list that are not in the "left" list (to keep selection order)
-  it1 = right;
-  while ( it1.hasNext() ) {
-    GEOM::GeomObjPtr o1 = it1.next();
-    bool found = false;
-    QMutableListIterator<GEOM::GeomObjPtr> it2( left );
-    while ( it2.hasNext() && !found )
-      found = o1 == it2.next();
-    if ( !found )
-      left << o1;
-  }
-}
-
 void BasicGUI_CurveDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText("");
 
   if (myEditCurrentArgument == myGroupPoints->LineEdit1) {
     QList<GEOM::GeomObjPtr> points = getSelected(TopAbs_VERTEX, -1);
-    synchronize(myPoints, points);
+    GEOMBase::Synchronize(myPoints, points);
     if (!myPoints.isEmpty())
       myGroupPoints->LineEdit1->setText(QString::number(myPoints.count()) + "_" +
                                         tr("GEOM_POINT") + tr("_S_"));
index 6b1d06ea5f216775e508958f72e05122195f6629..5bcc54e35effee8a3c1d411773ba31731adc73e1 100644 (file)
@@ -876,3 +876,33 @@ void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object )
     }
   }
 }
+
+//================================================================
+// Function : synchronize
+// Purpose  : 
+//================================================================
+void GEOMBase::Synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right )
+{
+  // 1. remove items from the "left" list that are not in the "right" list
+  QMutableListIterator<GEOM::GeomObjPtr> it1( left );
+  while ( it1.hasNext() ) {
+    GEOM::GeomObjPtr o1 = it1.next();
+    bool found = false;
+    QMutableListIterator<GEOM::GeomObjPtr> it2( right );
+    while ( it2.hasNext() && !found )
+      found = o1 == it2.next();
+    if ( !found )
+      it1.remove();
+  }
+  // 2. add items from the "right" list that are not in the "left" list (to keep selection order)
+  it1 = right;
+  while ( it1.hasNext() ) {
+    GEOM::GeomObjPtr o1 = it1.next();
+    bool found = false;
+    QMutableListIterator<GEOM::GeomObjPtr> it2( left );
+    while ( it2.hasNext() && !found )
+      found = o1 == it2.next();
+    if ( !found )
+      left << o1;
+  }
+}
index f52c3c178b26d1b4b1d2bff92c8d81bbee6e0520..d1f8cbfcb1f32810eef864ab17b4147c41eb1c9d 100644 (file)
@@ -31,6 +31,7 @@
 
 // SALOME Includes
 #include <GEOM_AISShape.hxx>
+#include "GEOM_GenericObjPtr.h"
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -133,6 +134,8 @@ public :
 
   /* Publish sub-shape under the main object */
   static void         PublishSubObject( GEOM::GEOM_Object_ptr object );
+
+  static void         Synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
 };
 
 #endif // GEOMBASE_H
index 7a9f7d85f4cb093d84f75ace93b5478e73bb1aed..b339a722368954427beaf1acf75e4902e05e8a42 100644 (file)
@@ -858,14 +858,17 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
   // and seguences of shapes, perform pipe for each
   // and make sewing after that
   double fp,lp;
-  Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp);
   gp_Pnt P1,P2;
   gp_Vec Vec1,Vec2;
-  C->D1(fp,P1,Vec1);
-  C->D1(lp,P2,Vec2);
-  double SumAng = fabs(Vec1.Angle(Vec2));
-  Vec1 = Vec2;
-  P1 = P2;
+  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;
index 43854d469b9c80bd86de46ebbca27360945f2a0d..621ff95afa2a0046cf27e8c19074926b92c1ded8 100644 (file)
@@ -322,13 +322,10 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
   }
   else if ( myEditCurrentArgument == GroupMakePoints->LineEdit1 ) {
     myBaseObjects.clear();
-    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
-    for ( int i = 0; i < objects.count(); i++ ) {
-      GEOM::shape_type stype = objects[i]->GetMaxShapeType();
-      if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
-        continue;
-      myBaseObjects << objects[i];
-    }
+    QList<TopAbs_ShapeEnum> types;
+    types << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL;
+    QList<GEOM::GeomObjPtr> objects = getSelected( types, -1 );
+    GEOMBase::Synchronize( myBaseObjects, objects );
     if ( !myBaseObjects.isEmpty() ) {
       QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
       myEditCurrentArgument->setText( aName );
@@ -336,13 +333,9 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
   }
   else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) {
     myLocations.clear();
-    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
-    for ( int i = 0; i < objects.count(); i++ ) {
-      GEOM::shape_type stype = objects[i]->GetMaxShapeType();
-      if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
-        continue;
-      myLocations << objects[i];
-    }
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_VERTEX, -1 );
+    GEOMBase::Synchronize( myLocations, objects );
     if ( !myLocations.isEmpty() ) {
       QString aName = myLocations.count() > 1 ? QString( "%1_objects").arg( myLocations.count() ) : GEOMBase::GetName( myLocations[0].get() );
       myEditCurrentArgument->setText( aName );