From: vsr Date: Mon, 2 Dec 2013 14:46:16 +0000 (+0000) Subject: 0022289: EDF 2623 GEOM: Make "MakePipeWithDifferentsSections" available from GUI... X-Git-Tag: V7_3_0b1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a045068b34d9356949da48806f31c191b48309c2;p=modules%2Fgeom.git 0022289: EDF 2623 GEOM: Make "MakePipeWithDifferentsSections" available from GUI (merge from V7_main) --- diff --git a/doc/salome/gui/GEOM/images/pipe.png b/doc/salome/gui/GEOM/images/pipe.png index e256ba197..e7caa8394 100755 Binary files a/doc/salome/gui/GEOM/images/pipe.png and b/doc/salome/gui/GEOM/images/pipe.png differ diff --git a/doc/salome/gui/GEOM/images/pipe2.png b/doc/salome/gui/GEOM/images/pipe2.png index b1f4637b8..5dbf37736 100755 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 index 000000000..2d0f13214 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 index 000000000..c195e4d71 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 index 000000000..113302fbd Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipe3_res.png differ diff --git a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc index 4af2ea093..a11fb975e 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc @@ -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 Base Objects (edges, planar wires, faces or shells), which will be extruded, +the Locations (vertices that specify locations on the Path Object corresponding to the +specified Base Objects; list of the Locations should be either empty or of the same +length as list of Base Objects) and the Path Object (edge or wire) along which the +Base Object will be extruded. + +Additional controls: +- With contact checkbox - if checked, the section is translated to be in contact with the spine. +- With correction 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 TUI Command: geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection) +\n Arguments: 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 Advanced options \ref preview_anchor "Preview" + +\image html pipe3.png + +Example: + +\image html pipe3_init.png "Initial objects" + +\image html pipe3_init1.png "Extrusion of the profile shapes along the path shape" + Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_pipe "Complex Geometric Objects". diff --git a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx index 9a1d4107b..50a8f8db2 100644 --- a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx @@ -217,7 +217,7 @@ bool AdvancedGUI_SmoothingSurfaceDlg::execute (ObjectList& objects) void AdvancedGUI_SmoothingSurfaceDlg::SelectionIntoArgument() { QList 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& left, QList& right ) -{ - // 1. remove items from the "left" list that are not in the "right" list - QMutableListIterator it1( left ); - while ( it1.hasNext() ) { - GEOM::GeomObjPtr o1 = it1.next(); - bool found = false; - QMutableListIterator 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 it2( left ); - while ( it2.hasNext() && !found ) - found = o1 == it2.next(); - if ( !found ) - left << o1; - } -} - diff --git a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h index 1d84d830e..87b33beee 100644 --- a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h +++ b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.h @@ -50,7 +50,6 @@ protected: private: void Init(); void enterEvent( QEvent* ); - void synchronize( QList& left, QList& right ); private: DlgRef_1Sel* GroupPoints; diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 4cd535b4d..c9d6a06a7 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -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& left, QList& right) -{ - // 1. remove items from the "left" list that are not in the "right" list - QMutableListIterator it1 (left); - while (it1.hasNext()) { - GEOM::GeomObjPtr o1 = it1.next(); - bool found = false; - QMutableListIterator 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 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 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_")); diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index 6b1d06ea5..5bcc54e35 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -876,3 +876,33 @@ void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object ) } } } + +//================================================================ +// Function : synchronize +// Purpose : +//================================================================ +void GEOMBase::Synchronize( QList& left, QList& right ) +{ + // 1. remove items from the "left" list that are not in the "right" list + QMutableListIterator it1( left ); + while ( it1.hasNext() ) { + GEOM::GeomObjPtr o1 = it1.next(); + bool found = false; + QMutableListIterator 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 it2( left ); + while ( it2.hasNext() && !found ) + found = o1 == it2.next(); + if ( !found ) + left << o1; + } +} diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index f52c3c178..d1f8cbfcb 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -31,6 +31,7 @@ // SALOME Includes #include +#include "GEOM_GenericObjPtr.h" // IDL Headers #include @@ -133,6 +134,8 @@ public : /* Publish sub-shape under the main object */ static void PublishSubObject( GEOM::GEOM_Object_ptr object ); + + static void Synchronize( QList& left, QList& right ); }; #endif // GEOMBASE_H diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 7a9f7d85f..b339a7223 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -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()="<LineEdit1 ) { myBaseObjects.clear(); - QList 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 types; + types << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL; + QList 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 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 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 );