From: vsr Date: Tue, 22 Jul 2008 09:10:35 +0000 (+0000) Subject: Merge from BR_Dev_For_4_0 branch (from tag mergeto_BR_QT4_Dev_07Jul08) X-Git-Tag: V5_1_0a1~39 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=47a901faf4f2156e8e4b3b429bb560e4122b4c2b;p=modules%2Fsmesh.git Merge from BR_Dev_For_4_0 branch (from tag mergeto_BR_QT4_Dev_07Jul08) --- diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am index e7c5dc8ae..66ce3648e 100644 --- a/doc/salome/gui/Makefile.am +++ b/doc/salome/gui/Makefile.am @@ -27,12 +27,23 @@ EXTRA_DIST+=SMESH doxygen=@DOXYGEN@ +# Below command replaces "smeshDC" by "smesh" except cases +# "ssmeshDC", "1smeshDC" and "esmeshDC" (these sequences +# can be found in file names and must not be replaces): +# +# sed 's/\([^s1e]\)smeshDC\|^smeshDC/\1smesh/g' $${filen} > ./tmp; +# usr_docs: cd ./SMESH; \ echo "Processing smeshDC.py file: "; \ $(doxygen) ./doxyfile_py; \ - sed 's|../../../share/salome|$(top_srcdir)|' ./doxyfile > ./doxyfile1; \ - mv -f doxyfile1 doxyfile; \ + cd ./smeshpy_doc; \ + filesl=`find .`; \ + for filen in $${filesl}; do \ + sed 's/\([^s1e]\)smeshDC\|^smeshDC/\1smesh/g' $${filen} > ./tmp; \ + mv -f tmp $${filen}; \ + done; \ + cd ..; \ echo "Running doxygen in directory: "`pwd`; \ $(doxygen) ./doxyfile; diff --git a/doc/salome/gui/SMESH/doxyfile.in b/doc/salome/gui/SMESH/doxyfile.in index 37ef2d45f..3aea83cc5 100755 --- a/doc/salome/gui/SMESH/doxyfile.in +++ b/doc/salome/gui/SMESH/doxyfile.in @@ -19,7 +19,7 @@ WARNINGS = YES INPUT = @srcdir@/input FILE_PATTERNS = *.doc IMAGE_PATH = @srcdir@/images -EXAMPLE_PATH = ../../../share/salome/src/SMESH_SWIG +EXAMPLE_PATH = @top_srcdir@/src/SMESH_SWIG #--------------------------------------------------------------------------- #HTML related options #--------------------------------------------------------------------------- diff --git a/doc/salome/gui/SMESH/doxyfile_py.in b/doc/salome/gui/SMESH/doxyfile_py.in index ff847e50e..617584ed9 100755 --- a/doc/salome/gui/SMESH/doxyfile_py.in +++ b/doc/salome/gui/SMESH/doxyfile_py.in @@ -7,7 +7,7 @@ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = NO +REPEAT_BRIEF = YES ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = YES FULL_PATH_NAMES = NO @@ -38,7 +38,7 @@ HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = YES CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO +HIDE_SCOPE_NAMES = YES SHOW_INCLUDE_FILES = YES INLINE_INFO = YES SORT_MEMBER_DOCS = NO @@ -81,6 +81,7 @@ INPUT = @top_srcdir@/src/SMESH_SWIG FILE_PATTERNS = smeshDC.py IMAGE_PATH = @srcdir@/images RECURSIVE = NO +EXAMPLE_PATH = @top_srcdir@/src/SMESH_SWIG #--------------------------------------------------------------------------- #HTML related options @@ -107,19 +108,26 @@ GENERATE_RTF = NO #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES +#CLASS_DIAGRAMS = YES +CLASS_DIAGRAMS = NO HIDE_UNDOC_RELATIONS = NO -HAVE_DOT = YES -CLASS_GRAPH = YES +#HAVE_DOT = YES +HAVE_DOT = NO +#CLASS_GRAPH = YES +CLASS_GRAPH = NO COLLABORATION_GRAPH = NO GROUP_GRAPHS = NO UML_LOOK = NO -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES +#TEMPLATE_RELATIONS = YES +#INCLUDE_GRAPH = YES +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = NO INCLUDED_BY_GRAPH = NO CALL_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES +#GRAPHICAL_HIERARCHY = YES +#DIRECTORY_GRAPH = YES +GRAPHICAL_HIERARCHY = NO +DIRECTORY_GRAPH = NO DOT_IMAGE_FORMAT = jpg DOT_PATH = DOTFILE_DIRS = diff --git a/doc/salome/gui/SMESH/images/buildcompound.png b/doc/salome/gui/SMESH/images/buildcompound.png index 79a6073f2..1a5bea166 100755 Binary files a/doc/salome/gui/SMESH/images/buildcompound.png and b/doc/salome/gui/SMESH/images/buildcompound.png differ diff --git a/doc/salome/gui/SMESH/input/building_compounds.doc b/doc/salome/gui/SMESH/input/building_compounds.doc index 5905565d5..d42f38866 100644 --- a/doc/salome/gui/SMESH/input/building_compounds.doc +++ b/doc/salome/gui/SMESH/input/building_compounds.doc @@ -34,6 +34,12 @@ become the elements of Group1 on the Compound_Mesh, or becomes Group1_2. See \ref grouping_elements_page "Creating Groups" for more information about groups. +
  • Create common groups for initial meshes checkbox permits to +automatically create groups of all elements of the same type +(nodes, edges, faces and volumes) for the resulting mesh from the +elements +of the initial meshes. +
  • You can simply unite meshes or choose to Merge coincident nodes and elements, in which case it is possible to define the \b Tolerance for this operation.
  • @@ -43,4 +49,4 @@ for this operation. \image html image160.gif -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index 4fbf3d3b5..6e2b421c9 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -5,6 +5,37 @@ \n Python package smesh defines several classes, destined for easy and clear mesh creation and edition (see the \ref introduction_to_mesh_python_page "example"). -\n Also, please see \ref smeshDC "documentation for smesh.py" +\n Please draw your attention to the below notes before address to +the \ref smeshDC "documentation for smesh.py" -*/ \ No newline at end of file +\n 1. The main page of the \ref smeshDC "documentation for smesh.py" + contains a list of data structures and a list of functions, + provided by the package smesh.py. The first item in the data + structures list (\ref smeshDC::smeshDC "class smesh") also + represents documentation for methods of the package smesh.py itself. + +\n 2. Package smesh.py gives interface to create and manage + meshes. Please, use it to create an empty mesh or to import + it from data file. + +\n 3. Once you have created a mesh, you can manage it via its own + methods. See \ref smeshDC::Mesh "class Mesh" documentation for + them (it is also accessible by the second item "class Mesh" in the + data structures list). + +\n 4. Class Mesh allows to assign algorithms to a mesh. +\n \t Please note, that there are always available some algorithms, + included in standard Salome installation: + - REGULAR(1D), COMPOSITE(1D), MEFISTO(2D), Quadrangle(2D), Hexa(3D), etc. + +\n Also there are some algorithms, which can be installed optionally, +\n some of them are based on open-source meshers: + - NETGEN(1D-2D,2D,1D-2D-3D,3D), + +\n others are based on commercial meshers: + - GHS3D(3D). + +\n \t To add hypotheses, please use interfaces, provided by the + assigned algorithms. + +*/ diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index 96083e189..362bea45a 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -275,6 +275,20 @@ module SMESH in double theMergeTolerance) raises ( SALOME::SALOME_Exception ); + /*! + * Concatenate the given meshes into one mesh. + * Union groups with the same name and type if + * theUniteIdenticalGroups flag is true. + * Merge coincident nodes and elements if + * theMergeNodesAndElements flag is true. + * Create the groups of all elements from initial meshes. + */ + SMESH_Mesh ConcatenateWithGroups(in mesh_array theMeshesArray, + in boolean theUniteIdenticalGroups, + in boolean theMergeNodesAndElements, + in double theMergeTolerance) + raises ( SALOME::SALOME_Exception ); + /*! * \brief Return id of object, registered in current study context * diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index b04164177..fd70cc9f5 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -625,6 +625,8 @@ module SMESH */ double_array BaryCenter(in long id); + /*! Gets information about imported MED file */ + SALOME_MED::MedFileInfo GetMEDFileInfo(); }; interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource diff --git a/src/SMDS/SMDS_MeshInfo.hxx b/src/SMDS/SMDS_MeshInfo.hxx index a7694837b..8f541c267 100644 --- a/src/SMDS/SMDS_MeshInfo.hxx +++ b/src/SMDS/SMDS_MeshInfo.hxx @@ -2,6 +2,7 @@ // Created : Mon Sep 24 18:32:41 2007 // Author : Edward AGAPOV (eap) +using namespace std; #ifndef SMDS_MeshInfo_HeaderFile #define SMDS_MeshInfo_HeaderFile diff --git a/src/SMDS/SMDS_MeshNode.cxx b/src/SMDS/SMDS_MeshNode.cxx index b7a1cb117..587aee90a 100644 --- a/src/SMDS/SMDS_MeshNode.cxx +++ b/src/SMDS/SMDS_MeshNode.cxx @@ -246,7 +246,7 @@ bool SMDS_MeshNode::emptyInverseElements() */ //================================================================================ -int SMDS_MeshNode::NbInverseNodes(SMDSAbs_ElementType type) const +int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const { if ( type == SMDSAbs_All ) return myInverseElements.Extent(); diff --git a/src/SMDS/SMDS_MeshNode.hxx b/src/SMDS/SMDS_MeshNode.hxx index d195fbdfd..585f59bf9 100644 --- a/src/SMDS/SMDS_MeshNode.hxx +++ b/src/SMDS/SMDS_MeshNode.hxx @@ -47,7 +47,7 @@ class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement void ClearInverseElements(); bool emptyInverseElements(); SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const; - int NbInverseNodes(SMDSAbs_ElementType type=SMDSAbs_All) const; + int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const; void SetPosition(const SMDS_PositionPtr& aPos); const SMDS_PositionPtr& GetPosition() const; SMDSAbs_ElementType GetType() const; diff --git a/src/SMESH/SMESH_Block.cxx b/src/SMESH/SMESH_Block.cxx index 6a50ff019..59d48a978 100644 --- a/src/SMESH/SMESH_Block.cxx +++ b/src/SMESH/SMESH_Block.cxx @@ -21,6 +21,8 @@ // Created : Mon Aug 2 10:30:00 2004 // Author : Edward AGAPOV (eap) +using namespace std; + #include "SMESH_Block.hxx" #include diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index b858c372f..6b94beafe 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -6871,7 +6871,7 @@ int SMESH_MeshEditor::removeQuadElem(SMESHDS_SubMesh * theSm, vector::iterator nIt = mediumNodes.begin(); for ( ; nIt != mediumNodes.end(); ++nIt ) { const SMDS_MeshNode* n = *nIt; - if ( n->NbInverseNodes() == 0 ) { + if ( n->NbInverseElements() == 0 ) { if ( n->GetPosition()->GetShapeId() != theShapeID ) meshDS->RemoveFreeNode( n, meshDS->MeshElements ( n->GetPosition()->GetShapeId() )); diff --git a/src/SMESH/SMESH_OctreeNode.hxx b/src/SMESH/SMESH_OctreeNode.hxx index 62cddf688..5a553027a 100644 --- a/src/SMESH/SMESH_OctreeNode.hxx +++ b/src/SMESH/SMESH_OctreeNode.hxx @@ -27,6 +27,8 @@ // Author : Nicolas Geimer & AurĂ©lien Motteux (OCC) // Module : SMESH +using namespace std; + #ifndef _SMESH_OCTREENODE_HXX_ #define _SMESH_OCTREENODE_HXX_ diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index 4d3fe36f6..1ab83c71e 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -21,6 +21,8 @@ // Created : Mon Aug 2 10:30:00 2004 // Author : Edward AGAPOV (eap) +using namespace std; + #include "SMESH_Pattern.hxx" #include diff --git a/src/SMESH/SMESH_Pattern.hxx b/src/SMESH/SMESH_Pattern.hxx index 2746f15cc..d5288bb1d 100644 --- a/src/SMESH/SMESH_Pattern.hxx +++ b/src/SMESH/SMESH_Pattern.hxx @@ -21,6 +21,8 @@ // Created : Mon Aug 2 10:30:00 2004 // Author : Edward AGAPOV (eap) +using namespace std; + #ifndef SMESH_Pattern_HeaderFile #define SMESH_Pattern_HeaderFile diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index bbb5fa96a..3a1c9fa0d 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -1195,7 +1195,7 @@ static void cleanSubMesh( SMESH_subMesh * subMesh ) while (itn->more()) { const SMDS_MeshNode * node = itn->next(); //MESSAGE( " RM node: "<GetID()); - if ( node->NbInverseNodes() == 0 ) + if ( node->NbInverseElements() == 0 ) meshDS->RemoveFreeNode(node, subMeshDS); else // for StdMeshers_CompositeSegment_1D: node in one submesh, edge in another meshDS->RemoveNode(node); diff --git a/src/SMESHGUI/Makefile.am b/src/SMESHGUI/Makefile.am index 5cddef784..6e451fb7d 100644 --- a/src/SMESHGUI/Makefile.am +++ b/src/SMESHGUI/Makefile.am @@ -99,7 +99,8 @@ dist_libSMESH_la_SOURCES = \ SMESHGUI_BuildCompoundDlg.cxx \ SMESHGUI_ComputeDlg.cxx \ SMESHGUI_MakeNodeAtPointDlg.cxx \ - SMESHGUI_MeshEditPreview.cxx + SMESHGUI_MeshEditPreview.cxx \ + SMESHGUI_FileInfoDlg.cxx MOC_FILES = \ SMESHGUI_moc.cxx \ @@ -149,7 +150,8 @@ MOC_FILES = \ SMESHGUI_ConvToQuadOp_moc.cxx \ SMESHGUI_BuildCompoundDlg_moc.cxx \ SMESHGUI_ComputeDlg_moc.cxx \ - SMESHGUI_MakeNodeAtPointDlg_moc.cxx + SMESHGUI_MakeNodeAtPointDlg_moc.cxx \ + SMESHGUI_FileInfoDlg_moc.cxx nodist_libSMESH_la_SOURCES= \ $(MOC_FILES) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 59c93d31a..f07927491 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -65,6 +65,7 @@ #include "SMESHGUI_MakeNodeAtPointDlg.h" #include "SMESHGUI_BuildCompoundDlg.h" #include "SMESHGUI_ComputeDlg.h" +#include "SMESHGUI_FileInfoDlg.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_MeshUtils.h" @@ -110,7 +111,7 @@ // IDL includes #include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include CORBA_SERVER_HEADER(SMESH_MeshEditor) +#include CORBA_CLIENT_HEADER(SMESH_MeshEditor) // Qt includes // #define INCLUDE_MENUITEM_DEF // VSR commented ???????? @@ -1263,6 +1264,25 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) break; } + case 150: //MED FILE INFORMATION + { + SALOME_ListIO selected; + LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); + if( aSel ) + aSel->selectedObjects( selected ); + if( selected.Extent() ) + { + Handle(SALOME_InteractiveObject) anIObject = selected.First(); + SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface(anIObject); + if ( !aMesh->_is_nil() ) + { + SMESHGUI_FileInfoDlg dlg( desktop(), aMesh->GetMEDFileInfo() ); + dlg.exec(); + } + } + break; + } + case 122: // EXPORT MED case 121: case 123: @@ -2409,6 +2429,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 125, "EXPORT_MED" ); createSMESHAction( 126, "EXPORT_UNV" ); createSMESHAction( 141, "EXPORT_STL" ); + createSMESHAction( 150, "FILE_INFO" ); createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete ); createSMESHAction( 5105, "SEL_FILTER_LIB" ); createSMESHAction( 701, "COMPUTE", "ICON_COMPUTE" ); @@ -2740,6 +2761,7 @@ void SMESHGUI::initialize( CAM_Application* app ) // popup for object browser + createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION createPopupItem( 704, OB, mesh, "&& isComputable"); // EDIT_MESHSUBMESH createPopupItem( 704, OB, subMesh, "&& isComputable" ); // EDIT_MESHSUBMESH createPopupItem( 803, OB, group ); // EDIT_GROUP diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index 6bfeddee0..dcfaa7e1b 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -123,12 +123,15 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule ) TextLabelMeshes = new QLabel(tr("MESHES"), GroupArgs); SelectButton = new QPushButton(GroupArgs); SelectButton->setIcon(image1); + SelectButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); LineEditMeshes = new QLineEdit(GroupArgs); LineEditMeshes->setReadOnly(true); TextLabelUnion = new QLabel(tr("PROCESSING_IDENTICAL_GROUPS"), GroupArgs); ComboBoxUnion = new QComboBox(GroupArgs); + CheckBoxCommon = new QCheckBox(tr("CREATE_COMMON_GROUPS"), GroupArgs); + CheckBoxMerge = new QCheckBox(tr("MERGE_NODES_AND_ELEMENTS"), GroupArgs); TextLabelTol = new QLabel(tr("SMESH_TOLERANCE"), GroupArgs); @@ -141,9 +144,10 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule ) GroupArgsLayout->addWidget(LineEditMeshes, 0, 2, 1, 2); GroupArgsLayout->addWidget(TextLabelUnion, 1, 0, 1, 3); GroupArgsLayout->addWidget(ComboBoxUnion, 1, 3); - GroupArgsLayout->addWidget(CheckBoxMerge, 2, 0, 1, 4); - GroupArgsLayout->addWidget(TextLabelTol, 3, 0, 1, 2); - GroupArgsLayout->addWidget(SpinBoxTol, 3, 2, 1, 2); + GroupArgsLayout->addWidget(CheckBoxCommon, 2, 0, 1, 4); + GroupArgsLayout->addWidget(CheckBoxMerge, 3, 0, 1, 4); + GroupArgsLayout->addWidget(TextLabelTol, 4, 0, 1, 2); + GroupArgsLayout->addWidget(SpinBoxTol, 4, 2, 1, 2); /***************************************************************/ GroupButtons = new QGroupBox(this); @@ -287,12 +291,18 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply() SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen(); // concatenate meshes - SMESH::SMESH_Mesh_var aCompoundMesh = - aSMESHGen->Concatenate(myMeshArray, - !(ComboBoxUnion->currentIndex()), - CheckBoxMerge->isChecked(), - SpinBoxTol->GetValue()); - + SMESH::SMESH_Mesh_var aCompoundMesh; + if(CheckBoxCommon->isChecked()) + aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray, + !(ComboBoxUnion->currentIndex()), + CheckBoxMerge->isChecked(), + SpinBoxTol->GetValue()); + else + aCompoundMesh = aSMESHGen->Concatenate(myMeshArray, + !(ComboBoxUnion->currentIndex()), + CheckBoxMerge->isChecked(), + SpinBoxTol->GetValue()); + SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() ); mySMESHGUI->updateObjBrowser(); } catch(...) { diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h index f71222064..a05fd5fe3 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h @@ -100,6 +100,7 @@ private: QLineEdit* LineEditMeshes; QLabel* TextLabelUnion; QComboBox* ComboBoxUnion; + QCheckBox* CheckBoxCommon; QCheckBox* CheckBoxMerge; QLabel* TextLabelTol; SMESHGUI_SpinBox* SpinBoxTol; diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index b0656be9e..435a7f4c2 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -253,11 +253,14 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod AngleSpin = new SMESHGUI_SpinBox(AnglesGrp); + LinearAnglesCheck = new QCheckBox(tr("LINEAR_ANGLES"), AnglesGrp); + // layouting AnglesGrpLayout->addWidget(AnglesList, 0, 0, 4, 1); AnglesGrpLayout->addWidget(AddAngleButton, 0, 1); AnglesGrpLayout->addWidget(RemoveAngleButton, 2, 1); AnglesGrpLayout->addWidget(AngleSpin, 0, 2); + AnglesGrpLayout->addWidget(LinearAnglesCheck, 4, 0); AnglesGrpLayout->setRowMinimumHeight(1, 10); AnglesGrpLayout->setRowStretch(3, 10); @@ -581,17 +584,20 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() try { SUIT_OverrideCursor wc; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + if ( LinearAnglesCheck->isChecked() ) + anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles ); + SMESH::SMESH_MeshEditor::Extrusion_Error retVal; if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) SMESH::ListOfGroups_var groups = - aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId.inout(), myPathMesh, + aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh, myPathShape, aNodeStart, - AnglesGrp->isChecked(), anAngles.inout(), + AnglesGrp->isChecked(), anAngles, BasePointGrp->isChecked(), aBasePoint, retVal); else - retVal = aMeshEditor->ExtrusionAlongPath(anElementsId.inout(), myPathMesh, + retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh, myPathShape, aNodeStart, - AnglesGrp->isChecked(), anAngles.inout(), + AnglesGrp->isChecked(), anAngles, BasePointGrp->isChecked(), aBasePoint); //wc.stop(); diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h index 82e019157..6885b738e 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h @@ -113,6 +113,7 @@ private: QLineEdit* PathShapeLineEdit; QToolButton* SelectStartPointButton; QLineEdit* StartPointLineEdit; + QCheckBox* LinearAnglesCheck; QGroupBox* AnglesGrp; QListWidget* AnglesList; QToolButton* AddAngleButton; diff --git a/src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx b/src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx new file mode 100644 index 000000000..110b57a5d --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx @@ -0,0 +1,77 @@ +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_FileInfoDlg.cxx +// Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com) +// + +#include "SMESHGUI_FileInfoDlg.h" + +#include + +#include +#include +#include + +SMESHGUI_FileInfoDlg::SMESHGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf ) + : QtxDialog( parent, true, true, QtxDialog::OK ) +{ + setWindowTitle( tr( "CAPTION" ) ); + setSizeGripEnabled( true ); + + QLineEdit* fname = new QLineEdit( mainFrame() ); + fname->setReadOnly( true ); + QLineEdit* fsize = new QLineEdit( mainFrame() ); + fsize->setReadOnly( true ); + QLineEdit* medversion = new QLineEdit( mainFrame() ); + medversion->setReadOnly( true ); + fname->setMinimumWidth( 300 ); + + QGridLayout* lay = new QGridLayout( mainFrame() ); + lay->setMargin( 5 ); lay->setSpacing( 5 ); + lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 ); + lay->addWidget( fname, 0, 1 ); + lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 ); + lay->addWidget( fsize, 1, 1 ); + lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 ); + lay->addWidget( medversion, 2, 1 ); + + fname->setText( (char*)inf->fileName ); + fname->home( false ); + fsize->setText( QString::number( inf->fileSize ) ); + + QString version; + if( inf->major>=0 ) + { + version = QString::number( inf->major ); + if( inf->minor>=0 ) + { + version += "." + QString::number( inf->minor ); + if( inf->release>=0 ) + version += "." + QString::number( inf->release ); + } + } + medversion->setText( version ); +} + +SMESHGUI_FileInfoDlg::~SMESHGUI_FileInfoDlg() +{ +} diff --git a/src/SMESHGUI/SMESHGUI_FileInfoDlg.h b/src/SMESHGUI/SMESHGUI_FileInfoDlg.h new file mode 100644 index 000000000..c6c1138fa --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_FileInfoDlg.h @@ -0,0 +1,43 @@ +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_FileInfoDlg.h +// Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com) +// + +#ifndef SMESHGUI_FILEINFODLG_H +#define SMESHGUI_FILEINFODLG_H + +#include + +#include +#include CORBA_CLIENT_HEADER(MED) + +class SMESHGUI_FileInfoDlg : public QtxDialog +{ + Q_OBJECT + +public: + SMESHGUI_FileInfoDlg( QWidget*, SALOME_MED::MedFileInfo* ); + virtual ~SMESHGUI_FileInfoDlg(); +}; + +#endif // SMESHGUI_FILEINFODLG_H diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index 6e7587fe9..037a355b0 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -32,6 +32,7 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" +#include "SMESHGUI_MeshEditPreview.h" #include #include @@ -47,10 +48,12 @@ #include #include +#include #include #include #include +#include // OCCT includes #include @@ -87,6 +90,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { + mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); + SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE"))); QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE"))); @@ -187,18 +192,38 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) GroupAxisLayout->addWidget(TextLabelDZ, 1, 6); GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7); - // Controls for angle defining - TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupArguments); - SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments); + // Controls for angle defining & number of steps defining + GroupAngleBox = new QGroupBox(tr("SMESH_ANGLE"), GroupArguments); + GroupAngle = new QButtonGroup(GroupAngleBox); + QGridLayout* GroupAngleLayout = new QGridLayout(GroupAngleBox); + GroupAngleLayout->setSpacing(6); + GroupAngleLayout->setMargin(11); + + RadioButton3 = new QRadioButton(tr("ANGLE_BY_STEP"), GroupAngleBox); + RadioButton4 = new QRadioButton(tr("TOTAL_ANGLE"), GroupAngleBox); + GroupAngle->addButton(RadioButton3, 0); + GroupAngle->addButton(RadioButton4, 1); + + TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupAngleBox); + SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngleBox); - // Controls for nb. steps defining - TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments); - SpinBox_NbSteps = new QSpinBox(GroupArguments); + TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupAngleBox); + SpinBox_NbSteps = new QSpinBox(GroupAngleBox); + + GroupAngleLayout->addWidget(RadioButton3, 0, 0); + GroupAngleLayout->addWidget(RadioButton4, 0, 1); + GroupAngleLayout->addWidget(TextLabelAngle, 1, 0); + GroupAngleLayout->addWidget(SpinBox_Angle, 1, 1); + GroupAngleLayout->addWidget(TextLabelNbSteps, 2, 0); + GroupAngleLayout->addWidget(SpinBox_NbSteps, 2, 1); // Controls for tolerance defining TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), GroupArguments); SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments); + // Control for mesh preview + CheckBoxPreview = new QCheckBox(tr("PREVIEW"), GroupArguments); + // CheckBox for groups generation MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); MakeGroupsCheck->setChecked(true); @@ -208,12 +233,10 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) GroupArgumentsLayout->addWidget(LineEditElements, 0, 2); GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 3); GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 3); - GroupArgumentsLayout->addWidget(TextLabelAngle, 3, 0, 1, 2); - GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2); - GroupArgumentsLayout->addWidget(TextLabelNbSteps, 4, 0, 1, 2); - GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 4, 2); - GroupArgumentsLayout->addWidget(TextLabelTolerance, 5, 0, 1, 2); - GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 5, 2); + GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 3); + GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0, 1, 2); + GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2); + GroupArgumentsLayout->addWidget(CheckBoxPreview, 5, 0, 1, 3); GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 3); /***************************************************************/ @@ -253,6 +276,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); + RadioButton3->setChecked(true); + SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, 3); SpinBox_NbSteps->setRange(1, 999999); @@ -291,6 +316,10 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) connect(SelectPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(SpinBox_X, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation())); + connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation())); + connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation())); + connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); @@ -302,6 +331,12 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); + connect(GroupAngle, SIGNAL(buttonClicked(int)), this, SLOT(toDisplaySimulation())); + connect(SpinBox_Angle, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation())); + connect(SpinBox_NbSteps, SIGNAL(valueChanged(int)), this, SLOT(toDisplaySimulation())); + connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation())); + connect(CheckBoxPreview, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool))); + ConstructorsClicked(0); SelectionIntoArgument(); } @@ -312,7 +347,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) //================================================================================= SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg() { - // no need to delete child widgets, Qt does it all for us + delete mySimulation; } //================================================================================= @@ -345,6 +380,8 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls) CheckBoxMesh->setChecked(false); onSelectMesh(false); + CheckBoxPreview->setChecked(false); + onDisplaySimulation(false); } } @@ -354,7 +391,17 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls) //================================================================================= void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId) { - disconnect(mySelectionMgr, 0, this, 0); + //disconnect(mySelectionMgr, 0, this, 0); + + SALOME_ListIO io; + mySelectionMgr->selectedObjects( io ); + SALOME_ListIO aList; + mySelectionMgr->setSelectedObjects( aList ); +// LineEditElements->clear(); + myNbOkElements = 0; + buttonApply->setEnabled(false); + buttonOk->setEnabled(false); + mySimulation->SetVisibility(false); Selection_Mode aSelMode = ActorSelection; @@ -389,7 +436,8 @@ void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId) if (CheckBoxMesh->isChecked()) onSelectMesh(true); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + //connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelectionMgr->setSelectedObjects( io ); } //================================================================================= @@ -423,6 +471,9 @@ void SMESHGUI_RevolutionDlg::ClickOnApply() long aNbSteps = (long)SpinBox_NbSteps->value(); double aTolerance = SpinBox_Tolerance->GetValue(); + if ( GroupAngle->checkedId() == 1 ) + anAngle = anAngle/aNbSteps; + try { SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); @@ -544,6 +595,7 @@ void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText) buttonOk->setEnabled(true); buttonApply->setEnabled(true); } + onDisplaySimulation(true); myBusy = false; } @@ -714,6 +766,8 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument() buttonOk->setEnabled(true); buttonApply->setEnabled(true); } + + onDisplaySimulation(true); } //================================================================================= @@ -729,6 +783,7 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument() mySelectionMgr->clearFilters(); if (send == SelectElementsButton) { + mySimulation->SetVisibility(false); myEditCurrentArgument = (QWidget*)LineEditElements; SMESH::SetPointRepresentation(false); if (CheckBoxMesh->isChecked()) { @@ -842,6 +897,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh) if (myEditCurrentArgument != LineEditElements) { LineEditElements->clear(); + mySimulation->SetVisibility(false); return; } @@ -870,6 +926,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh) LineEditElements->setReadOnly(false); LineEditElements->setValidator(myIdValidator); onTextChange(LineEditElements->text()); + mySimulation->SetVisibility(false); } SelectionIntoArgument(); @@ -908,6 +965,7 @@ void SMESHGUI_RevolutionDlg::onVectorChanged() buttonOk->setEnabled(false); buttonApply->setEnabled(false); } + onDisplaySimulation(true); } //================================================================================= @@ -925,3 +983,71 @@ void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e ) ClickOnHelp(); } } + +//================================================================================= +// function : toDisplaySimulation() +// purpose : +//================================================================================= +void SMESHGUI_RevolutionDlg::toDisplaySimulation() +{ + onDisplaySimulation(true); +} + +//================================================================================= +// function : onDisplaySimulation() +// purpose : +//================================================================================= +void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview) +{ + if (CheckBoxPreview->isChecked() && toDisplayPreview) + { + //display preview + if (myNbOkElements && IsAxisOk()) + { + QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts); + + SMESH::long_array_var anElementsId = new SMESH::long_array; + + anElementsId->length(aListElementsId.count()); + for (int i = 0; i < aListElementsId.count(); i++) + anElementsId[i] = aListElementsId[i].toInt(); + + SMESH::AxisStruct anAxis; + + anAxis.x = SpinBox_X->GetValue(); + anAxis.y = SpinBox_Y->GetValue(); + anAxis.z = SpinBox_Z->GetValue(); + anAxis.vx = SpinBox_DX->GetValue(); + anAxis.vy = SpinBox_DY->GetValue(); + anAxis.vz = SpinBox_DZ->GetValue(); + + double anAngle = (SpinBox_Angle->GetValue())*PI/180; + long aNbSteps = (long)SpinBox_NbSteps->value(); + double aTolerance = SpinBox_Tolerance->GetValue(); + + if (GroupAngle->checkedId() == 1) + anAngle = anAngle/aNbSteps; + + try { + SUIT_OverrideCursor aWaitCursor; + SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer(); + aMeshEditor->RotationSweep(anElementsId.inout(), + anAxis, + anAngle, + aNbSteps, + aTolerance); + SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData(); + mySimulation->SetData(aMeshPreviewStruct._retn()); + } catch (...) {} + } + else + { + mySimulation->SetVisibility(false); + } + } + else + { + //erase preview + mySimulation->SetVisibility(false); + } +} diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h index 098cf7a18..206d737eb 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h @@ -51,6 +51,8 @@ class SMESH_Actor; class SVTK_Selector; class LightApp_SelectionMgr; class SMESH_LogicalFilter; +class SALOME_Actor; +class SMESHGUI_MeshEditPreview; //================================================================================= // class : SMESHGUI_RevolutionDlg @@ -65,83 +67,92 @@ public: ~SMESHGUI_RevolutionDlg(); private: - void Init( bool = true); - void closeEvent( QCloseEvent* ); - void enterEvent( QEvent* ); /* mouse enter the QWidget */ - void hideEvent( QHideEvent* ); /* ESC key */ - void keyPressEvent( QKeyEvent* ); - int GetConstructorId(); - bool IsAxisOk(); + void Init( bool = true); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + int GetConstructorId(); + bool IsAxisOk(); - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - SMESHGUI_IdValidator* myIdValidator; - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - int myNbOkElements; /* to check when elements are defined */ - QString myElementsId; - QWidget* myEditCurrentArgument; /* Current argument */ - SVTK_Selector* mySelector; + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + SMESHGUI_IdValidator* myIdValidator; + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + int myNbOkElements; /* to check when elements are defined */ + QString myElementsId; + QWidget* myEditCurrentArgument; /* Current argument */ + SVTK_Selector* mySelector; - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; + SMESHGUI_MeshEditPreview* mySimulation; + SALOME_Actor* myPreviewActor; - QGroupBox* ConstructorsBox; - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QRadioButton* RadioButton2; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupArguments; - QGroupBox* GroupAxis; - QLabel* TextLabelElements; - QPushButton* SelectElementsButton; - QLineEdit* LineEditElements; - QCheckBox* CheckBoxMesh; - QCheckBox* MakeGroupsCheck; + QGroupBox* ConstructorsBox; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupArguments; + QGroupBox* GroupAxis; + QLabel* TextLabelElements; + QPushButton* SelectElementsButton; + QLineEdit* LineEditElements; + QCheckBox* CheckBoxMesh; + QCheckBox* MakeGroupsCheck; + QGroupBox* GroupAngleBox; + QButtonGroup* GroupAngle; + QRadioButton* RadioButton3; + QRadioButton* RadioButton4; + QCheckBox* CheckBoxPreview; - QLabel* TextLabelPoint; - QPushButton* SelectPointButton; - QLabel* TextLabelX; - SMESHGUI_SpinBox* SpinBox_X; - QLabel* TextLabelY; - SMESHGUI_SpinBox* SpinBox_Y; - QLabel* TextLabelZ; - SMESHGUI_SpinBox* SpinBox_Z; - QLabel* TextLabelVector; - QPushButton* SelectVectorButton; - QLabel* TextLabelDX; - SMESHGUI_SpinBox* SpinBox_DX; - QLabel* TextLabelDY; - SMESHGUI_SpinBox* SpinBox_DY; - QLabel* TextLabelDZ; - SMESHGUI_SpinBox* SpinBox_DZ; + QLabel* TextLabelPoint; + QPushButton* SelectPointButton; + QLabel* TextLabelX; + SMESHGUI_SpinBox* SpinBox_X; + QLabel* TextLabelY; + SMESHGUI_SpinBox* SpinBox_Y; + QLabel* TextLabelZ; + SMESHGUI_SpinBox* SpinBox_Z; + QLabel* TextLabelVector; + QPushButton* SelectVectorButton; + QLabel* TextLabelDX; + SMESHGUI_SpinBox* SpinBox_DX; + QLabel* TextLabelDY; + SMESHGUI_SpinBox* SpinBox_DY; + QLabel* TextLabelDZ; + SMESHGUI_SpinBox* SpinBox_DZ; - QLabel* TextLabelAngle; - SMESHGUI_SpinBox* SpinBox_Angle; - QLabel* TextLabelNbSteps; - QSpinBox* SpinBox_NbSteps; - QLabel* TextLabelTolerance; - SMESHGUI_SpinBox* SpinBox_Tolerance; + QLabel* TextLabelAngle; + SMESHGUI_SpinBox* SpinBox_Angle; + QLabel* TextLabelNbSteps; + QSpinBox* SpinBox_NbSteps; + QLabel* TextLabelTolerance; + SMESHGUI_SpinBox* SpinBox_Tolerance; - QString myHelpFileName; + QString myHelpFileName; private slots: - void ConstructorsClicked( int ); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument(); - void SelectionIntoArgument(); - void DeactivateActiveDialog(); - void ActivateThisDialog(); - void onTextChange( const QString& ); - void onSelectMesh( bool ); - void onVectorChanged(); + void ConstructorsClicked( int ); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onSelectMesh( bool ); + void onVectorChanged(); + void toDisplaySimulation(); + void onDisplaySimulation( bool ); }; #endif // SMESHGUI_REVOLUTIONDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index af48b3008..6ec33b7ce 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -114,6 +114,8 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const else if ( p=="displayMode" ) val = QVariant( displayMode( ind ) ); else if ( p=="isComputable" ) val = QVariant( isComputable( ind ) ); else if ( p=="hasReference" ) val = QVariant( hasReference( ind ) ); + else if ( p=="isImported" ) val = QVariant( isImported( ind ) ); + if( val.isValid() ) return val; @@ -486,3 +488,20 @@ QString SMESHGUI_Selection::typeName( const int t ) return "Unknown"; } } + +bool SMESHGUI_Selection::isImported( const int ind ) const +{ + QString e = entry( ind ); + _PTR(SObject) SO = SMESH::GetActiveStudyDocument()->FindObjectID( e.toLatin1().constData() ); + bool res = false; + if( SO ) + { + SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( SO ) ); + if( !aMesh->_is_nil() ) + { + SALOME_MED::MedFileInfo* inf = aMesh->GetMEDFileInfo(); + res = strlen( (char*)inf->fileName ) > 0; + } + } + return res; +} diff --git a/src/SMESHGUI/SMESHGUI_Selection.h b/src/SMESHGUI/SMESHGUI_Selection.h index 2b77aaf3f..4d1ba4a63 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.h +++ b/src/SMESHGUI/SMESHGUI_Selection.h @@ -70,6 +70,8 @@ public: static int type( const QString&, _PTR(Study) ); static QString typeName( const int ); + bool isImported( const int ) const; + private: QStringList myTypes; QList myActors; diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index ecad9b6c9..80b0c6106 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -2727,6 +2727,10 @@ Consider saving your work before application crash WARP_ELEMENTS Warping + + MEN_FILE_INFO + MED file information + SMESHGUI @@ -4093,7 +4097,7 @@ It is impossible to read point coordinates from file SMESHGUI_RevolutionDlg ANGLE_BY_STEP - Use Angle by Step + Angle by Step PREVIEW @@ -4113,7 +4117,7 @@ It is impossible to read point coordinates from file TOTAL_ANGLE - Use Total Angle + Total Angle @@ -4308,4 +4312,23 @@ It is impossible to read point coordinates from file Gravity center + + SMESHGUI_FileInfoDlg + + CAPTION + File information + + + FILE_NAME + File name + + + FILE_SIZE + File size (bytes) + + + MED_VERSION + MED version + + diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index f933abfb7..c9d70e0bf 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -338,7 +338,8 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand ) } // Concatenate( [mesh1, ...], ... ) - if ( theCommand->GetMethod() == "Concatenate" ) + if ( theCommand->GetMethod() == "Concatenate" || + theCommand->GetMethod() == "ConcatenateWithGroups") { AddMeshAccessorMethod( theCommand ); } diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index f05003b01..a27316fa3 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1418,6 +1418,52 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe CORBA::Boolean theMergeNodesAndElements, CORBA::Double theMergeTolerance) throw ( SALOME::SALOME_Exception ) +{ + return ConcatenateCommon(theMeshesArray, + theUniteIdenticalGroups, + theMergeNodesAndElements, + theMergeTolerance, + false); +} + +//================================================================================ +/*! + * SMESH_Gen_i::ConcatenateWithGroups + * + * Concatenate the given meshes into one mesh + * Create the groups of all elements from initial meshes + */ +//================================================================================ + +SMESH::SMESH_Mesh_ptr +SMESH_Gen_i::ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray, + CORBA::Boolean theUniteIdenticalGroups, + CORBA::Boolean theMergeNodesAndElements, + CORBA::Double theMergeTolerance) + throw ( SALOME::SALOME_Exception ) +{ + return ConcatenateCommon(theMeshesArray, + theUniteIdenticalGroups, + theMergeNodesAndElements, + theMergeTolerance, + true); +} + +//================================================================================ +/*! + * SMESH_Gen_i::ConcatenateCommon + * + * Concatenate the given meshes into one mesh + */ +//================================================================================ + +SMESH::SMESH_Mesh_ptr +SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray, + CORBA::Boolean theUniteIdenticalGroups, + CORBA::Boolean theMergeNodesAndElements, + CORBA::Double theMergeTolerance, + CORBA::Boolean theCommonGroups) + throw ( SALOME::SALOME_Exception ) { typedef map TIDsMap; typedef list TListOfNewGroups; @@ -1458,6 +1504,23 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe const SMDS_MeshElement* aNewElem = 0; int anElemNbNodes = 0; + int anNbNodes = 0; + int anNbEdges = 0; + int anNbFaces = 0; + int anNbVolumes = 0; + + SMESH::long_array_var anIDsNodes = new SMESH::long_array(); + SMESH::long_array_var anIDsEdges = new SMESH::long_array(); + SMESH::long_array_var anIDsFaces = new SMESH::long_array(); + SMESH::long_array_var anIDsVolumes = new SMESH::long_array(); + + if( theCommonGroups ) { + anIDsNodes->length( anInitMeshDS->NbNodes() ); + anIDsEdges->length( anInitMeshDS->NbEdges() ); + anIDsFaces->length( anInitMeshDS->NbFaces() ); + anIDsVolumes->length( anInitMeshDS->NbVolumes() ); + } + for ( int j = 0; itElems->more(); j++) { anElem = itElems->next(); SMDSAbs_ElementType anElemType = anElem->GetType(); @@ -1474,6 +1537,8 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe if ( nodesMap.find(aNode->GetID()) == nodesMap.end() ) { aNewNode = aNewMeshDS->AddNode(aNode->X(), aNode->Y(), aNode->Z()); nodesMap.insert( make_pair(aNode->GetID(), aNewNode->GetID()) ); + if( theCommonGroups ) + anIDsNodes[anNbNodes++] = aNewNode->GetID(); } else aNewNode = aNewMeshDS->FindNode( nodesMap.find(aNode->GetID())->second ); @@ -1489,6 +1554,8 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray, aVolume->GetQuanities()); elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID())); + if( theCommonGroups ) + anIDsVolumes[anNbVolumes++] = aNewElem->GetID(); } } else { @@ -1497,6 +1564,14 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe anElemType, anElem->IsPoly()); elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID())); + if( theCommonGroups ) { + if( anElemType == SMDSAbs_Edge ) + anIDsEdges[anNbEdges++] = aNewElem->GetID(); + else if( anElemType == SMDSAbs_Face ) + anIDsFaces[anNbFaces++] = aNewElem->GetID(); + else if( anElemType == SMDSAbs_Volume ) + anIDsVolumes[anNbVolumes++] = aNewElem->GetID(); + } } }//elems loop @@ -1507,12 +1582,81 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe SMESH::long_array_var anInitIDs = new SMESH::long_array(); SMESH::long_array_var anNewIDs = new SMESH::long_array(); SMESH::SMESH_Group_var aNewGroup; + + SMESH::ElementType aGroupType; + CORBA::String_var aGroupName; + if ( theCommonGroups ) { + for(aGroupType=SMESH::NODE;aGroupType<=SMESH::VOLUME;aGroupType=(SMESH::ElementType)(aGroupType+1)) { + string str = "Gr"; + SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, anInitMesh ); + if(aMeshSObj) + str += aMeshSObj->GetName(); + str += "_"; + + int anLen = 0; + + switch(aGroupType) { + case SMESH::NODE: + str += "Nodes"; + anIDsNodes->length(anNbNodes); + anLen = anNbNodes; + break; + case SMESH::EDGE: + str += "Edges"; + anIDsEdges->length(anNbEdges); + anLen = anNbEdges; + break; + case SMESH::FACE: + str += "Faces"; + anIDsFaces->length(anNbFaces); + anLen = anNbFaces; + break; + case SMESH::VOLUME: + str += "Volumes"; + anIDsVolumes->length(anNbVolumes); + anLen = anNbVolumes; + break; + default: + break; + } + + if(anLen) { + aGroupName = str.c_str(); + + // add a new group in the mesh + aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName); + + switch(aGroupType) { + case SMESH::NODE: + aNewGroup->Add( anIDsNodes ); + break; + case SMESH::EDGE: + aNewGroup->Add( anIDsEdges ); + break; + case SMESH::FACE: + aNewGroup->Add( anIDsFaces ); + break; + case SMESH::VOLUME: + aNewGroup->Add( anIDsVolumes ); + break; + default: + break; + } + + aListOfNewGroups.clear(); + aListOfNewGroups.push_back(aNewGroup); + aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups )); + } + } + } + + // check that current group name and type don't have identical ones in union mesh for (int i = 0; i < aListOfGroups->length(); i++) { aGroup = aListOfGroups[i]; aListOfNewGroups.clear(); - SMESH::ElementType aGroupType = aGroup->GetType(); - CORBA::String_var aGroupName = aGroup->GetName(); - + aGroupType = aGroup->GetType(); + aGroupName = aGroup->GetName(); + TGroupsMap::iterator anIter = aGroupsMap.find(make_pair(aGroupName, aGroupType)); // convert a list of IDs @@ -1579,7 +1723,11 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe } // Update Python script - aPythonDump << aNewMesh << " = " << this << ".Concatenate("; + aPythonDump << aNewMesh << " = " << this; + if( !theCommonGroups ) + aPythonDump << ".Concatenate("; + else + aPythonDump << ".ConcatenateWithGroups("; aPythonDump << "["; for ( int i = 0; i < theMeshesArray.length(); i++) { if (i > 0) aPythonDump << ", "; @@ -1587,7 +1735,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe } aPythonDump << "], "; aPythonDump << theUniteIdenticalGroups << ", " - << theMergeNodesAndElements << ", " + << theMergeNodesAndElements << ", " << theMergeTolerance << ")"; return aNewMesh._retn(); diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index d97b6fbf9..f8d43bb9b 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -259,6 +259,14 @@ public: CORBA::Long theElementID) throw ( SALOME::SALOME_Exception ); + // Concatenate the given meshes into one mesh + SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::mesh_array& theMeshesArray, + CORBA::Boolean theUniteIdenticalGroups, + CORBA::Boolean theMergeNodesAndElements, + CORBA::Double theMergeTolerance, + CORBA::Boolean theCommonGroups) + throw ( SALOME::SALOME_Exception ); + // Concatenate the given meshes into one mesh SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::mesh_array& theMeshesArray, CORBA::Boolean theUniteIdenticalGroups, @@ -266,6 +274,13 @@ public: CORBA::Double theMergeTolerance) throw ( SALOME::SALOME_Exception ); + // Concatenate the given meshes into one mesh + // Create the groups of all elements from initial meshes + SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray, + CORBA::Boolean theUniteIdenticalGroups, + CORBA::Boolean theMergeNodesAndElements, + CORBA::Double theMergeTolerance) + throw ( SALOME::SALOME_Exception ); // **************************************************** // Interface inherited methods (from SALOMEDS::Driver) diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index c9f00811c..507b3a23f 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -2089,6 +2089,57 @@ SMESH_MeshEditor_i::LinearAnglesVariation(SMESH::SMESH_Mesh_ptr thePathMes const SMESH::double_array & theAngles) { SMESH::double_array_var aResult = new SMESH::double_array(); + int nbAngles = theAngles.length(); + if ( nbAngles > 0 && !thePathMesh->_is_nil() && !thePathShape->_is_nil() ) + { + SMESH_Mesh_i* aMeshImp = SMESH::DownCast( thePathMesh ); + TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape ); + SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape ); + if ( !aSubMesh || !aSubMesh->GetSubMeshDS()) + return aResult._retn(); + int nbSteps = aSubMesh->GetSubMeshDS()->NbElements(); + if ( nbSteps == nbAngles ) + { + aResult.inout() = theAngles; + } + else + { + aResult->length( nbSteps ); + double rAn2St = double( nbAngles ) / double( nbSteps ); + double angPrev = 0, angle; + for ( int iSt = 0; iSt < nbSteps; ++iSt ) + { + double angCur = rAn2St * ( iSt+1 ); + double angCurFloor = floor( angCur ); + double angPrevFloor = floor( angPrev ); + if ( angPrevFloor == angCurFloor ) + angle = rAn2St * theAngles[ int( angCurFloor ) ]; + else + { + int iP = int( angPrevFloor ); + double angPrevCeil = ceil(angPrev); + angle = ( angPrevCeil - angPrev ) * theAngles[ iP ]; + + int iC = int( angCurFloor ); + if ( iC < nbAngles ) + angle += ( angCur - angCurFloor ) * theAngles[ iC ]; + + iP = int( angPrevCeil ); + while ( iC-- > iP ) + angle += theAngles[ iC ]; + } + aResult[ iSt ] = angle; + angPrev = angCur; + } + } + } + // Update Python script + TPythonDump() << "rotAngles = " << theAngles; + TPythonDump() << "rotAngles = " << this << ".LinearAnglesVariation( " + << thePathMesh << ", " + << thePathShape << ", " + << "rotAngles )"; + return aResult._retn(); } diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index a52c3b0c2..3bc02f9bf 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -240,6 +240,7 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName ) THROW_SALOME_CORBA_EXCEPTION("ImportMEDFile(): unknown exception", SALOME::BAD_PARAM); } + myFile = theFileName; CreateGroupServants(); return ConvertDriverMEDReadStatus(status); @@ -2479,3 +2480,28 @@ SMESH::ListOfGroups* SMESH_Mesh_i::GetGroups(const list& groupIDs) const aList->length( nbGroups ); return aList._retn(); } + +//============================================================================= +/*! + * \brief Return information about imported file + */ +//============================================================================= +SALOME_MED::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo() +{ + SALOME_MED::MedFileInfo_var res = new SALOME_MED::MedFileInfo(); + + const char* name = myFile.c_str(); + res->fileName = name; + res->fileSize = 0;//myFileInfo.size(); + int major, minor, release; + if( !MED::getMEDVersion( name, major, minor, release ) ) + { + major = -1; + minor = -1; + release = -1; + } + res->major = major; + res->minor = minor; + res->release = release; + return res._retn(); +} diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 54842e09d..c4d4a7277 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -436,6 +436,10 @@ public: */ SMESH::double_array* BaryCenter(CORBA::Long id); + /*! + * Returns information about imported MED file + */ + virtual SALOME_MED::MedFileInfo* GetMEDFileInfo(); std::map _mapSubMesh_i; //NRI std::map _mapSubMesh; //NRI @@ -450,6 +454,7 @@ private: std::map _mapSubMeshIor; std::map _mapGroups; std::map _mapHypo; + string myFile; }; #endif diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index f4a294088..a5560ba04 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -26,6 +26,14 @@ \brief Module smesh """ +## \package smeshDC +# To get started, please look at smeshDC::smeshDC documentation for general services of smesh package. +# You can find the smeshDC::smeshDC documentation also by the first +# item in the Data Structures list on this page. +# See also the list of Data Structures and the list of Functions +# for other classes and methods of smesh python interface. + + import salome import geompyDC @@ -97,7 +105,7 @@ def GetName(obj): attr = sobj.FindAttribute("AttributeName")[1] return attr.Value() - ## Sets name to object +## Sets name to object def SetName(obj, name): ior = salome.orb.object_to_string(obj) sobj = salome.myStudy.FindObjectIOR(ior) @@ -105,7 +113,7 @@ def SetName(obj, name): attr = sobj.FindAttribute("AttributeName")[1] attr.SetValue(name) - ## Print error message if a hypothesis was not assigned. +## Print error message if a hypothesis was not assigned. def TreatHypoStatus(status, hypName, geomName, isAlgo): if isAlgo: hypType = "algorithm" @@ -142,18 +150,35 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo): print hypName, "was not assigned to",geomName,":", reason pass +## Convert angle in degrees to radians +def DegreesToRadians(AngleInDegrees): + from math import pi + return AngleInDegrees * pi / 180.0 + +## Methods of package smesh.py: general services of MESH component. +# +# This class has been designed to provide general services of the MESH component. +# All methods of this class are accessible directly from the smesh.py package. +# Use these methods to create an empty mesh, to import mesh from a file, +# and also to create patterns and filtering criteria. class smeshDC(SMESH._objref_SMESH_Gen): + ## To set current study and Geometry component def init_smesh(self,theStudy,geompyD): self.geompyD=geompyD self.SetGeomEngine(geompyD) self.SetCurrentStudy(theStudy) + ## Create an empty Mesh. This mesh can have underlying geometry. + # @param obj Geometrical object to build the mesh on. If not defined, + # the mesh will not have underlying geometry. + # @param name A name for the new mesh. + # @return instance of Mesh class. def Mesh(self, obj=0, name=0): return Mesh(self,self.geompyD,obj,name) ## Returns long value from enumeration - # Uses for SMESH.FunctorType enumeration + # To be used for SMESH.FunctorType enumeration def EnumToLong(self,theItem): return theItem._v @@ -258,15 +283,16 @@ class smeshDC(SMESH._objref_SMESH_Gen): return aMesh ## From SMESH_Gen interface + # @return list of integer values def GetSubShapesId( self, theMainObject, theListOfSubObjects ): return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects) ## From SMESH_Gen interface. Creates pattern + # @return an instance of SMESH_Pattern def GetPattern(self): return SMESH._objref_SMESH_Gen.GetPattern(self) - # Filtering. Auxiliary functions: # ------------------------------ @@ -426,8 +452,11 @@ omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC) ## Class to define a mesh # -# The class contains mesh shape, SMESH_Mesh, SMESH_MeshEditor -# More details. +# This class allows to define and manage a mesh. +# It has a set of methods to build a mesh on the given geometry, including definition of sub-meshes. +# Also it has methods to define groups of mesh elements, to modify a mesh (by addition of +# new nodes and elements and by changind of existing entities), to take information +# about a mesh and to export a mesh into different formats. class Mesh: geom = 0 @@ -436,7 +465,7 @@ class Mesh: ## Constructor # - # Creates mesh on the shape \a geom(or the empty mesh if geom equal to 0), + # Creates mesh on the shape \a obj (or the empty mesh if obj is equal to 0), # sets GUI name of this mesh to \a name. # @param obj Shape to be meshed or SMESH_Mesh object # @param name Study name of the mesh @@ -460,30 +489,32 @@ class Mesh: self.editor = self.mesh.GetMeshEditor() - ## Method that inits the Mesh object from SMESH_Mesh interface + ## Method that inits the Mesh object from instance of SMESH_Mesh interface # @param theMesh is SMESH_Mesh object def SetMesh(self, theMesh): self.mesh = theMesh self.geom = self.mesh.GetShapeToMesh() - ## Method that returns the mesh + ## Method that returns the mesh, that is instance of SMESH_Mesh interface # @return SMESH_Mesh object def GetMesh(self): return self.mesh ## Get mesh name + # @return name of the mesh as a string def GetName(self): name = GetName(self.GetMesh()) return name ## Set name to mesh + # @param name a new name for the mesh def SetName(self, name): SetName(self.GetMesh(), name) - ## Get the subMesh object associated to a subShape. The subMesh object - # gives access to nodes and elements IDs. - # \n SubMesh will be used instead of SubShape in a next idl version to - # adress a specific subMesh... + ## Get the subMesh object associated to \a theSubObject geometrical object. + # The subMesh object gives access to nodes and elements IDs. + # @param theSubObject A geometrical object (shape) + # @return object of type SMESH_SubMesh, representing part of mesh, which lays on the given shape def GetSubMesh(self, theSubObject, name): submesh = self.mesh.GetSubMesh(theSubObject, name) return submesh @@ -494,19 +525,18 @@ class Mesh: return self.geom ## Method that associates given shape to the mesh(entails the mesh recreation) - # @param geom shape to be meshed(GEOM_Object) + # @param geom shape to be meshed (GEOM_Object) def SetShape(self, geom): self.mesh = self.smeshpyD.CreateMesh(geom) ## Return true if hypotheses are defined well - # @param theMesh is an instance of Mesh class # @param theSubObject subshape of a mesh shape + # @return True or False def IsReadyToCompute(self, theSubObject): return self.smeshpyD.IsReadyToCompute(self.mesh, theSubObject) - ## Return errors of hypotheses definintion - # error list is empty if everything is OK - # @param theMesh is an instance of Mesh class + ## Return errors of hypotheses definition. + # Errors list is empty if everything is OK. # @param theSubObject subshape of a mesh shape # @return a list of errors def GetAlgoState(self, theSubObject): @@ -515,14 +545,14 @@ class Mesh: ## Return geometrical object the given element is built on. # The returned geometrical object, if not nil, is either found in the # study or is published by this method with the given name - # @param theMesh is an instance of Mesh class # @param theElementID an id of the mesh element # @param theGeomName user defined name of geometrical object # @return GEOM::GEOM_Object instance def GetGeometryByMeshElement(self, theElementID, theGeomName): return self.smeshpyD.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName ) - ## Returns mesh dimension depending on shape one + ## Returns mesh dimension depending on that of the underlying shape + # @return mesh dimension as an integer value [0,3] def MeshDimension(self): shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SHELL"] ) if len( shells ) > 0 : @@ -536,11 +566,15 @@ class Mesh: pass ## Creates a segment discretization 1D algorithm. - # If the optional \a algo parameter is not sets, this algorithm is REGULAR. - # If the optional \a geom parameter is not sets, this algorithm is global. - # \n Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param algo values are smesh.REGULAR or smesh.PYTHON for discretization via python function + # If the optional \a algo parameter is not set, this algorithm is REGULAR. + # \n If the optional \a geom parameter is not set, this algorithm is global. + # Otherwise, this algorithm define a submesh based on \a geom subshape. + # @param algo type of desired algorithm. Possible values are: + # - smesh.REGULAR, + # - smesh.PYTHON for discretization via python function, + # - smesh.COMPOSITE for meshing a set of edges on one face side as a whole. # @param geom If defined, subshape to be meshed + # @return instance of Mesh_Segment or Mesh_Segment_Python, or Mesh_CompositeSegment class def Segment(self, algo=REGULAR, geom=0): ## if Segment(geom) is called by mistake if isinstance( algo, geompyDC.GEOM._objref_GEOM_Object): @@ -581,20 +615,22 @@ class Mesh: ## Creates a triangle 2D algorithm for faces. # If the optional \a geom parameter is not sets, this algorithm is global. # \n Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param algo values are: smesh.MEFISTO || smesh.NETGEN_1D2D || smesh.NETGEN_2D - # @param geom If defined, subshape to be meshed + # @param algo values are: smesh.MEFISTO || smesh.NETGEN_1D2D || smesh.NETGEN_2D || smesh.BLSURF + # @param geom If defined, subshape to be meshed (GEOM_Object) + # @return an instance of Mesh_Triangle algorithm def Triangle(self, algo=MEFISTO, geom=0): ## if Triangle(geom) is called by mistake - if ( isinstance( algo, geompyDC.GEOM._objref_GEOM_Object)): + if (isinstance(algo, geompyDC.GEOM._objref_GEOM_Object)): geom = algo algo = MEFISTO - return Mesh_Triangle(self, algo, geom) + return Mesh_Triangle(self, algo, geom) ## Creates a quadrangle 2D algorithm for faces. # If the optional \a geom parameter is not sets, this algorithm is global. # \n Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom If defined, subshape to be meshed + # @param geom If defined, subshape to be meshed (GEOM_Object) + # @return an instance of Mesh_Quadrangle algorithm def Quadrangle(self, geom=0): return Mesh_Quadrangle(self, geom) @@ -603,7 +639,8 @@ class Mesh: # If the optional \a geom parameter is not sets, this algorithm is global. # \n Otherwise, this algorithm define a submesh based on \a geom subshape. # @param algo values are: smesh.NETGEN, smesh.GHS3D, smesh.FULL_NETGEN - # @param geom If defined, subshape to be meshed + # @param geom If defined, subshape to be meshed (GEOM_Object) + # @return an instance of Mesh_Tetrahedron algorithm def Tetrahedron(self, algo=NETGEN, geom=0): ## if Tetrahedron(geom) is called by mistake if ( isinstance( algo, geompyDC.GEOM._objref_GEOM_Object)): @@ -615,9 +652,9 @@ class Mesh: ## Creates a hexahedron 3D algorithm for solids. # If the optional \a geom parameter is not sets, this algorithm is global. # \n Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom If defined, subshape to be meshed - ## def Hexahedron(self, geom=0): - ## return Mesh_Hexahedron(self, geom) + # @param algo possible values are: smesh.Hexa, smesh.Hexotic + # @param geom If defined, subshape to be meshed (GEOM_Object) + # @return an instance of Mesh_Hexahedron algorithm def Hexahedron(self, algo=Hexa, geom=0): ## if Hexahedron(geom, algo) or Hexahedron(geom) is called by mistake if ( isinstance(algo, geompyDC.GEOM._objref_GEOM_Object) ): @@ -626,6 +663,7 @@ class Mesh: return Mesh_Hexahedron(self, algo, geom) ## Deprecated, only for compatibility! + # @return an instance of Mesh_Netgen algorithm def Netgen(self, is3D, geom=0): return Mesh_Netgen(self, is3D, geom) @@ -633,6 +671,7 @@ class Mesh: # If the optional \a geom parameter is not sets, this algorithm is global. # Otherwise, this algorithm define a submesh based on \a geom subshape. # @param geom If defined, subshape to be meshed + # @return an instance of Mesh_Projection1D algorithm def Projection1D(self, geom=0): return Mesh_Projection1D(self, geom) @@ -640,6 +679,7 @@ class Mesh: # If the optional \a geom parameter is not sets, this algorithm is global. # Otherwise, this algorithm define a submesh based on \a geom subshape. # @param geom If defined, subshape to be meshed + # @return an instance of Mesh_Projection2D algorithm def Projection2D(self, geom=0): return Mesh_Projection2D(self, geom) @@ -647,6 +687,7 @@ class Mesh: # If the optional \a geom parameter is not sets, this algorithm is global. # Otherwise, this algorithm define a submesh based on \a geom subshape. # @param geom If defined, subshape to be meshed + # @return an instance of Mesh_Projection3D algorithm def Projection3D(self, geom=0): return Mesh_Projection3D(self, geom) @@ -654,6 +695,7 @@ class Mesh: # If the optional \a geom parameter is not sets, this algorithm is global. # Otherwise, this algorithm define a submesh based on \a geom subshape. # @param geom If defined, subshape to be meshed + # @return an instance of Mesh_Prism3D or Mesh_RadialPrism3D algorithm def Prism(self, geom=0): shape = geom if shape==0: @@ -665,6 +707,7 @@ class Mesh: return Mesh_RadialPrism3D(self, geom) ## Compute the mesh and return the status of the computation + # @return True or False def Compute(self, geom=0): if geom == 0 or not isinstance(geom, geompyDC.GEOM._objref_GEOM_Object): if self.geom == 0: @@ -732,6 +775,7 @@ class Mesh: ## Compute tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN # The parameter \a fineness [0,-1] defines mesh fineness + # @return True or False def AutomaticTetrahedralization(self, fineness=0): dim = self.MeshDimension() # assign hypotheses @@ -747,6 +791,7 @@ class Mesh: ## Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron # The parameter \a fineness [0,-1] defines mesh fineness + # @return True or False def AutomaticHexahedralization(self, fineness=0): dim = self.MeshDimension() # assign hypotheses @@ -763,6 +808,7 @@ class Mesh: ## Assign hypothesis # @param hyp is a hypothesis to assign # @param geom is subhape of mesh geometry + # @return SMESH.Hypothesis_Status def AddHypothesis(self, hyp, geom=0): if isinstance( hyp, Mesh_Algorithm ): hyp = hyp.GetAlgorithm() @@ -778,6 +824,7 @@ class Mesh: ## Unassign hypothesis # @param hyp is a hypothesis to unassign # @param geom is subhape of mesh geometry + # @return SMESH.Hypothesis_Status def RemoveHypothesis(self, hyp, geom=0): if isinstance( hyp, Mesh_Algorithm ): hyp = hyp.GetAlgorithm() @@ -790,6 +837,7 @@ class Mesh: ## Get the list of hypothesis added on a geom # @param geom is subhape of mesh geometry + # @return sequence of SMESH_Hypothesis def GetHypothesisList(self, geom): return self.mesh.GetHypothesisList( geom ) @@ -984,14 +1032,17 @@ class Mesh: self.mesh.RemoveGroupWithContents(group) ## Get the list of groups existing in the mesh + # @return sequence of SMESH_GroupBase def GetGroups(self): return self.mesh.GetGroups() ## Get number of groups existing in the mesh + # @return quantity of groups as an integer value def NbGroups(self): return self.mesh.NbGroups() ## Get the list of names of groups existing in the mesh + # @return list of strings def GetGroupNames(self): groups = self.GetGroups() names = [] @@ -1002,18 +1053,21 @@ class Mesh: ## Union of two groups # New group is created. All mesh elements that are # present in initial groups are added to the new one + # @return an instance of SMESH_Group def UnionGroups(self, group1, group2, name): return self.mesh.UnionGroups(group1, group2, name) ## Intersection of two groups # New group is created. All mesh elements that are # present in both initial groups are added to the new one. + # @return an instance of SMESH_Group def IntersectGroups(self, group1, group2, name): return self.mesh.IntersectGroups(group1, group2, name) ## Cut of two groups # New group is created. All mesh elements that are present in # main group but do not present in tool group are added to the new one + # @return an instance of SMESH_Group def CutGroups(self, mainGroup, toolGroup, name): return self.mesh.CutGroups(mainGroup, toolGroup, name) @@ -1037,30 +1091,39 @@ class Mesh: def ClearLog(self): self.mesh.ClearLog() - def SetAutoColor(self, color): - self.mesh.SetAutoColor(color) + ## Toggle auto color mode on the object. + # @param theAutoColor flag which toggles auto color mode. + def SetAutoColor(self, theAutoColor): + self.mesh.SetAutoColor(theAutoColor) + ## Get flag of object auto color mode. + # @return True or False def GetAutoColor(self): return self.mesh.GetAutoColor() ## Get the internal Id + # @return integer value, which is the internal Id of the mesh def GetId(self): return self.mesh.GetId() ## Get the study Id + # @return integer value, which is the study Id of the mesh def GetStudyId(self): return self.mesh.GetStudyId() ## Check group names for duplications. # Consider maximum group name length stored in MED file. + # @return True or False def HasDuplicatedGroupNamesMED(self): return self.mesh.HasDuplicatedGroupNamesMED() - ## Obtain instance of SMESH_MeshEditor + ## Obtain mesh editor tool + # @return an instance of SMESH_MeshEditor def GetMeshEditor(self): return self.mesh.GetMeshEditor() ## Get MED Mesh + # @return an instance of SALOME_MED::MESH def GetMEDMesh(self): return self.mesh.GetMEDMesh() @@ -1069,125 +1132,151 @@ class Mesh: # ------------------------------------ ## Returns number of nodes in mesh + # @return an integer value def NbNodes(self): return self.mesh.NbNodes() ## Returns number of elements in mesh + # @return an integer value def NbElements(self): return self.mesh.NbElements() ## Returns number of edges in mesh + # @return an integer value def NbEdges(self): return self.mesh.NbEdges() ## Returns number of edges with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbEdgesOfOrder(self, elementOrder): return self.mesh.NbEdgesOfOrder(elementOrder) ## Returns number of faces in mesh + # @return an integer value def NbFaces(self): return self.mesh.NbFaces() ## Returns number of faces with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbFacesOfOrder(self, elementOrder): return self.mesh.NbFacesOfOrder(elementOrder) ## Returns number of triangles in mesh + # @return an integer value def NbTriangles(self): return self.mesh.NbTriangles() ## Returns number of triangles with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbTrianglesOfOrder(self, elementOrder): return self.mesh.NbTrianglesOfOrder(elementOrder) ## Returns number of quadrangles in mesh + # @return an integer value def NbQuadrangles(self): return self.mesh.NbQuadrangles() ## Returns number of quadrangles with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbQuadranglesOfOrder(self, elementOrder): return self.mesh.NbQuadranglesOfOrder(elementOrder) ## Returns number of polygons in mesh + # @return an integer value def NbPolygons(self): return self.mesh.NbPolygons() ## Returns number of volumes in mesh + # @return an integer value def NbVolumes(self): return self.mesh.NbVolumes() ## Returns number of volumes with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbVolumesOfOrder(self, elementOrder): return self.mesh.NbVolumesOfOrder(elementOrder) ## Returns number of tetrahedrons in mesh + # @return an integer value def NbTetras(self): return self.mesh.NbTetras() ## Returns number of tetrahedrons with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbTetrasOfOrder(self, elementOrder): return self.mesh.NbTetrasOfOrder(elementOrder) ## Returns number of hexahedrons in mesh + # @return an integer value def NbHexas(self): return self.mesh.NbHexas() ## Returns number of hexahedrons with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbHexasOfOrder(self, elementOrder): return self.mesh.NbHexasOfOrder(elementOrder) ## Returns number of pyramids in mesh + # @return an integer value def NbPyramids(self): return self.mesh.NbPyramids() ## Returns number of pyramids with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbPyramidsOfOrder(self, elementOrder): return self.mesh.NbPyramidsOfOrder(elementOrder) ## Returns number of prisms in mesh + # @return an integer value def NbPrisms(self): return self.mesh.NbPrisms() ## Returns number of prisms with given order in mesh # @param elementOrder is order of elements: - # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC + # @return an integer value def NbPrismsOfOrder(self, elementOrder): return self.mesh.NbPrismsOfOrder(elementOrder) ## Returns number of polyhedrons in mesh + # @return an integer value def NbPolyhedrons(self): return self.mesh.NbPolyhedrons() ## Returns number of submeshes in mesh + # @return an integer value def NbSubMesh(self): return self.mesh.NbSubMesh() ## Returns list of mesh elements ids + # @return list of integer values def GetElementsId(self): return self.mesh.GetElementsId() ## Returns list of ids of mesh elements with given type # @param elementType is required type of elements + # @return list of integer values def GetElementsByType(self, elementType): return self.mesh.GetElementsByType(elementType) ## Returns list of mesh nodes ids + # @return list of integer values def GetNodesId(self): return self.mesh.GetNodesId() @@ -1195,12 +1284,14 @@ class Mesh: # ------------------------------------ ## Returns type of mesh element + # @return value from SMESH::ElementType enumeration def GetElementType(self, id, iselem): return self.mesh.GetElementType(id, iselem) ## Returns list of submesh elements ids # @param Shape is geom object(subshape) IOR - # Shape must be subshape of a ShapeToMesh() + # Shape must be subshape of a ShapeToMesh() + # @return list of integer values def GetSubMeshElementsId(self, Shape): if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] @@ -1210,7 +1301,8 @@ class Mesh: ## Returns list of submesh nodes ids # @param Shape is geom object(subshape) IOR - # Shape must be subshape of a ShapeToMesh() + # Shape must be subshape of a ShapeToMesh() + # @return list of integer values def GetSubMeshNodesId(self, Shape, all): if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] @@ -1220,7 +1312,8 @@ class Mesh: ## Returns list of ids of submesh elements with given type # @param Shape is geom object(subshape) IOR - # Shape must be subshape of a ShapeToMesh() + # Shape must be subshape of a ShapeToMesh() + # @return list of integer values def GetSubMeshElementType(self, Shape): if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] @@ -1229,6 +1322,7 @@ class Mesh: return self.mesh.GetSubMeshElementType(ShapeID) ## Get mesh description + # @return string value def Dump(self): return self.mesh.Dump() @@ -1236,13 +1330,15 @@ class Mesh: # Get information about nodes and elements of mesh by its ids: # ----------------------------------------------------------- - ## Get XYZ coordinates of node as list of double + ## Get XYZ coordinates of node # \n If there is not node for given ID - returns empty list + # @return a list of double precision values def GetNodeXYZ(self, id): return self.mesh.GetNodeXYZ(id) ## For given node returns list of IDs of inverse elements # \n If there is not node for given ID - returns empty list + # @return list of integer values def GetNodeInverseElements(self, id): return self.mesh.GetNodeInverseElements(id) @@ -1253,37 +1349,40 @@ class Mesh: ## If given element is node returns IDs of shape from position # \n If there is not node for given ID - returns -1 + # @return integer value def GetShapeID(self, id): return self.mesh.GetShapeID(id) ## For given element returns ID of result shape after # FindShape() from SMESH_MeshEditor # \n If there is not element for given ID - returns -1 + # @return integer value def GetShapeIDForElem(self,id): return self.mesh.GetShapeIDForElem(id) ## Returns number of nodes for given element # \n If there is not element for given ID - returns -1 + # @return integer value def GetElemNbNodes(self, id): return self.mesh.GetElemNbNodes(id) ## Returns ID of node by given index for given element # \n If there is not element for given ID - returns -1 # \n If there is not node for given index - returns -2 + # @return integer value def GetElemNode(self, id, index): return self.mesh.GetElemNode(id, index) ## Returns IDs of nodes of given element + # @return list of integer values def GetElemNodes(self, id): return self.mesh.GetElemNodes(id) - ## Returns true if given node is medium node - # in given quadratic element + ## Returns true if given node is medium node in given quadratic element def IsMediumNode(self, elementID, nodeID): return self.mesh.IsMediumNode(elementID, nodeID) - ## Returns true if given node is medium node - # in one of quadratic elements + ## Returns true if given node is medium node in one of quadratic elements def IsMediumNodeOfAnyElem(self, nodeID, elementType): return self.mesh.IsMediumNodeOfAnyElem(nodeID, elementType) @@ -1304,8 +1403,8 @@ class Mesh: return self.mesh.IsQuadratic(id) ## Returns XYZ coordinates of bary center for given element - # as list of double # \n If there is not element for given ID - returns empty list + # @return a list of three double values def BaryCenter(self, id): return self.mesh.BaryCenter(id) @@ -1315,38 +1414,44 @@ class Mesh: ## Removes elements from mesh by ids # @param IDsOfElements is list of ids of elements to remove + # @return True or False def RemoveElements(self, IDsOfElements): return self.editor.RemoveElements(IDsOfElements) ## Removes nodes from mesh by ids # @param IDsOfNodes is list of ids of nodes to remove + # @return True or False def RemoveNodes(self, IDsOfNodes): return self.editor.RemoveNodes(IDsOfNodes) ## Add node to mesh by coordinates + # @return Id of the new node def AddNode(self, x, y, z): return self.editor.AddNode( x, y, z) - ## Create edge both similar and quadratic (this is determed + ## Create edge either linear or quadratic (this is determined # by number of given nodes). # @param IdsOfNodes List of node IDs for creation of element. # Needed order of nodes in this list corresponds to description # of MED. \n This description is located by the following link: # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3. + # @return Id of the new edge def AddEdge(self, IDsOfNodes): return self.editor.AddEdge(IDsOfNodes) - ## Create face both similar and quadratic (this is determed + ## Create face either linear or quadratic (this is determined # by number of given nodes). # @param IdsOfNodes List of node IDs for creation of element. # Needed order of nodes in this list corresponds to description # of MED. \n This description is located by the following link: # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3. + # @return Id of the new face def AddFace(self, IDsOfNodes): return self.editor.AddFace(IDsOfNodes) ## Add polygonal face to mesh by list of nodes ids + # @return Id of the new face def AddPolygonalFace(self, IdsOfNodes): return self.editor.AddPolygonalFace(IdsOfNodes) @@ -1356,6 +1461,7 @@ class Mesh: # Needed order of nodes in this list corresponds to description # of MED. \n This description is located by the following link: # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3. + # @return Id of the new volumic element def AddVolume(self, IDsOfNodes): return self.editor.AddVolume(IDsOfNodes) @@ -1363,6 +1469,7 @@ class Mesh: # @param IdsOfNodes List of node IDs for volume creation face by face. # @param Quantities List of integer values, Quantities[i] # gives quantity of nodes in face number i. + # @return Id of the new volumic element def AddPolyhedralVolume (self, IdsOfNodes, Quantities): return self.editor.AddPolyhedralVolume(IdsOfNodes, Quantities) @@ -1371,6 +1478,7 @@ class Mesh: # # Note: The created volume will refer only to nodes # of the given faces, not to the faces itself. + # @return Id of the new volumic element def AddPolyhedralVolumeByFaces (self, IdsOfFaces): return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces) @@ -1460,6 +1568,7 @@ class Mesh: # @param x new X coordinate # @param y new Y coordinate # @param z new Z coordinate + # @return True if succeed else False def MoveNode(self, NodeID, x, y, z): return self.editor.MoveNode(NodeID, x, y, z) @@ -1498,6 +1607,7 @@ class Mesh: ## Reorient elements by ids # @param IDsOfElements if undefined reorient all mesh elements + # @return True if succeed else False def Reorient(self, IDsOfElements=None): if IDsOfElements == None: IDsOfElements = self.GetElementsId() @@ -1505,6 +1615,7 @@ class Mesh: ## Reorient all elements of the object # @param theObject is mesh, submesh or group + # @return True if succeed else False def ReorientObject(self, theObject): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -1544,6 +1655,7 @@ class Mesh: ## Split quadrangles into triangles. # @param theObject object to taking list of elements from, is mesh, submesh or group # @param theCriterion is FT_...; used to choose a diagonal for splitting. + # @return TRUE in case of success, FALSE otherwise. def QuadToTriObject (self, theObject, theCriterion): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -1560,6 +1672,7 @@ class Mesh: ## Split quadrangles into triangles. # @param theObject is object to taking list of elements from, is mesh, submesh or group + # @return TRUE in case of success, FALSE otherwise. def SplitQuadObject (self, theObject, Diag13): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -1573,7 +1686,7 @@ class Mesh: def BestSplit (self, IDOfQuad, theCriterion): return self.editor.BestSplit(IDOfQuad, self.smeshpyD.GetFunctor(theCriterion)) - ## Split quafrangle faces near triangular facets of volumes + ## Split quadrangle faces near triangular facets of volumes # def SplitQuadsNearTriangularFacets(self): faces_array = self.GetElementsByType(SMESH.FACE) @@ -1719,6 +1832,7 @@ class Mesh: # @param MaxNbOfIterations maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @return TRUE in case of success, FALSE otherwise. def Smooth(self, IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method): if IDsOfElements == []: @@ -1733,6 +1847,7 @@ class Mesh: # @param MaxNbOfIterations maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @return TRUE in case of success, FALSE otherwise. def SmoothObject(self, theObject, IDsOfFixedNodes, MaxNbOfIterations, MaxxAspectRatio, Method): if ( isinstance( theObject, Mesh )): @@ -1747,6 +1862,7 @@ class Mesh: # @param MaxNbOfIterations maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @return TRUE in case of success, FALSE otherwise. def SmoothParametric(self, IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method): if IDsOfElements == []: @@ -1761,6 +1877,7 @@ class Mesh: # @param MaxNbOfIterations maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @return TRUE in case of success, FALSE otherwise. def SmoothParametricObject(self, theObject, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method): if ( isinstance( theObject, Mesh )): @@ -1776,6 +1893,7 @@ class Mesh: ## Converts all mesh from quadratic to ordinary ones, # deletes old quadratic elements, \n replacing # them with ordinary mesh elements with the same id. + # @return TRUE in case of success, FALSE otherwise. def ConvertFromQuadratic(self): return self.editor.ConvertFromQuadratic() @@ -1794,11 +1912,17 @@ class Mesh: # @param NbOfSteps number of steps # @param Tolerance tolerance # @param MakeGroups to generate new groups from existing ones - def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False): + # @param TotalAngle gives meaning of AngleInRadians: if True then it is an anglular size + # of all steps, else - size of each step + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance, + MakeGroups=False, TotalAngle=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)): Axix = self.smeshpyD.GetAxisStruct(Axix) + if TotalAngle and NbOfSteps: + AngleInRadians /= NbOfSteps if MakeGroups: return self.editor.RotationSweepMakeGroups(IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance) @@ -1812,11 +1936,17 @@ class Mesh: # @param NbOfSteps number of steps # @param Tolerance tolerance # @param MakeGroups to generate new groups from existing ones - def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False): + # @param TotalAngle gives meaning of AngleInRadians: if True then it is an anglular size + # of all steps, else - size of each step + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance, + MakeGroups=False, TotalAngle=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)): Axix = self.smeshpyD.GetAxisStruct(Axix) + if TotalAngle and NbOfSteps: + AngleInRadians /= NbOfSteps if MakeGroups: return self.editor.RotationSweepObjectMakeGroups(theObject, Axix, AngleInRadians, NbOfSteps, Tolerance) @@ -1828,6 +1958,7 @@ class Mesh: # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps # @param MakeGroups to generate new groups from existing ones + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -1846,6 +1977,7 @@ class Mesh: # @param SewTolerance uses for comparing locations of nodes if flag # EXTRUSION_FLAG_SEW is set # @param MakeGroups to generate new groups from existing ones + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance, MakeGroups=False): if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)): StepVector = self.smeshpyD.GetDirStruct(StepVector) @@ -1861,6 +1993,7 @@ class Mesh: # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps # @param MakeGroups to generate new groups from existing ones + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -1876,6 +2009,7 @@ class Mesh: # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps # @param MakeGroups to generate new groups from existing ones + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -1891,6 +2025,7 @@ class Mesh: # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps # @param MakeGroups to generate new groups from existing ones + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -1914,6 +2049,8 @@ class Mesh: # User can specify any point as the Base Point and the shape will be rotated with respect to this point. # @param MakeGroups to generate new groups from existing ones # @param LinearVariation makes compute rotation angles as linear variation of given Angles along path steps + # @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True, + # only SMESH::Extrusion_Error otherwise def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint, MakeGroups=False, LinearVariation=False): @@ -1922,11 +2059,16 @@ class Mesh: if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)): RefPoint = self.smeshpyD.GetPointStruct(RefPoint) pass + if ( isinstance( PathMesh, Mesh )): + PathMesh = PathMesh.GetMesh() + if HasAngles and Angles and LinearVariation: + Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles ) + pass if MakeGroups: - return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh.GetMesh(), + return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint) - return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh.GetMesh(), PathShape, + return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint) ## Generate new elements by extrusion of the elements belong to object @@ -1942,6 +2084,8 @@ class Mesh: # User can specify any point as the Base Point and the shape will be rotated with respect to this point. # @param MakeGroups to generate new groups from existing ones # @param LinearVariation makes compute rotation angles as linear variation of given Angles along path steps + # @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True, + # only SMESH::Extrusion_Error otherwise def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint, MakeGroups=False, LinearVariation=False): @@ -1949,11 +2093,16 @@ class Mesh: theObject = theObject.GetMesh() if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)): RefPoint = self.smeshpyD.GetPointStruct(RefPoint) + if ( isinstance( PathMesh, Mesh )): + PathMesh = PathMesh.GetMesh() + if HasAngles and Angles and LinearVariation: + Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles ) + pass if MakeGroups: - return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh.GetMesh(), + return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint) - return self.editor.ExtrusionAlongPathObject(theObject, PathMesh.GetMesh(), PathShape, + return self.editor.ExtrusionAlongPathObject(theObject, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint) @@ -1964,6 +2113,7 @@ class Mesh: # If the Mirror is geom object this parameter is unnecessary # @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0) # @param MakeGroups to generate new groups from existing ones (if Copy) + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -1981,6 +2131,7 @@ class Mesh: # If the Mirror is geom object this parameter is unnecessary # @param MakeGroups to generate new groups from existing ones # @param NewMeshName is a name of new mesh to create + # @return instance of Mesh class def MirrorMakeMesh(self, IDsOfElements, Mirror, theMirrorType, MakeGroups=0, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -1997,6 +2148,7 @@ class Mesh: # If the Mirror is geom object this parameter is unnecessary # @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0) # @param MakeGroups to generate new groups from existing ones (if Copy) + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2014,6 +2166,7 @@ class Mesh: # If the Mirror is geom object this parameter is unnecessary # @param MakeGroups to generate new groups from existing ones # @param NewMeshName is a name of new mesh to create + # @return instance of Mesh class def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2028,6 +2181,7 @@ class Mesh: # @param Vector direction of translation(DirStruct or vector) # @param Copy allows to copy the translated elements # @param MakeGroups to generate new groups from existing ones (if Copy) + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def Translate(self, IDsOfElements, Vector, Copy, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2043,6 +2197,7 @@ class Mesh: # @param Vector direction of translation(DirStruct or vector) # @param MakeGroups to generate new groups from existing ones # @param NewMeshName is a name of new mesh to create + # @return instance of Mesh class def TranslateMakeMesh(self, IDsOfElements, Vector, MakeGroups=False, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2056,6 +2211,7 @@ class Mesh: # @param Vector direction of translation(DirStruct or geom vector) # @param Copy allows to copy the translated elements # @param MakeGroups to generate new groups from existing ones (if Copy) + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def TranslateObject(self, theObject, Vector, Copy, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2071,6 +2227,7 @@ class Mesh: # @param Vector direction of translation(DirStruct or geom vector) # @param MakeGroups to generate new groups from existing ones # @param NewMeshName is a name of new mesh to create + # @return instance of Mesh class def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""): if (isinstance(theObject, Mesh)): theObject = theObject.GetMesh() @@ -2085,6 +2242,7 @@ class Mesh: # @param AngleInRadians angle of rotation(in radians) # @param Copy allows to copy the rotated elements # @param MakeGroups to generate new groups from existing ones (if Copy) + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2101,6 +2259,7 @@ class Mesh: # @param AngleInRadians angle of rotation(in radians) # @param MakeGroups to generate new groups from existing ones # @param NewMeshName is a name of new mesh to create + # @return instance of Mesh class def RotateMakeMesh (self, IDsOfElements, Axis, AngleInRadians, MakeGroups=0, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2116,6 +2275,7 @@ class Mesh: # @param AngleInRadians angle of rotation(in radians) # @param Copy allows to copy the rotated elements # @param MakeGroups to generate new groups from existing ones (if Copy) + # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False): if (isinstance(theObject, Mesh)): theObject = theObject.GetMesh() @@ -2132,6 +2292,7 @@ class Mesh: # @param AngleInRadians angle of rotation(in radians) # @param MakeGroups to generate new groups from existing ones # @param NewMeshName is a name of new mesh to create + # @return instance of Mesh class def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""): if (isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2143,19 +2304,19 @@ class Mesh: ## Find group of nodes close to each other within Tolerance. # @param Tolerance tolerance value - # @param list of group of nodes + # @return list of group of nodes def FindCoincidentNodes (self, Tolerance): return self.editor.FindCoincidentNodes(Tolerance) ## Find group of nodes close to each other within Tolerance. # @param Tolerance tolerance value # @param SubMeshOrGroup SubMesh or Group - # @param list of group of nodes + # @return list of group of nodes def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance): return self.editor.FindCoincidentNodesOnPart(SubMeshOrGroup, Tolerance) ## Merge nodes - # @param list of group of nodes + # @param GroupsOfNodes list of group of nodes def MergeNodes (self, GroupsOfNodes): self.editor.MergeNodes(GroupsOfNodes) @@ -2175,6 +2336,7 @@ class Mesh: self.editor.MergeEqualElements() ## Sew free borders + # @return SMESH::Sew_Error def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2, LastNodeID2, CreatePolygons, CreatePolyedrs): @@ -2183,12 +2345,14 @@ class Mesh: CreatePolygons, CreatePolyedrs) ## Sew conform free borders + # @return SMESH::Sew_Error def SewConformFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2): return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2) ## Sew border to side + # @return SMESH::Sew_Error def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs): return self.editor.SewBorderToSide(FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, @@ -2200,6 +2364,7 @@ class Mesh: # equal and they should have similar node connectivity. # The nodes to merge should belong to sides borders and # the first node should be linked to the second. + # @return SMESH::Sew_Error def SewSideElements (self, IDsOfSide1Elements, IDsOfSide2Elements, NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge): @@ -2217,12 +2382,14 @@ class Mesh: ## If during last operation of MeshEditor some nodes were # created this method returns list of its IDs, \n # if new nodes not created - returns empty list + # @return list of integer values (can be empty) def GetLastCreatedNodes(self): return self.editor.GetLastCreatedNodes() ## If during last operation of MeshEditor some elements were # created this method returns list of its IDs, \n # if new elements not creared - returns empty list + # @return list of integer values (can be empty) def GetLastCreatedElems(self): return self.editor.GetLastCreatedElems() @@ -2243,6 +2410,7 @@ class Mesh_Algorithm: ## Find hypothesis in study by its type name and parameters. # Find only those hypothesis, which was created in smeshpyD engine. + # @return SMESH.SMESH_Hypothesis def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD): study = smeshpyD.GetCurrentStudy() #to do: find component by smeshpyD object, not by its data type @@ -2284,6 +2452,7 @@ class Mesh_Algorithm: ## Find algorithm in study by its type name. # Find only those algorithm, which was created in smeshpyD engine. + # @return SMESH.SMESH_Algo def FindAlgorithm (self, algoname, smeshpyD): study = smeshpyD.GetCurrentStudy() #to do: find component by smeshpyD object, not by its data type @@ -2438,6 +2607,7 @@ class Mesh_Segment(Mesh_Algorithm): # p=0.5 means rounding of (edge_length / l) to the nearest integer, # p=1 means rounding of (edge_length / l) to the lower integer. # Default value is 1e-07. + # @return an instance of StdMeshers_LocalLength hypothesis def LocalLength(self, l, UseExisting=0, p=1e-07): hyp = self.Hypothesis("LocalLength", [l,p], UseExisting=UseExisting, CompareMethod=self.CompareLocalLength) @@ -2445,6 +2615,7 @@ class Mesh_Segment(Mesh_Algorithm): hyp.SetPrecision(p) return hyp + ## Private method ## Check if the given "LocalLength" hypothesis has the same parameters as given arguments def CompareLocalLength(self, hyp, args): if IsEqual(hyp.GetLength(), args[0]): @@ -2456,6 +2627,7 @@ class Mesh_Segment(Mesh_Algorithm): # @param s for the scale factor (optional) # @param UseExisting if ==true - search existing hypothesis created with # same parameters, else (default) - create new + # @return an instance of StdMeshers_NumberOfSegments hypothesis def NumberOfSegments(self, n, s=[], UseExisting=0): if s == []: hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting, @@ -2468,6 +2640,7 @@ class Mesh_Segment(Mesh_Algorithm): hyp.SetNumberOfSegments(n) return hyp + ## Private method ## Check if the given "NumberOfSegments" hypothesis has the same parameters as given arguments def CompareNumberOfSegments(self, hyp, args): if hyp.GetNumberOfSegments() == args[0]: @@ -2484,6 +2657,7 @@ class Mesh_Segment(Mesh_Algorithm): # @param end for the length of the last segment # @param UseExisting if ==true - search existing hypothesis created with # same parameters, else (default) - create new + # @return an instance of StdMeshers_Arithmetic1D hypothesis def Arithmetic1D(self, start, end, UseExisting=0): hyp = self.Hypothesis("Arithmetic1D", [start, end], UseExisting=UseExisting, CompareMethod=self.CompareArithmetic1D) @@ -2491,6 +2665,7 @@ class Mesh_Segment(Mesh_Algorithm): hyp.SetLength(end , 0) return hyp + ## Private method ## Check if the given "Arithmetic1D" hypothesis has the same parameters as given arguments def CompareArithmetic1D(self, hyp, args): if IsEqual(hyp.GetLength(1), args[0]): @@ -2503,6 +2678,7 @@ class Mesh_Segment(Mesh_Algorithm): # @param end for the length of the last segment # @param UseExisting if ==true - search existing hypothesis created with # same parameters, else (default) - create new + # @return an instance of StdMeshers_StartEndLength hypothesis def StartEndLength(self, start, end, UseExisting=0): hyp = self.Hypothesis("StartEndLength", [start, end], UseExisting=UseExisting, CompareMethod=self.CompareStartEndLength) @@ -3077,7 +3253,6 @@ class Mesh_Netgen(Mesh_Algorithm): # # More details. class Mesh_Projection1D(Mesh_Algorithm): - ## Private constructor. def __init__(self, mesh, geom=0): Mesh_Algorithm.__init__(self) @@ -3122,7 +3297,6 @@ class Mesh_Projection2D(Mesh_Algorithm): def __init__(self, mesh, geom=0): Mesh_Algorithm.__init__(self) self.Create(mesh, geom, "Projection_2D") - ## Define "Source Face" hypothesis, specifying a meshed face to # take a mesh pattern from, and optionally association of vertices # between the source face and a target one (where a hipothesis is assigned to) diff --git a/src/StdMeshers/StdMeshers_Distribution.hxx b/src/StdMeshers/StdMeshers_Distribution.hxx index 124e4e8bc..830fa0b1e 100644 --- a/src/StdMeshers/StdMeshers_Distribution.hxx +++ b/src/StdMeshers/StdMeshers_Distribution.hxx @@ -29,6 +29,8 @@ #ifndef _STD_MESHERS_DISTRIBUTION_HXX_ #define _STD_MESHERS_DISTRIBUTION_HXX_ +using namespace std; + #include "SMESH_StdMeshers.hxx" #include diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 5850cb74e..eccc3f5af 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -505,12 +506,20 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace, return TSideVector(0); } } + // find out side orientation, which is important if there are several wires (PAL19080) + bool isForward = true; + if ( nbWires > 1 ) { + TopExp_Explorer e( theFace, TopAbs_EDGE ); + while ( ! e.Current().IsSame( wireEdges.back() )) + e.Next(); + isForward = ( e.Current().Orientation() == wireEdges.back().Orientation() ); + } + StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh, - true, theIgnoreMediumNodes); + isForward, theIgnoreMediumNodes); wires[ iW ] = StdMeshers_FaceSidePtr( wire ); from = to; } return wires; } - diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index 7b76b3545..6307f167e 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -113,6 +113,8 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis { _hypMaxElementArea = NULL; _hypLengthFromEdges = NULL; + _edgeLength = 0; + _maxElementArea = 0; list ::const_iterator itl; const SMESHDS_Hypothesis *theHyp; @@ -121,8 +123,8 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis int nbHyp = hyps.size(); if (!nbHyp) { - aStatus = SMESH_Hypothesis::HYP_MISSING; - return false; // can't work with no hypothesis + aStatus = SMESH_Hypothesis::HYP_OK; //SMESH_Hypothesis::HYP_MISSING; + return true; // (PAL13464) can work with no hypothesis, LengthFromEdges is default one } itl = hyps.begin(); @@ -137,7 +139,6 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis _hypMaxElementArea = static_cast(theHyp); ASSERT(_hypMaxElementArea); _maxElementArea = _hypMaxElementArea->GetMaxArea(); - _edgeLength = 0; isOk = true; aStatus = SMESH_Hypothesis::HYP_OK; } @@ -146,8 +147,6 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis { _hypLengthFromEdges = static_cast(theHyp); ASSERT(_hypLengthFromEdges); - _edgeLength = 0; - _maxElementArea = 0; isOk = true; aStatus = SMESH_Hypothesis::HYP_OK; } @@ -201,7 +200,7 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh SMESH_Comment("Too few segments: ")<NbSegments()); // compute average edge length - if (_hypLengthFromEdges) + if (!_hypMaxElementArea) { _edgeLength = 0; int nbSegments = 0; @@ -215,7 +214,7 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh _edgeLength /= nbSegments; } - if (_hypLengthFromEdges && _edgeLength < DBL_MIN ) + if (/*_hypLengthFromEdges &&*/ _edgeLength < DBL_MIN ) _edgeLength = 100; Z nblf; //nombre de lignes fermees (enveloppe en tete) diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx index bc229bd2c..8ca0b72b8 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx @@ -83,7 +83,7 @@ protected: std::list myNodesOnCommonV; - SMESH_MesherHelper* myTool; // toll for working with quadratic elements + SMESH_MesherHelper* myTool; // tool for working with quadratic elements }; #endif diff --git a/src/StdMeshers/StdMeshers_Penta_3D.cxx b/src/StdMeshers/StdMeshers_Penta_3D.cxx index 4030cdfce..8f3d233a2 100644 --- a/src/StdMeshers/StdMeshers_Penta_3D.cxx +++ b/src/StdMeshers/StdMeshers_Penta_3D.cxx @@ -24,6 +24,8 @@ // File : StdMeshers_Penta_3D.cxx // Module : SMESH +using namespace std; + #include "StdMeshers_Penta_3D.hxx" #include "utilities.h" diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx index 3e143481a..3b69a201f 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx @@ -25,6 +25,7 @@ // Created : Fri Oct 27 10:24:28 2006 // Author : Edward AGAPOV (eap) +using namespace std; #include "StdMeshers_ProjectionUtils.hxx"