? SMESH_SRC_3.2.2/aclocal.m4 ? SMESH_SRC_3.2.2/autom4te.cache ? SMESH_SRC_3.2.2/configure ? SMESH_SRC_3.2.2/configure.in ? SMESH_SRC_3.2.2/configure.in_new ? SMESH_SRC_3.2.2/configure.in_old Index: SMESH_SRC_3.2.2/doc/salome/gui/SMESH/files/importing_and_exporting_meshes.htm =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/doc/salome/gui/SMESH/files/importing_and_exporting_meshes.htm,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/doc/salome/gui/SMESH/files/importing_and_exporting_meshes.htm 1 Jun 2006 11:39:15 -0000 1.6 +++ SMESH_SRC_3.2.2/doc/salome/gui/SMESH/files/importing_and_exporting_meshes.htm 9 Oct 2006 11:01:04 -0000 1.6.2.1 @@ -93,8 +93,8 @@

Importing and exporting meshes

In MESH there is a functionality allowing importation/exportation - of meshes from MED, UNV - format files.

+ of meshes from MED and UNV + (I-DEAS 10) format files.

 

Index: SMESH_SRC_3.2.2/idl/SMESH_Gen.idl =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/idl/SMESH_Gen.idl,v retrieving revision 1.12 retrieving revision 1.12.2.2 diff -c -u -r1.12 -r1.12.2.2 --- SMESH_SRC_3.2.2/idl/SMESH_Gen.idl 1 Jun 2006 11:39:15 -0000 1.12 +++ SMESH_SRC_3.2.2/idl/SMESH_Gen.idl 11 Oct 2006 11:06:31 -0000 1.12.2.2 @@ -121,6 +121,7 @@ /*! * Create Mesh object importing data from given UNV file + * (UNV supported version is I-DEAS 10) */ SMESH_Mesh CreateMeshesFromUNV( in string theFileName ) raises ( SALOME::SALOME_Exception ); @@ -169,7 +170,8 @@ raises ( SALOME::SALOME_Exception ); /*! - * + * Return indeces of faces, edges and vertices of given subshapes + * within theMainObject */ long_array GetSubShapesId( in GEOM::GEOM_Object theMainObject, in object_array theListOfSubObjects ) Index: SMESH_SRC_3.2.2/idl/SMESH_Mesh.idl =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/idl/SMESH_Mesh.idl,v retrieving revision 1.18 retrieving revision 1.18.2.3 diff -c -u -r1.18 -r1.18.2.3 --- SMESH_SRC_3.2.2/idl/SMESH_Mesh.idl 1 Jun 2006 11:39:15 -0000 1.18 +++ SMESH_SRC_3.2.2/idl/SMESH_Mesh.idl 20 Oct 2006 05:11:32 -0000 1.18.2.3 @@ -374,6 +374,7 @@ /*! * Export Mesh to DAT, UNV and STL Formats + * (UNV supported version is I-DEAS 10) */ void ExportDAT( in string file ) raises (SALOME::SALOME_Exception); @@ -508,13 +509,18 @@ /*! * If given element is node returns IDs of shape from position - * else - return ID of result shape after ::FindShape() - * from SMESH_MeshEditor - * If there is not element for given ID - returns -1 + * If there is not node for given ID - returns -1 */ long GetShapeID(in long id); /*! + * For given element returns ID of result shape after + * ::FindShape() from SMESH_MeshEditor + * If there is not element for given ID - returns -1 + */ + long GetShapeIDForElem(in long id); + + /*! * Returns number of nodes for given element * If there is not element for given ID - returns -1 */ @@ -642,12 +648,36 @@ long AddNode(in double x, in double y, in double z); + /*! + * Create edge both similar and quadratic (this is determed + * 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. 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. + */ long AddEdge(in long_array IDsOfNodes); + /*! + * Create face both similar and quadratic (this is determed + * 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. 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. + */ long AddFace(in long_array IDsOfNodes); long AddPolygonalFace(in long_array IdsOfNodes); + /*! + * Create volume both similar and quadratic (this is determed + * 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. 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. + */ long AddVolume(in long_array IDsOfNodes); /*! Index: SMESH_SRC_3.2.2/resources/SalomeApp.xml =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/resources/SalomeApp.xml,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -c -u -r1.2.4.1 -r1.2.4.2 --- SMESH_SRC_3.2.2/resources/SalomeApp.xml 27 Jun 2006 07:48:37 -0000 1.2.4.1 +++ SMESH_SRC_3.2.2/resources/SalomeApp.xml 5 Oct 2006 07:31:50 -0000 1.2.4.2 @@ -41,7 +41,13 @@
- - + + + + + + + +
Index: SMESH_SRC_3.2.2/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx,v retrieving revision 1.21.2.1 retrieving revision 1.21.2.2 diff -c -u -r1.21.2.1 -r1.21.2.2 --- SMESH_SRC_3.2.2/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx 2 Aug 2006 13:08:43 -0000 1.21.2.1 +++ SMESH_SRC_3.2.2/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx 19 Oct 2006 08:25:56 -0000 1.21.2.2 @@ -987,9 +987,11 @@ } catch(const std::exception& exc) { INFOS("Follow exception was cought:\n\t"<GetDim(); + + case TopAbs_SHELL: + // Special case for algorithms, building 2D mesh on a whole shell. + // Before this fix there was a problem after restoring from study, + // because in that case algorithm is assigned before hypothesis + // (on shell in problem case) and hypothesis is checked on faces + // (because it is 2D), where we have NO_ALGO state. + // Now 2D hypothesis is also applicable to shells. + return (theHypothesis->GetDim() == 2 || theHypothesis->GetDim() == 3); + // case TopAbs_WIRE: // case TopAbs_COMPSOLID: // case TopAbs_COMPOUND: @@ -842,7 +851,7 @@ f.And( SMESH_HypoFilter::IsApplicableTo( _subShape )); f.AndNot( SMESH_HypoFilter::Is( algo )); const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( _subShape, f, true ); - if (prevAlgo && + if (prevAlgo && string(algo->GetName()) != string(prevAlgo->GetName()) ) modifiedHyp = true; } @@ -900,7 +909,7 @@ f.And( SMESH_HypoFilter::IsApplicableTo( _subShape )); f.AndNot( SMESH_HypoFilter::Is( algo )); const SMESH_Hypothesis* prevAlgo = _father->GetHypothesis( _subShape, f, true ); - if (prevAlgo && + if (prevAlgo && string(algo->GetName()) != string(prevAlgo->GetName()) ) modifiedHyp = true; } Index: SMESH_SRC_3.2.2/src/SMESHDS/SMESHDS_Group.hxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESHDS/SMESHDS_Group.hxx,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESHDS/SMESHDS_Group.hxx 1 Jun 2006 11:39:16 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESHDS/SMESHDS_Group.hxx 26 Sep 2006 08:24:09 -0000 1.6.2.1 @@ -51,9 +51,9 @@ virtual SMDS_ElemIteratorPtr GetElements(); - bool SMESHDS_Group::Add (const int theID); + bool Add (const int theID); - bool SMESHDS_Group::Remove (const int theID); + bool Remove (const int theID); void Clear(); Index: SMESH_SRC_3.2.2/src/SMESHGUI/SMESHGUI.cxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESHGUI/SMESHGUI.cxx,v retrieving revision 1.95.2.3 retrieving revision 1.95.2.8 diff -c -u -r1.95.2.3 -r1.95.2.8 --- SMESH_SRC_3.2.2/src/SMESHGUI/SMESHGUI.cxx 28 Jul 2006 09:51:49 -0000 1.95.2.3 +++ SMESH_SRC_3.2.2/src/SMESHGUI/SMESHGUI.cxx 24 Oct 2006 05:22:35 -0000 1.95.2.8 @@ -145,7 +145,7 @@ using namespace std; -namespace{ +//namespace{ // Declarations //============================================================= void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh, @@ -352,21 +352,32 @@ if ( aFile.exists() ) aFile.remove(); SUIT_OverrideCursor wc; - switch ( theCommandID ) { - case 125: - case 122: - aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat ); - break; - case 124: - case 121: - aMesh->ExportDAT( aFilename.latin1() ); - break; - case 126: - case 123: - aMesh->ExportUNV( aFilename.latin1() ); - break; - default: - break; + + try { + switch ( theCommandID ) { + case 125: + case 122: + aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat ); + break; + case 124: + case 121: + aMesh->ExportDAT( aFilename.latin1() ); + break; + case 126: + case 123: + aMesh->ExportUNV( aFilename.latin1() ); + break; + default: + break; + } + } + catch (const SALOME::SALOME_Exception& S_ex){ + wc.suspend(); + SUIT_MessageBox::warn1(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_EXPORT_FAILED"), + QObject::tr("SMESH_BUT_OK")); + wc.resume(); } } } @@ -815,7 +826,7 @@ SMESHGUI::GetSMESHGUI()->updateObjBrowser(); } -} +//} extern "C" { Standard_EXPORT CAM_Module* createModule() @@ -1217,6 +1228,11 @@ } } } + + // PAL13338 --> + if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy) && !automaticUpdate() ) + SMESH::UpdateView(); + // PAL13338 <-- if (anAction == SMESH::eErase) { SALOME_ListIO l1; @@ -1224,6 +1240,7 @@ } else aSel->setSelectedObjects( to_process ); + break; } @@ -2155,12 +2172,14 @@ LightApp_SelectionMgr* mgr = selectionMgr(); SALOME_ListIO selected; mgr->selectedObjects( selected ); - if (selected.Extent() == 1) { - Handle(SALOME_InteractiveObject) anIObject = selected.First(); - if(anIObject->hasEntry()) + SALOME_ListIteratorOfListIO it(selected); + for(; it.More(); it.Next()) { + Handle(SALOME_InteractiveObject) anIObject = it.Value(); + if(anIObject->hasEntry()) { if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){ anActor->SetPointsLabeled( !anActor->GetPointsLabeled() ); } + } } break; } Index: SMESH_SRC_3.2.2/src/SMESHGUI/SMESHGUI_MeshOp.cxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESHGUI/SMESHGUI_MeshOp.cxx,v retrieving revision 1.14.2.2 retrieving revision 1.14.2.3 diff -c -u -r1.14.2.2 -r1.14.2.3 --- SMESH_SRC_3.2.2/src/SMESHGUI/SMESHGUI_MeshOp.cxx 8 Sep 2006 11:18:59 -0000 1.14.2.2 +++ SMESH_SRC_3.2.2/src/SMESHGUI/SMESHGUI_MeshOp.cxx 5 Oct 2006 11:17:52 -0000 1.14.2.3 @@ -1,18 +1,18 @@ // Copyright (C) 2005 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 +// 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 +// +// 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 +// 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 @@ -81,7 +81,7 @@ SUBMESH_ON_SHELL_TAG =8, SUBMESH_ON_SOLID_TAG =9, SUBMESH_ON_COMPOUND_TAG=10 }; - + //================================================================================ /*! * \brief Constructor @@ -212,7 +212,7 @@ connect( myDlg, SIGNAL( hypoSet( const QString& )), SLOT( onHypoSet( const QString& ))); connect( myDlg, SIGNAL( geomSelectionByMesh( bool )), SLOT( onGeomSelectionByMesh( bool ))); - if ( myToCreate ) + if ( myToCreate ) if ( myIsMesh ) myHelpFileName = "/files/constructing_meshes.htm"; else myHelpFileName = "/files/constructing_submeshes.htm"; else myHelpFileName = "files/reassigning_hypotheses_and_algorithms.htm"; @@ -379,7 +379,7 @@ } } } - } + } } return _PTR(SObject)(); } @@ -421,7 +421,7 @@ case GEOM::SOLID: case GEOM::SHELL: shapeDim = 3; break; case GEOM::FACE: shapeDim = 2; break; - case GEOM::WIRE: + case GEOM::WIRE: case GEOM::EDGE: shapeDim = 1; break; case GEOM::VERTEX: shapeDim = 0; break; default: @@ -464,7 +464,7 @@ { // if a submesh on the selected shape already exist, pass to submesh edition mode if ( _PTR(SObject) pSubmesh = getSubmeshByGeom() ) { - SMESH::SMESH_subMesh_var sm = + SMESH::SMESH_subMesh_var sm = SMESH::SObjectToInterface( pSubmesh ); bool editSubmesh = ( !sm->_is_nil() && SUIT_MessageBox::question2( myDlg, tr( "SMESH_WARNING" ), @@ -586,7 +586,7 @@ } } } - + return true; } @@ -756,7 +756,7 @@ const int nbColonsInMeshEntry = 3; bool isSubMesh = myToCreate ? !myIsMesh : - myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ).contains(':') > nbColonsInMeshEntry; + myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ).contains(':') > nbColonsInMeshEntry; if ( isSubMesh ) { @@ -797,7 +797,7 @@ //================================================================================ /*! - * \Brief Returns tab dimention + * \Brief Returns tab dimention * \param tab - the tab in the dlg * \param dlg - my dialogue * \retval int - dimention @@ -852,6 +852,10 @@ const int theType, const QString& theTypeName) { + // During a hypothesis creation we might need to select some objects. + // Main dialog must not update it's own selected objects in this case. + dlg()->deactivateAll(); + HypothesisData* aData = SMESH::GetHypothesisData(theTypeName.latin1()); if (!aData) return; @@ -922,7 +926,7 @@ //================================================================================ /*! - * \brief access to hypothesis data + * \brief access to hypothesis data * \param theDim - hyp dimension * \param theHypType - hyp type (Algo,MainHyp or AddHyp) * \param theIndex - index in the list @@ -1105,7 +1109,7 @@ //================================================================================ /*! - * \brief Creates and selects hypothesis of hypotheses set + * \brief Creates and selects hypothesis of hypotheses set * \param theSetName - The name of hypotheses set */ //================================================================================ @@ -1201,7 +1205,7 @@ for ( int aDim = SMESH::DIM_1D; aDim <= SMESH::DIM_3D; aDim++ ) { if ( !isAccessibleDim( aDim )) continue; - + // assign hypotheses for ( int aHypType = MainHyp; aHypType <= AddHyp; aHypType++ ) { int aHypIndex = currentHyp( aDim, aHypType ); Index: SMESH_SRC_3.2.2/src/SMESHGUI/SMESH_msg_en.po =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESHGUI/SMESH_msg_en.po,v retrieving revision 1.38.2.3 retrieving revision 1.38.2.4 diff -c -u -r1.38.2.3 -r1.38.2.4 --- SMESH_SRC_3.2.2/src/SMESHGUI/SMESH_msg_en.po 28 Jul 2006 09:51:49 -0000 1.38.2.3 +++ SMESH_SRC_3.2.2/src/SMESHGUI/SMESH_msg_en.po 19 Oct 2006 08:29:58 -0000 1.38.2.4 @@ -173,6 +173,10 @@ msgid "SMESH_POLYEDRE_CREATE_ERROR" msgstr "Polyedron creation error" +#Export mesh +msgid "SMESH_EXPORT_FAILED" +msgstr "Mesh export failed.\nProbably, there is not enough space on disk." + #------------------------------------------------------------------------- # MEN #------------------------------------------------------------------------- Index: SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Gen_i.cxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Gen_i.cxx,v retrieving revision 1.32.2.1 retrieving revision 1.32.2.3 diff -c -u -r1.32.2.1 -r1.32.2.3 --- SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Gen_i.cxx 7 Aug 2006 12:12:18 -0000 1.32.2.1 +++ SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Gen_i.cxx 11 Oct 2006 11:10:03 -0000 1.32.2.3 @@ -426,18 +426,23 @@ myIsEmbeddedMode = theMode; if ( !myIsEmbeddedMode ) { - bool raiseFPE; + //PAL10867: disable signals catching with "noexcepthandler" option + char* envNoCatchSignals = getenv("NOT_INTERCEPT_SIGNALS"); + if (!envNoCatchSignals || !atoi(envNoCatchSignals)) + { + bool raiseFPE; #ifdef _DEBUG_ - raiseFPE = true; - char* envDisableFPE = getenv("DISABLE_FPE"); - if (envDisableFPE && atoi(envDisableFPE)) - raiseFPE = false; + raiseFPE = true; + char* envDisableFPE = getenv("DISABLE_FPE"); + if (envDisableFPE && atoi(envDisableFPE)) + raiseFPE = false; #else - raiseFPE = false; + raiseFPE = false; #endif - OSD::SetSignal( raiseFPE ); + OSD::SetSignal( raiseFPE ); + } + // else OSD::SetSignal() is called in GUI } - // else OSD::SetSignal() is called in GUI } //============================================================================= @@ -1095,6 +1100,10 @@ return myGen.Compute( myLocMesh, myLocShape); } } + catch ( std::bad_alloc& exc ) { + THROW_SALOME_CORBA_EXCEPTION( "Memory allocation problem", + SALOME::INTERNAL_ERROR ); + } catch ( SALOME_Exception& S_ex ) { INFOS( "Compute(): catch exception "<< S_ex.what() ); } Index: SMESH_SRC_3.2.2/src/SMESH_I/SMESH_MEDSupport_i.cxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_I/SMESH_MEDSupport_i.cxx,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -c -u -r1.8 -r1.8.2.1 --- SMESH_SRC_3.2.2/src/SMESH_I/SMESH_MEDSupport_i.cxx 1 Jun 2006 11:39:17 -0000 1.8 +++ SMESH_SRC_3.2.2/src/SMESH_I/SMESH_MEDSupport_i.cxx 18 Oct 2006 08:23:24 -0000 1.8.2.1 @@ -327,6 +327,18 @@ //============================================================================= /*! + * CORBA: get Nodes from file + */ +//============================================================================= + +SALOME_MED::long_array * SMESH_MEDSupport_i::getNumberFromFile( + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) +{ + return getNumber(geomElement); +} + +//============================================================================= +/*! * CORBA: Global Nodes Index (optionnaly designed by the user) * CORBA: ?????????????????????????????? */ Index: SMESH_SRC_3.2.2/src/SMESH_I/SMESH_MEDSupport_i.hxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_I/SMESH_MEDSupport_i.hxx,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESH_I/SMESH_MEDSupport_i.hxx 1 Jun 2006 11:39:17 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESH_I/SMESH_MEDSupport_i.hxx 18 Oct 2006 08:23:24 -0000 1.6.2.1 @@ -66,6 +66,13 @@ getNumber(SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception); + /*! + * Same function as getNumber. + */ + SALOME_MED::long_array * + getNumberFromFile(SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); + SALOME_MED::long_array * getNumberIndex() throw(SALOME::SALOME_Exception); Index: SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Mesh_i.cxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Mesh_i.cxx,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -c -u -r1.21 -r1.21.2.1 --- SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Mesh_i.cxx 1 Jun 2006 11:39:17 -0000 1.21 +++ SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Mesh_i.cxx 20 Oct 2006 05:10:49 -0000 1.21.2.1 @@ -49,6 +49,7 @@ //#include "SMDS_ElemIterator.hxx" #include "SMDS_VolumeTool.hxx" #include "SMESH_MesherHelper.hxx" +#include "SMESH_MeshEditor.hxx" // OCCT Includes #include @@ -1857,9 +1858,7 @@ //============================================================================= /*! * If given element is node returns IDs of shape from position - * else - return ID of result shape after ::FindShape() - * from SMESH_MeshEditor - * If there is not element for given ID - returns -1 + * If there is not node for given ID - returns -1 */ //============================================================================= @@ -1879,12 +1878,35 @@ return pos->GetShapeId(); } + return -1; +} + + +//============================================================================= +/*! + * For given element returns ID of result shape after + * ::FindShape() from SMESH_MeshEditor + * If there is not element for given ID - returns -1 + */ +//============================================================================= + +CORBA::Long SMESH_Mesh_i::GetShapeIDForElem(const CORBA::Long id) +{ + SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS(); + if ( aSMESHDS_Mesh == NULL ) + return -1; + // try to find element const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id); if(!elem) return -1; - // need implementation??????????????????????????????????????????????? + //SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH_Mesh_i::GetMeshEditor(); + ::SMESH_MeshEditor aMeshEditor(_impl); + int index = aMeshEditor.FindShape( elem ); + if(index>0) + return index; + return -1; } Index: SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Mesh_i.hxx =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Mesh_i.hxx,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -c -u -r1.16 -r1.16.2.1 --- SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Mesh_i.hxx 1 Jun 2006 11:39:17 -0000 1.16 +++ SMESH_SRC_3.2.2/src/SMESH_I/SMESH_Mesh_i.hxx 20 Oct 2006 05:10:49 -0000 1.16.2.1 @@ -321,13 +321,18 @@ /*! * If given element is node returns IDs of shape from position - * else - return ID of result shape after ::FindShape() - * from SMESH_MeshEditor - * If there is not element for given ID - returns -1 + * If there is not node for given ID - returns -1 */ CORBA::Long GetShapeID(const CORBA::Long id); /*! + * For given element returns ID of result shape after + * ::FindShape() from SMESH_MeshEditor + * If there is not element for given ID - returns -1 + */ + CORBA::Long GetShapeIDForElem(const CORBA::Long id); + + /*! * Returns number of nodes for given element * If there is not element for given ID - returns -1 */ Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_041_mesh.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_041_mesh.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -c -u -r1.3 -r1.3.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_041_mesh.py 1 Jun 2006 11:39:17 -0000 1.3 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_041_mesh.py 20 Oct 2006 12:02:42 -0000 1.3.2.1 @@ -17,10 +17,10 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -import geompy import salome +import geompy +import smesh -import StdMeshers #-----------------------------GEOM---------------------------------------- @@ -51,72 +51,48 @@ #-----------------------------SMESH------------------------------------------- -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - -# -- Init -- -plane_mesh = salome.IDToObject( Id_face1) -smesh.SetCurrentStudy(salome.myStudy) - -mesh = smesh.CreateMesh(plane_mesh) - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) -id_mesh = salome.ObjectToID(mesh) -smeshgui.SetName( id_mesh, "Mesh_1") +# -- Init mesh -- +plane_mesh = salome.IDToObject( Id_face1) -print"---------------------Hypothesis" +mesh = smesh.Mesh(plane_mesh, "Mesh_1") +print"---------------------Hypothesis and Algorithms" #---------------- NumberOfSegments + numberOfSegment = 9 -hypNbSeg = smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" ) -hypNbSeg.SetNumberOfSegments( numberOfSegment ) +algoWireDes = mesh.Segment() +listHyp = algoWireDes.GetCompatibleHypothesis() +print algoWireDes.GetName() +algoWireDes.SetName("Ware descritisation") +hypNbSeg = algoWireDes.NumberOfSegments(numberOfSegment) print hypNbSeg.GetName() print hypNbSeg.GetNumberOfSegments() -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "Nb. Segments") +smesh.SetName(hypNbSeg, "Nb. Segments") #--------------------------Max. Element Area maxElementArea = 200 -hypArea200 = smesh.CreateHypothesis("MaxElementArea","libStdMeshersEngine.so") -hypArea200.SetMaxElementArea( maxElementArea ) -print hypArea200.GetName() -print hypArea200.GetMaxElementArea() - -smeshgui.SetName(salome.ObjectToID(hypArea200), "Max. Element Area") - -print"---------------------Algorithms" - -#----------------------------Wire discretisation -algoWireDes = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" ) -listHyp = algoWireDes.GetCompatibleHypothesis() - -print algoWireDes.GetName() -smeshgui.SetName(salome.ObjectToID(algoWireDes), "Ware descritisation") - -#----------------------------Triangle (Mefisto) -algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" ) +algoMef = mesh.Triangle() listHyp = algoMef.GetCompatibleHypothesis() - print algoMef.GetName() +algoMef.SetName("Triangle (Mefisto)") -#----------------------------Add hipothesis to the plane -mesh.AddHypothesis( plane_mesh, hypNbSeg ) # nb segments -mesh.AddHypothesis( plane_mesh, hypArea200 ) # max area - -mesh.AddHypothesis( plane_mesh, algoWireDes ) # Regular 1D/wire discretisation -mesh.AddHypothesis( plane_mesh, algoMef ) # MEFISTO 2D +hypArea200 = algoMef.MaxElementArea(maxElementArea) +print hypArea200.GetName() +print hypArea200.GetMaxElementArea() +smesh.SetName(hypArea200, "Max. Element Area") -smeshgui.SetName(salome.ObjectToID(algoMef), "Triangle (Mefisto)") print "---------------------Compute the mesh" -smesh.Compute(mesh, plane_mesh) +ret = mesh.Compute() +print ret salome.sg.updateObjBrowser(1) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_043_2D.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_043_2D.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -c -u -r1.2 -r1.2.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_043_2D.py 1 Jun 2006 11:39:17 -0000 1.2 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_043_2D.py 20 Oct 2006 12:02:42 -0000 1.2.2.1 @@ -25,8 +25,8 @@ import salome import geompy -import SMESH -import StdMeshers +import smesh + #----------------------------------GEOM @@ -51,51 +51,25 @@ #---------------------------------SMESH -# get smesh engine -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) - -# get SMESH GUI -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) - -# create hypoteses -hypNbSeg1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg1.SetNumberOfSegments(18) -id_hypNbSeg1 = salome.ObjectToID(hypNbSeg1) -smeshgui.SetName(id_hypNbSeg1, "NumberOfSegments 1"); - -hypNbSeg2 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg2.SetNumberOfSegments(34) -id_hypNbSeg2 = salome.ObjectToID(hypNbSeg2) -smeshgui.SetName(id_hypNbSeg2, "NumberOfSegments 2"); - -# create algorithmes -algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -id_algoReg = salome.ObjectToID(algoReg) -smeshgui.SetName(id_algoReg, "Regular_1D"); # create the path mesh -mesh1 = smesh.CreateMesh(ellipse1) -id_mesh1 = salome.ObjectToID(mesh1) -smeshgui.SetName(id_mesh1, "Path Mesh"); - -# set hypotheses and algos -mesh1.AddHypothesis(ellipse1,algoReg) -mesh1.AddHypothesis(ellipse1,hypNbSeg1) +mesh1 = smesh.Mesh(ellipse1, "Path Mesh") + +algoReg1 = mesh1.Segment() +algoReg1.SetName("Regular_1D") +hypNbSeg1 = algoReg1.NumberOfSegments(18) +smesh.SetName(hypNbSeg1, "NumberOfSegments 1") # create the tool mesh -mesh2 = smesh.CreateMesh(ellipse2) -id_mesh2 = salome.ObjectToID(mesh2) -smeshgui.SetName(id_mesh2, "Tool Mesh"); - -# set hypotheses and algos -mesh2.AddHypothesis(ellipse2,algoReg) -mesh2.AddHypothesis(ellipse2,hypNbSeg2) +mesh2 = smesh.Mesh(ellipse2, "Tool Mesh") +algoReg2 = mesh2.Segment() +algoReg2.SetName("Regular_1D") +hypNbSeg2 = algoReg2.NumberOfSegments(34) +smesh.SetName(hypNbSeg2, "NumberOfSegments 2") # compute meshes -smesh.Compute(mesh1,ellipse1) -smesh.Compute(mesh2,ellipse2) +mesh1.Compute() +mesh2.Compute() # ---- udate object browser Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_043_3D.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_043_3D.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -c -u -r1.2 -r1.2.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_043_3D.py 1 Jun 2006 11:39:17 -0000 1.2 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/PAL_MESH_043_3D.py 20 Oct 2006 12:02:42 -0000 1.2.2.1 @@ -25,12 +25,8 @@ import salome import geompy -import SMESH -import StdMeshers +import smesh -# get smesh engine -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) # create points to build two circles p1 = geompy.MakeVertex(0, 100, 0) @@ -52,53 +48,39 @@ idcircle = geompy.addToStudy(circle, "Circle") idface = geompy.addToStudy(face, "Circular face") -# get SMESH GUI -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) - -# create hypoteses -hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg.SetNumberOfSegments(12) -idseg = salome.ObjectToID(hypNbSeg) -smeshgui.SetName(idseg, "NumberOfSegments_10"); - -hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea.SetMaxElementArea(30) -idarea = salome.ObjectToID(hypArea) -smeshgui.SetName(idarea, "MaxElementArea_20"); - -# create algorithmes -algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -idreg = salome.ObjectToID(algoReg) -smeshgui.SetName(idreg, "Regular_1D"); - -algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") -idmef = salome.ObjectToID(algoMef) -smeshgui.SetName(idmef, "MEFISTO_2D"); + # init a Mesh with the circular face -mesh1 = smesh.CreateMesh(face) -idmesh1 = salome.ObjectToID(mesh1) -smeshgui.SetName(idmesh1, "Mesh on circular face"); - -# set hypotheses and algos -mesh1.AddHypothesis(face,algoReg) -mesh1.AddHypothesis(face,hypNbSeg) -mesh1.AddHypothesis(face,algoMef) -mesh1.AddHypothesis(face,hypArea) +mesh1 = smesh.Mesh(face, "Mesh on circular face") + +# set hypotheses and algos to the first mesh +numberOfSegments1 = 12 +algoReg1 = mesh1.Segment() +algoReg1.SetName("Regular_1D") +hypNbSeg1 = algoReg1.NumberOfSegments(numberOfSegments1) +smesh.SetName(hypNbSeg1, "NumberOfSegments_" + str(numberOfSegments1)) + +maxElementArea = 30 + +algoMef = mesh1.Triangle() +algoMef.SetName("MEFISTO_2D") +hypArea = algoMef.MaxElementArea(maxElementArea) +smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) + # init a Mesh with the second circle -mesh2 = smesh.CreateMesh(circle) -idmesh2 = salome.ObjectToID(mesh2) -smeshgui.SetName(idmesh2, "Mesh on circular edge"); - -# set hypotheses and algos -mesh2.AddHypothesis(circle,algoReg) -mesh2.AddHypothesis(circle,hypNbSeg) +mesh2 = smesh.Mesh(circle, "Mesh on circular edge") + +numberOfSegments2 = 12 +algoReg2 = mesh2.Segment() +algoReg2.SetName("Regular_1D") +hypNbSeg2 = algoReg2.NumberOfSegments(numberOfSegments2) +smesh.SetName(hypNbSeg2, "NumberOfSegments_" + str(numberOfSegments2)) + # compute meshes -smesh.Compute(mesh1,face) -smesh.Compute(mesh2,circle) +mesh1.Compute() +mesh2.Compute() # ---- udate object browser salome.sg.updateObjBrowser(1); Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_AdvancedEditor.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_AdvancedEditor.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -c -u -r1.2 -r1.2.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_AdvancedEditor.py 1 Jun 2006 11:39:17 -0000 1.2 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_AdvancedEditor.py 20 Oct 2006 12:02:42 -0000 1.2.2.1 @@ -18,7 +18,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # import smesh -import SMESH import math def GetNewNodes(mesh,Elems,OldNodes): @@ -51,45 +50,44 @@ # create empty mesh -mesh = smesh.smesh.CreateEmptyMesh() +mesh = smesh.Mesh() -ed = mesh.GetMeshEditor() tol = 0.001 # create a cross from quadrangle faces # 1. create first edge and make extrusion along 0x -n1 = ed.AddNode(55,-5,0) -n2 = ed.AddNode(55,5,0) -e1 = ed.AddEdge([n1,n2]) -dir1 = SMESH.DirStruct(SMESH.PointStruct(-10,0,0)) -ed.ExtrusionSweep([e1],dir1,11) +n1 = mesh.AddNode(55,-5,0) +n2 = mesh.AddNode(55,5,0) +e1 = mesh.AddEdge([n1,n2]) +dir1 = smesh.DirStruct(smesh.PointStruct(-10,0,0)) +mesh.ExtrusionSweep([e1],dir1,11) # 2. create second edge and make extrusion along 0y -n3 = ed.AddNode(-5,-55,0) -n4 = ed.AddNode(5,-55,0) -e2 = ed.AddEdge([n3,n4]) -dir2 = SMESH.DirStruct(SMESH.PointStruct(0,10,0)) -ed.ExtrusionSweep([e2],dir2,11) +n3 = mesh.AddNode(-5,-55,0) +n4 = mesh.AddNode(5,-55,0) +e2 = mesh.AddEdge([n3,n4]) +dir2 = smesh.DirStruct(smesh.PointStruct(0,10,0)) +mesh.ExtrusionSweep([e2],dir2,11) # since result has coincident nodes and faces # we have to make merge -nodes = ed.FindCoincidentNodes(0.001) -ed.MergeNodes(nodes) -ed.MergeEqualElements() +nodes = mesh.FindCoincidentNodes(0.001) +mesh.MergeNodes(nodes) +mesh.MergeEqualElements() # make extrusion faces along 0z -faces = mesh.GetElementsByType(SMESH.FACE) +faces = mesh.GetElementsByType(smesh.FACE) nbf = len(faces) maxang = 2.0 zstep = 5 nbzsteps = 50 -dir3 = SMESH.DirStruct(SMESH.PointStruct(0,0,zstep)) +dir3 = smesh.DirStruct(smesh.PointStruct(0,0,zstep)) newfaces = [] # list for keeping created top faces # during extrusion for i in range(0,nbzsteps): - ed.ExtrusionSweep(faces,dir3,1) + mesh.ExtrusionSweep(faces,dir3,1) # find top faces after each extrusion and keep them - res = ed.GetLastCreatedElems() + res = mesh.GetLastCreatedElems() nbr = len(res) nfaces = [] for j in res: @@ -115,23 +113,23 @@ pass # rotate faces from newfaces -axisr1 = SMESH.AxisStruct(0,0,0,0,0,1) +axisr1 = smesh.AxisStruct(0,0,0,0,0,1) for i in range(0,nbzsteps): ang = maxang*(1-math.cos((i+1)*math.pi/nbzsteps)) - ed.Rotate(newfaces[i],axisr1,ang,0) + mesh.Rotate(newfaces[i],axisr1,ang,0) # create circles # create two edges and rotate them for creation # full circle -n5 = ed.AddNode(65,0,0) -n6 = ed.AddNode(67.5,0,0) -n7 = ed.AddNode(70,0,0) -e56 = ed.AddEdge([n5,n6]) -e67 = ed.AddEdge([n6,n7]) -axisr2 = SMESH.AxisStruct(65,0,0,0,1,0) -ed.RotationSweep([e56,e67],axisr2, math.pi/6, 12, tol) -res = ed.GetLastCreatedElems() +n5 = mesh.AddNode(65,0,0) +n6 = mesh.AddNode(67.5,0,0) +n7 = mesh.AddNode(70,0,0) +e56 = mesh.AddEdge([n5,n6]) +e67 = mesh.AddEdge([n6,n7]) +axisr2 = smesh.AxisStruct(65,0,0,0,1,0) +mesh.RotationSweep([e56,e67],axisr2, math.pi/6, 12, tol) +res = mesh.GetLastCreatedElems() faces1 = [] for i in res: nbn = mesh.GetElemNbNodes(i) @@ -141,14 +139,14 @@ # create other two edges and rotate them for creation # other full circle -n8 = ed.AddNode(-65,0,0) -n9 = ed.AddNode(-67.5,0,0) -n10 = ed.AddNode(-70,0,0) -e8 = ed.AddEdge([n8,n9]) -e9 = ed.AddEdge([n9,n10]) -axisr3 = SMESH.AxisStruct(-65,0,0,0,-1,0) -ed.RotationSweep([e8,e9],axisr3, math.pi/6, 12, tol) -res = ed.GetLastCreatedElems() +n8 = mesh.AddNode(-65,0,0) +n9 = mesh.AddNode(-67.5,0,0) +n10 = mesh.AddNode(-70,0,0) +e8 = mesh.AddEdge([n8,n9]) +e9 = mesh.AddEdge([n9,n10]) +axisr3 = smesh.AxisStruct(-65,0,0,0,-1,0) +mesh.RotationSweep([e8,e9],axisr3, math.pi/6, 12, tol) +res = mesh.GetLastCreatedElems() faces2 = [] for i in res: nbn = mesh.GetElemNbNodes(i) @@ -158,8 +156,8 @@ # there are coincident nodes after rotation # therefore we have to merge nodes -nodes = ed.FindCoincidentNodes(0.001) -ed.MergeNodes(nodes) +nodes = mesh.FindCoincidentNodes(0.001) +mesh.MergeNodes(nodes) nbcircs = 2 nbrsteps = 24 @@ -172,8 +170,8 @@ oldnodes = newnodes nodes = [] -ed.RotationSweep(faces1,axisr1, math.pi*2/nbrsteps, nbrs, tol) -res = ed.GetLastCreatedElems() +mesh.RotationSweep(faces1,axisr1, math.pi*2/nbrsteps, nbrs, tol) +res = mesh.GetLastCreatedElems() for i in range(0,nbrs): volumes = [] @@ -181,7 +179,7 @@ newnodes = GetNewNodes(mesh,volumes,oldnodes) for j in newnodes: xyz = mesh.GetNodeXYZ(j) - ed.MoveNode(j,xyz[0],xyz[1],xyz[2]+dz*(i+1)) + mesh.MoveNode(j,xyz[0],xyz[1],xyz[2]+dz*(i+1)) pass oldnodes = newnodes pass @@ -192,8 +190,8 @@ oldnodes = newnodes nodes = [] -ed.RotationSweep(faces2,axisr1, math.pi*2/nbrsteps, nbrs, tol) -res = ed.GetLastCreatedElems() +mesh.RotationSweep(faces2,axisr1, math.pi*2/nbrsteps, nbrs, tol) +res = mesh.GetLastCreatedElems() for i in range(0,nbrs): volumes = [] @@ -201,9 +199,9 @@ newnodes = GetNewNodes(mesh,volumes,oldnodes) for j in newnodes: xyz = mesh.GetNodeXYZ(j) - ed.MoveNode(j,xyz[0],xyz[1],xyz[2]+dz*(i+1)) + mesh.MoveNode(j,xyz[0],xyz[1],xyz[2]+dz*(i+1)) pass oldnodes = newnodes pass - +smesh.salome.sg.updateObjBrowser(1) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_BelongToGeom.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_BelongToGeom.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -c -u -r1.4 -r1.4.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_BelongToGeom.py 1 Jun 2006 11:39:17 -0000 1.4 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_BelongToGeom.py 20 Oct 2006 12:02:42 -0000 1.4.2.1 @@ -17,10 +17,11 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -import SMESH + from SMESH_test1 import * -def CheckBelongToGeomFilter(theMeshGen, theMesh, theShape, theSubShape, theElemType): +## Old style +def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theElemType): import geompy if theShape != theSubShape: aName = str(theSubShape) @@ -38,10 +39,26 @@ aFilter.SetPredicate(aBelongToGeom) return aFilter.GetElementsId(theMesh) -anElemType = SMESH.ALL; +## Current style +def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType): + import geompy + if theShape != theSubShape: + aName = str(theSubShape) + geompy.addToStudyInFather(theShape,theSubShape,aName) + + theMesh.Compute() + aFilter = theMesh.GetFilter(theElemType, smesh.FT_BelongToGeom, theSubShape) + return aFilter.GetElementsId(theMesh.GetMesh()) + + +anElemType = smesh.FACE; print "anElemType =", anElemType -#anIds = CheckBelongToGeomFilter(smesh,mesh,box,subShapeList[1],SMESH.FACE) -anIds = CheckBelongToGeomFilter(smesh,mesh,box,box,SMESH.FACE) +#anIds = CheckBelongToGeomFilter(mesh,box,subShapeList[1],anElemType) +anIds = CheckBelongToGeomFilter(mesh,box,box,anElemType) +print "Number of ids = ", len(anIds) print "anIds = ", anIds +## Check old version +#anIds = CheckBelongToGeomFilterOld(smesh.smesh,mesh.GetMesh(),box,box,anElemType) +#print "anIds = ", anIds salome.sg.updateObjBrowser(1); Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupFromGeom.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupFromGeom.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -c -u -r1.3 -r1.3.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupFromGeom.py 1 Jun 2006 11:39:17 -0000 1.3 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupFromGeom.py 20 Oct 2006 12:02:42 -0000 1.3.2.1 @@ -23,11 +23,10 @@ # Module : SMESH from SMESH_test1 import * -import SMESH # Compute the mesh created in SMESH_test1 -smesh.Compute(mesh, box) +mesh.Compute() # Create geometry groups on plane: aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"]) @@ -43,7 +42,7 @@ geompy.addToStudy(aGeomGroup1, "Group on Faces") geompy.addToStudy(aGeomGroup2, "Group on Edges") -aSmeshGroup1 = mesh.CreateGroupFromGEOM(SMESH.FACE, "SMESHGroup1", aGeomGroup1) -aSmeshGroup2 = mesh.CreateGroupFromGEOM(SMESH.EDGE, "SMESHGroup2", aGeomGroup2) +aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", smesh.FACE) +aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", smesh.EDGE) salome.sg.updateObjBrowser(1); Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupFromGeom2.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupFromGeom2.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -c -u -r1.4 -r1.4.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupFromGeom2.py 1 Jun 2006 11:39:17 -0000 1.4 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupFromGeom2.py 20 Oct 2006 12:02:42 -0000 1.4.2.1 @@ -25,11 +25,11 @@ # Project : PAL/SALOME #============================================================================== from SMESH_test1 import * -import SMESH + # Compute the mesh created in SMESH_test1 -smesh.Compute(mesh, box) +mesh.Compute() # Create geometry groups on plane: aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"]) @@ -45,11 +45,11 @@ geompy.addToStudy(aGeomGroup1, "Group on Faces") geompy.addToStudy(aGeomGroup2, "Group on Edges") -aSmeshGroup1 = mesh.CreateGroupFromGEOM(SMESH.FACE, "SMESHGroup1", aGeomGroup1) -aSmeshGroup2 = mesh.CreateGroupFromGEOM(SMESH.EDGE, "SMESHGroup2", aGeomGroup2) +aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", smesh.FACE) +aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", smesh.EDGE) print "Create aGroupOnShell - a group linked to a shell" -aGroupOnShell = mesh.CreateGroupFromGEOM(SMESH.EDGE, "GroupOnShell", shell) +aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", smesh.EDGE) print "aGroupOnShell type =", aGroupOnShell.GetType() print "aGroupOnShell size =", aGroupOnShell.Size() print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() @@ -65,7 +65,7 @@ print " " print "Re-compute mesh, contents of aGroupOnShell changes again:" -smesh.Compute(mesh, box) +mesh.Compute() print "aGroupOnShell size =", aGroupOnShell.Size() print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -c -u -r1.8 -r1.8.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py 1 Jun 2006 11:39:17 -0000 1.8 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py 20 Oct 2006 12:02:42 -0000 1.8.2.1 @@ -17,10 +17,10 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from smesh import * +import smesh def BuildGroupLyingOn(theMesh, theElemType, theName, theShape): - aFilterMgr = smesh.CreateFilterManager() + aFilterMgr = smesh.smesh.CreateFilterManager() aFilter = aFilterMgr.CreateFilter() aLyingOnGeom = aFilterMgr.CreateLyingOnGeom() @@ -36,7 +36,12 @@ #Example from SMESH_test1 import * -smesh.Compute(mesh, box) -BuildGroupLyingOn(mesh, SMESH.FACE, "Group of faces lying on edge", edge ) +mesh.Compute() + +# First way +BuildGroupLyingOn(mesh.GetMesh(), smesh.FACE, "Group of faces lying on edge #1", edge ) + +# Second way +mesh.MakeGroup("Group of faces lying on edge #2", smesh.FACE, smesh.FT_LyingOnGeom, edge) salome.sg.updateObjBrowser(1); Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_Nut.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_Nut.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -c -u -r1.4 -r1.4.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_Nut.py 1 Jun 2006 11:39:17 -0000 1.4 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_Nut.py 20 Oct 2006 12:02:42 -0000 1.4.2.1 @@ -24,10 +24,9 @@ import geompy import salome +import smesh import os import math -import StdMeshers -import SMESH #Sketcher_1 creation print "Sketcher creation..." @@ -94,79 +93,43 @@ Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1") #Mesh creation -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") # -- Init -- shape_mesh = salome.IDToObject( Cut_1_ID ) -smesh.SetCurrentStudy(salome.myStudy) -mesh = smesh.CreateMesh(shape_mesh) -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) -idmesh = salome.ObjectToID(mesh) -smeshgui.SetName( idmesh, "Nut" ) + +mesh = smesh.Mesh(shape_mesh, "Nut") #HYPOTHESIS CREATION print "-------------------------- Average length" theAverageLength = 5 -hAvLength = smesh.CreateHypothesis( "LocalLength", "libStdMeshersEngine.so" ) -hAvLength.SetLength( theAverageLength ) +algoReg1D = mesh.Segment() +hAvLength = algoReg1D.LocalLength(theAverageLength) print hAvLength.GetName() print hAvLength.GetId() -smeshgui.SetName(salome.ObjectToID(hAvLength), "AverageLength_5") +print hAvLength.GetLength() +smesh.SetName(hAvLength, "AverageLength_"+str(theAverageLength)) print "-------------------------- MaxElementArea" theMaxElementArea = 20 -hArea20 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) -hArea20.SetMaxElementArea( theMaxElementArea ) -print hArea20.GetName() -print hArea20.GetId() -print hArea20.GetMaxElementArea() -smeshgui.SetName(salome.ObjectToID(hArea20), "MaxElementArea_20") +algoMef = mesh.Triangle(smesh.MEFISTO) +hArea = algoMef.MaxElementArea( theMaxElementArea ) +print hArea.GetName() +print hArea.GetId() +print hArea.GetMaxElementArea() +smesh.SetName(hArea, "MaxElementArea_"+str(theMaxElementArea)) print "-------------------------- MaxElementVolume" theMaxElementVolume = 150 -hVolume150 = smesh.CreateHypothesis( "MaxElementVolume", "libStdMeshersEngine.so" ) -hVolume150.SetMaxElementVolume( theMaxElementVolume ) -print hVolume150.GetName() -print hVolume150.GetId() -print hVolume150.GetMaxElementVolume() -smeshgui.SetName(salome.ObjectToID(hVolume150), "MaxElementVolume_150") - -mesh.AddHypothesis(shape_mesh, hAvLength) -mesh.AddHypothesis(shape_mesh, hArea20) -mesh.AddHypothesis(shape_mesh, hVolume150) - -print "-------------------------- Regular_1D" - -algoReg1D = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" ) -listHyp = algoReg1D.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoReg1D.GetName() -print algoReg1D.GetId() -smeshgui.SetName(salome.ObjectToID(algoReg1D), "Wire discretisation") - -print "-------------------------- MEFISTO_2D" -algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" ) -listHyp = algoMef.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoMef.GetName() -print algoMef.GetId() -smeshgui.SetName(salome.ObjectToID(algoMef), "Triangle (Mefisto)") - -print "-------------------------- NETGEN_3D" - -algoNg = smesh.CreateHypothesis( "NETGEN_3D", "libNETGENEngine.so" ) -print algoNg.GetName() -print algoNg.GetId() -smeshgui.SetName(salome.ObjectToID(algoNg), "Tetrahedron (NETGEN)") -mesh.AddHypothesis(shape_mesh, algoReg1D) -mesh.AddHypothesis(shape_mesh, algoMef) -mesh.AddHypothesis(shape_mesh, algoNg) +algoNg = mesh.Tetrahedron(smesh.NETGEN) +hVolume = algoNg.MaxElementVolume( theMaxElementVolume ) +print hVolume.GetName() +print hVolume.GetId() +print hVolume.GetMaxElementVolume() +smesh.SetName(hVolume, "MaxElementVolume_"+str(theMaxElementVolume)) + print "-------------------------- compute the mesh of the mechanic piece" -smesh.Compute(mesh,shape_mesh) +mesh.Compute() print "Information about the Nut:" print "Number of nodes : ", mesh.NbNodes() Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_Partition1_tetra.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_Partition1_tetra.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_Partition1_tetra.py 1 Jun 2006 11:39:17 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_Partition1_tetra.py 20 Oct 2006 12:02:42 -0000 1.6.2.1 @@ -26,16 +26,9 @@ import salome import geompy +import smesh from math import sqrt -import StdMeshers -import NETGENPlugin - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) #--------------------------------------------------------------- @@ -125,82 +118,48 @@ # ---- launch SMESH +# ---- init a Mesh with the alveole +shape_mesh = salome.IDToObject( idalveole ) + +mesh = smesh.Mesh(shape_mesh, "MeshAlveole") + print "-------------------------- create Hypothesis (In this case global hypothesis are used)" print "-------------------------- NumberOfSegments" numberOfSegments = 10 -hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg.SetNumberOfSegments(numberOfSegments) +regular1D = mesh.Segment() +hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() - -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_10") +smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) print "-------------------------- MaxElementArea" maxElementArea = 0.1 -hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea.SetMaxElementArea(maxElementArea) +mefisto2D = mesh.Triangle() +hypArea = mefisto2D.MaxElementArea(maxElementArea) print hypArea.GetName() print hypArea.GetId() print hypArea.GetMaxElementArea() - -smeshgui.SetName(salome.ObjectToID(hypArea), "MaxElementArea_0.1") +smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) print "-------------------------- MaxElementVolume" maxElementVolume = 0.5 -hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so") -hypVolume.SetMaxElementVolume(maxElementVolume) +netgen3D = mesh.Tetrahedron(smesh.NETGEN) +hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() print hypVolume.GetMaxElementVolume() - -smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_0.5") - -print "-------------------------- create Algorithms" - -print "-------------------------- Regular_1D" - -regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation") - -print "-------------------------- MEFISTO_2D" - -mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D") - -print "-------------------------- NETGEN_3D" - -netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so") -smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D") - -# ---- init a Mesh with the alveole -shape_mesh = salome.IDToObject( idalveole ) - -mesh = smesh.CreateMesh(shape_mesh) -smeshgui.SetName(salome.ObjectToID(mesh), "MeshAlveole") - -# ---- add hypothesis to alveole - -print "-------------------------- add hypothesis to alveole" - -mesh.AddHypothesis(shape_mesh,regular1D) -mesh.AddHypothesis(shape_mesh,hypNbSeg) - -mesh.AddHypothesis(shape_mesh,mefisto2D) -mesh.AddHypothesis(shape_mesh,hypArea) - -mesh.AddHypothesis(shape_mesh,netgen3D) -mesh.AddHypothesis(shape_mesh,hypVolume) +smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) print "-------------------------- compute the mesh of alveole " -ret = smesh.Compute(mesh,shape_mesh) +ret = mesh.Compute() if ret != 0: log=mesh.GetLog(0) # no erase trace Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_blocks.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_blocks.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -c -u -r1.5 -r1.5.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_blocks.py 1 Jun 2006 11:39:17 -0000 1.5 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_blocks.py 20 Oct 2006 12:02:42 -0000 1.5.2.1 @@ -28,16 +28,14 @@ import salome import geompy import math +import smesh import GEOM_Spanner isBlocksTest = 0 # False isMeshTest = 1 # True -hasGUI = 1 # True -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) -GEOM_Spanner.MakeSpanner(salome, geompy, math, isBlocksTest, isMeshTest, smesh, hasGUI) +GEOM_Spanner.MakeSpanner(geompy, math, isBlocksTest, isMeshTest, smesh) salome.sg.updateObjBrowser(1); Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -c -u -r1.4 -r1.4.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box.py 1 Jun 2006 11:39:17 -0000 1.4 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box.py 20 Oct 2006 12:02:42 -0000 1.4.2.1 @@ -30,63 +30,41 @@ import salome from salome import sg import geompy +import smesh -import StdMeshers # ---- launch GEOM geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") -meshgenerator = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") ###geom.GetCurrentStudy(salome.myStudy._get_StudyId()) -meshgenerator.SetCurrentStudy(salome.myStudy) # Plate box = geompy.MakeBox(0.,0.,0.,1.,1.,1.) boxId = geompy.addToStudy(box,"box") -# ---- launch SMESH +# ---- SMESH -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) -# meshgenerator=smeshpy.smeshpy() - - -# Hypothesis - -hypL1=meshgenerator.CreateHypothesis("LocalLength","libStdMeshersEngine.so") -hypL1.SetLength(0.25) -hypL1Id = salome.ObjectToID(hypL1) -smeshgui.SetName(hypL1Id, "LocalLength") +# ---- init a Mesh -# Algorithm +box_mesh=smesh.Mesh(box, "box_mesh") -alg1D=meshgenerator.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -alg1DId = salome.ObjectToID(alg1D) -smeshgui.SetName(alg1DId, "algo1D") +# set Hypothesis and Algorithm -alg2D=meshgenerator.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so") -alg2DId = salome.ObjectToID(alg2D) -smeshgui.SetName(alg2DId, "algo2D") +alg1D = box_mesh.Segment() +alg1D.SetName("algo1D") +hypL1 = alg1D.LocalLength(0.25) +smesh.SetName(hypL1, "LocalLength") + +alg2D = box_mesh.Quadrangle() +alg2D.SetName("algo2D") -alg3D=meshgenerator.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so") -alg3DId = salome.ObjectToID(alg3D) -smeshgui.SetName(alg3DId, "algo3D") - -# ---- init a Mesh +alg3D = box_mesh.Hexahedron() +alg3D.SetName("algo3D") -box_mesh=meshgenerator.CreateMesh(box) -box_meshId = salome.ObjectToID(box_mesh) -smeshgui.SetName(box_meshId, "box_mesh") - -# ---- set Hypothesis & Algorithm - -box_mesh.AddHypothesis(box,alg1D) -box_mesh.AddHypothesis(box,alg2D) -box_mesh.AddHypothesis(box,alg3D) -box_mesh.AddHypothesis(box,hypL1) +# compute mesh -meshgenerator.Compute(box_mesh,box) +box_mesh.Compute() sg.updateObjBrowser(1) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box2_tetra.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box2_tetra.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box2_tetra.py 1 Jun 2006 11:39:17 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box2_tetra.py 20 Oct 2006 12:02:42 -0000 1.6.2.1 @@ -24,14 +24,8 @@ import salome import geompy +import smesh -import StdMeshers -import NETGENPlugin - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId); # ---- define 2 boxes box1 and box2 @@ -79,90 +73,51 @@ ### ---------------------------- SMESH -------------------------------------- -# ---- create Hypothesis +# ---- init a Mesh with the shell + +mesh = smesh.Mesh(shell, "MeshBox2") -print "-------------------------- create Hypothesis" + +# ---- set Hypothesis and Algorithm print "-------------------------- NumberOfSegments" numberOfSegments = 10 -hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg.SetNumberOfSegments(numberOfSegments) - +regular1D = mesh.Segment() +hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() - -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_10") +smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) print "-------------------------- MaxElementArea" maxElementArea = 500 -hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea.SetMaxElementArea(maxElementArea) - +mefisto2D = mesh.Triangle() +hypArea = mefisto2D.MaxElementArea(maxElementArea) print hypArea.GetName() print hypArea.GetId() print hypArea.GetMaxElementArea() - -smeshgui.SetName(salome.ObjectToID(hypArea), "MaxElementArea_500") +smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) print "-------------------------- MaxElementVolume" maxElementVolume = 500 -hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so") -hypVolume.SetMaxElementVolume(maxElementVolume) - +netgen3D = mesh.Tetrahedron(smesh.NETGEN) +hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() print hypVolume.GetMaxElementVolume() +smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) -smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_500") - -# ---- create Algorithms - -print "-------------------------- create Algorithms" - -print "-------------------------- Regular_1D" - -regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation") - -print "-------------------------- MEFISTO_2D" - -mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D") - -print "-------------------------- NETGEN_3D" - -netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so") -smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D") - -# ---- init a Mesh with the shell - -mesh = smesh.CreateMesh(shell) -smeshgui.SetName(salome.ObjectToID(mesh), "MeshBox2") - -# ---- add hypothesis to shell - -print "-------------------------- add hypothesis to shell" - -mesh.AddHypothesis(shell,regular1D) -mesh.AddHypothesis(shell,hypNbSeg) - -mesh.AddHypothesis(shell,mefisto2D) -mesh.AddHypothesis(shell,hypArea) - -mesh.AddHypothesis(shell,netgen3D) -mesh.AddHypothesis(shell,hypVolume) salome.sg.updateObjBrowser(1) print "-------------------------- compute shell" -ret = smesh.Compute(mesh,shell) +ret = mesh.Compute() print ret if ret != 0: log = mesh.GetLog(0) # no erase trace Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box3_tetra.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box3_tetra.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box3_tetra.py 1 Jun 2006 11:39:17 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box3_tetra.py 20 Oct 2006 12:02:42 -0000 1.6.2.1 @@ -25,14 +25,8 @@ import salome import geompy +import smesh -import StdMeshers -import NETGENPlugin - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId); # ---- define 3 boxes box1, box2 and box3 @@ -90,90 +84,52 @@ ### ---------------------------- SMESH -------------------------------------- -# ---- create Hypothesis -print "-------------------------- create Hypothesis" +# ---- init a Mesh with the shell + +mesh = smesh.Mesh(shell, "MeshBox3") + + +# ---- set Hypothesis and Algorithm print "-------------------------- NumberOfSegments" numberOfSegments = 10 -hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg.SetNumberOfSegments(numberOfSegments) - +regular1D = mesh.Segment() +hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() - -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_10") +smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) print "-------------------------- MaxElementArea" maxElementArea = 500 -hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea.SetMaxElementArea(maxElementArea) - +mefisto2D = mesh.Triangle() +hypArea = mefisto2D.MaxElementArea(maxElementArea) print hypArea.GetName() print hypArea.GetId() print hypArea.GetMaxElementArea() - -smeshgui.SetName(salome.ObjectToID(hypArea), "MaxElementArea_500") +smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) print "-------------------------- MaxElementVolume" maxElementVolume = 500 -hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so") -hypVolume.SetMaxElementVolume(maxElementVolume) - +netgen3D = mesh.Tetrahedron(smesh.NETGEN) +hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() print hypVolume.GetMaxElementVolume() +smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) -smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_500") - -# ---- create Algorithms - -print "-------------------------- create Algorithms" - -print "-------------------------- Regular_1D" - -regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation") - -print "-------------------------- MEFISTO_2D" - -mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D") - -print "-------------------------- NETGEN_3D" - -netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so") -smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D") - -# ---- init a Mesh with the shell - -mesh = smesh.CreateMesh(shell) -smeshgui.SetName(salome.ObjectToID(mesh), "MeshBox3") - -# ---- add hypothesis to shell - -print "-------------------------- add hypothesis to shell" - -mesh.AddHypothesis(shell,regular1D) -mesh.AddHypothesis(shell,hypNbSeg) - -mesh.AddHypothesis(shell,mefisto2D) -mesh.AddHypothesis(shell,hypArea) - -mesh.AddHypothesis(shell,netgen3D) -mesh.AddHypothesis(shell,hypVolume) salome.sg.updateObjBrowser(1) print "-------------------------- compute shell" -ret = smesh.Compute(mesh,shell) +ret = mesh.Compute() print ret if ret != 0: log = mesh.GetLog(0) # no erase trace Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box_tetra.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box_tetra.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box_tetra.py 1 Jun 2006 11:39:17 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_box_tetra.py 20 Oct 2006 12:02:42 -0000 1.6.2.1 @@ -24,14 +24,8 @@ import salome import geompy +import smesh -import StdMeshers -import NETGENPlugin - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId); # ---- define a boxe @@ -51,90 +45,48 @@ ### ---------------------------- SMESH -------------------------------------- -# ---- create Hypothesis +# ---- init a Mesh with the boxe -print "-------------------------- create Hypothesis" +mesh = smesh.Mesh(box, "MeshBox") -print "-------------------------- NumberOfSegments" +# ---- set Hypothesis and Algorithm +print "-------------------------- NumberOfSegments" numberOfSegments = 10 -hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg.SetNumberOfSegments(numberOfSegments) - +regular1D = mesh.Segment() +hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() - -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_10") +smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) print "-------------------------- MaxElementArea" maxElementArea = 500 -hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea.SetMaxElementArea(maxElementArea) - +mefisto2D = mesh.Triangle() +hypArea = mefisto2D.MaxElementArea(maxElementArea) print hypArea.GetName() print hypArea.GetId() print hypArea.GetMaxElementArea() - -smeshgui.SetName(salome.ObjectToID(hypArea), "MaxElementArea_500") +smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) print "-------------------------- MaxElementVolume" maxElementVolume = 500 -hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so") -hypVolume.SetMaxElementVolume(maxElementVolume) - +netgen3D = mesh.Tetrahedron(smesh.NETGEN) +hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() print hypVolume.GetMaxElementVolume() - -smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_500") - -# ---- create Algorithms - -print "-------------------------- create Algorithms" - -print "-------------------------- Regular_1D" - -regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation") - -print "-------------------------- MEFISTO_2D" - -mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D") - -print "-------------------------- NETGEN_3D" - -netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so") -smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D") - -# ---- init a Mesh with the boxe - -mesh = smesh.CreateMesh(box) -smeshgui.SetName(salome.ObjectToID(mesh), "MeshBox") - -# ---- add hypothesis to the boxe - -print "-------------------------- add hypothesis to the box" - -mesh.AddHypothesis(box,regular1D) -mesh.AddHypothesis(box,hypNbSeg) - -mesh.AddHypothesis(box,mefisto2D) -mesh.AddHypothesis(box,hypArea) - -mesh.AddHypothesis(box,netgen3D) -mesh.AddHypothesis(box,hypVolume) +smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) salome.sg.updateObjBrowser(1) print "-------------------------- compute the mesh of the boxe" -ret = smesh.Compute(mesh,box) +ret = mesh.Compute() print ret if ret != 0: log = mesh.GetLog(0) # no erase trace Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_controls.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_controls.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -c -u -r1.4 -r1.4.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_controls.py 1 Jun 2006 11:39:17 -0000 1.4 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_controls.py 20 Oct 2006 12:02:42 -0000 1.4.2.1 @@ -24,186 +24,107 @@ # Module : SMESH -import SMESH +import smesh import SMESH_mechanic -smesh = SMESH_mechanic.smesh +salome = smesh.salome mesh = SMESH_mechanic.mesh -salome = SMESH_mechanic.salome -aFilterMgr = smesh.CreateFilterManager() +# ---- Criterion : AREA > 100 -# Criterion : AREA > 100 - -aFunctor = aFilterMgr.CreateArea() -aPredicate = aFilterMgr.CreateMoreThan() -aPredicate.SetNumFunctor( aFunctor ) -aPredicate.SetMargin( 100 ) - -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) - -anIds = aFilter.GetElementsId( mesh ) +# create group +aGroup = mesh.MakeGroup("Area > 100", smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100) # print result +anIds = aGroup.GetIDs() print "Criterion: Area > 100 Nb = ", len( anIds ) #for i in range( len( anIds ) ): #print anIds[ i ] -# create group -aGroup = mesh.CreateGroup( SMESH.FACE, "Area > 100" ) -aGroup.Add( anIds ) - - -# Criterion : Taper > 3e-15 - -aFunctor = aFilterMgr.CreateTaper() -aPredicate = aFilterMgr.CreateMoreThan() -aPredicate.SetNumFunctor( aFunctor ) -aPredicate.SetMargin( 3e-15 ) -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) +# ---- Criterion : Taper > 3e-15 -anIds = aFilter.GetElementsId( mesh ) +# create group +aGroup = mesh.MakeGroup("Taper > 3e-15", smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, 3e-15) # print result +anIds = aGroup.GetIDs() print "Criterion: Taper > 3e-15 Nb = ", len( anIds ) #for i in range( len( anIds ) ): #print anIds[ i ] -# create group -aGroup = mesh.CreateGroup( SMESH.FACE, "Taper > 3e-15" ) -aGroup.Add( anIds ) +# ---- Criterion : ASPECT RATIO > 1.3 -# Criterion : ASPECT RATIO > 1.3 - -aFunctor = aFilterMgr.CreateAspectRatio() -aPredicate = aFilterMgr.CreateMoreThan() -aPredicate.SetNumFunctor( aFunctor ) -aPredicate.SetMargin( 1.3 ) - -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) - -anIds = aFilter.GetElementsId( mesh ) +# create group +aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 1.3) # print result +anIds = aGroup.GetIDs() print "Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds ) #for i in range( len( anIds ) ): #print anIds[ i ] -# create group -aGroup = mesh.CreateGroup( SMESH.FACE, "Aspect Ratio > 1.3" ) -aGroup.Add( anIds ) +# ---- Criterion : MINIMUM ANGLE < 30 -# Criterion : MINIMUM ANGLE < 30 - -aFunctor = aFilterMgr.CreateMinimumAngle() -aPredicate = aFilterMgr.CreateLessThan() -aPredicate.SetNumFunctor( aFunctor ) -aPredicate.SetMargin( 30 ) - -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) - -anIds = aFilter.GetElementsId( mesh ) +# create group +aGroup = mesh.MakeGroup("Minimum Angle < 30", smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, 30) # print result +anIds = aGroup.GetIDs() print "Criterion: Minimum Angle < 30 Nb = ", len( anIds ) #for i in range( len( anIds ) ): #print anIds[ i ] -# create group -aGroup = mesh.CreateGroup( SMESH.FACE, "Minimum Angle < 30" ) -aGroup.Add( anIds ) - -# Criterion : Warp > 2e-13 - -aFunctor = aFilterMgr.CreateWarping() -aPredicate = aFilterMgr.CreateMoreThan() -aPredicate.SetNumFunctor( aFunctor ) -aPredicate.SetMargin( 2e-13 ) -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) +# ---- Criterion : Warp > 2e-13 -anIds = aFilter.GetElementsId( mesh ) +# create group +aGroup = mesh.MakeGroup("Warp > 2e-13", smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, 2e-13 ) # print result +anIds = aGroup.GetIDs() print "Criterion: Warp > 2e-13 Nb = ", len( anIds ) #for i in range( len( anIds ) ): #print anIds[ i ] -# create group -aGroup = mesh.CreateGroup( SMESH.FACE, "Warp > 2e-13" ) -aGroup.Add( anIds ) -# Criterion : Skew > 18 +# ---- Criterion : Skew > 18 -aFunctor = aFilterMgr.CreateSkew() -aPredicate = aFilterMgr.CreateMoreThan() -aPredicate.SetNumFunctor( aFunctor ) -aPredicate.SetMargin( 18 ) - -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) - -anIds = aFilter.GetElementsId( mesh ) +# create group +aGroup = mesh.MakeGroup("Skew > 18", smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 18 ) # print result +anIds = aGroup.GetIDs() print "Criterion: Skew > 18 Nb = ", len( anIds ) #for i in range( len( anIds ) ): #print anIds[ i ] -# create group -aGroup = mesh.CreateGroup( SMESH.FACE, "Skew > 18" ) -aGroup.Add( anIds ) # Criterion : Length > 10 -aFunctor = aFilterMgr.CreateLength() -aPredicate = aFilterMgr.CreateMoreThan() -aPredicate.SetNumFunctor( aFunctor ) -aPredicate.SetMargin( 10 ) - -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) - -anIds = aFilter.GetElementsId( mesh ) +# create group +aGroup = mesh.MakeGroup("Length > 10", smesh.FACE, smesh.FT_Length, smesh.FT_MoreThan, 10 ) # print result +anIds = aGroup.GetIDs() print "Criterion: Length > 10 Nb = ", len( anIds ) #for i in range( len( anIds ) ): #print anIds[ i ] -# create group -aGroup = mesh.CreateGroup( SMESH.EDGE, "Length > 10" ) -aGroup.Add( anIds ) # Criterion : Borders at multi-connections = 2 -aFunctor = aFilterMgr.CreateMultiConnection() -aPredicate = aFilterMgr.CreateEqualTo() -aPredicate.SetNumFunctor( aFunctor ) -aPredicate.SetMargin( 2 ) - -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) - -anIds = aFilter.GetElementsId( mesh ) +# create group +aGroup = mesh.MakeGroup("Borders at multi-connections = 2", smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, 2) # print result +anIds = aGroup.GetIDs() print "Criterion: Borders at multi-connections = 2 Nb = ", len( anIds ) #for i in range( len( anIds ) ): #print anIds[ i ] -# create group -aGroup = mesh.CreateGroup( SMESH.EDGE, "Borders at multi-connections = 2" ) -aGroup.Add( anIds ) - salome.sg.updateObjBrowser(1) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -c -u -r1.4 -r1.4.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py 1 Jun 2006 11:39:17 -0000 1.4 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py 20 Oct 2006 12:02:42 -0000 1.4.2.1 @@ -31,18 +31,11 @@ import salome import geompy - -import StdMeshers -import NETGENPlugin - -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId); +import smesh import math + # ----------------------------------------------------------------------------- ShapeTypeShell = 3 @@ -130,86 +123,54 @@ ### ---------------------------- SMESH -------------------------------------- -# ---- create Hypothesis +# ---- init a Mesh with the volume + +mesh = smesh.Mesh(vol, "meshVolume") -print "-------------------------- create Hypothesis" +# ---- set Hypothesis and Algorithm to main shape print "-------------------------- NumberOfSegments the global one" numberOfSegments = 10 -hypNbSeg=smesh.CreateHypothesis("NumberOfSegments","libStdMeshersEngine.so") -hypNbSeg.SetNumberOfSegments(numberOfSegments) -hypNbSegID = hypNbSeg.GetId() +regular1D = mesh.Segment() +regular1D.SetName("Wire Discretisation") +hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) print hypNbSeg.GetName() -print hypNbSegID +print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() +smesh.SetName(hypNbSeg, "NumberOfSegments") -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments") - -print "-------------------------- NumberOfSegments in the Z direction" - -numberOfSegmentsZ = 40 - -hypNbSegZ=smesh.CreateHypothesis("NumberOfSegments","libStdMeshersEngine.so") -hypNbSegZ.SetNumberOfSegments(numberOfSegmentsZ) -hypNbSegZID = hypNbSegZ.GetId() -print hypNbSegZ.GetName() -print hypNbSegZID -print hypNbSegZ.GetNumberOfSegments() - -smeshgui.SetName(salome.ObjectToID(hypNbSegZ), "NumberOfSegmentsZ") - -# ---- create Algorithms - -print "-------------------------- create Algorithms" - -print "-------------------------- Regular_1D" - -regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation") print "-------------------------- Quadrangle_2D" -quad2D=smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(quad2D), "Quadrangle_2D") +quad2D=mesh.Quadrangle() +quad2D.SetName("Quadrangle_2D") print "-------------------------- Hexa_3D" -hexa3D=smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(hexa3D), "Hexa_3D") +hexa3D=mesh.Hexahedron() +hexa3D.SetName("Hexa_3D") -# ---- init a Mesh with the volume -mesh = smesh.CreateMesh(vol) -smeshgui.SetName(salome.ObjectToID(mesh), "meshVolume") - -# ---- add hypothesis to the volume - -print "-------------------------- add hypothesis to the volume" +print "-------------------------- NumberOfSegments in the Z direction" -ret=mesh.AddHypothesis(vol,regular1D) -print ret -ret=mesh.AddHypothesis(vol,hypNbSeg) -print ret -ret=mesh.AddHypothesis(vol,quad2D) -print ret -ret=mesh.AddHypothesis(vol,hexa3D) -print ret +numberOfSegmentsZ = 40 for i in range(8): print "-------------------------- add hypothesis to edge in the Z directions", (i+1) - subMeshEdgeZ = mesh.GetSubMesh(edgeZ[i],"SubMeshEdgeZ_"+str(i+1)) - - retZ = mesh.AddHypothesis(edgeZ[i],hypNbSegZ) - print " add hyp Z ", retZ + algo = mesh.Segment(edgeZ[i]) + hyp = algo.NumberOfSegments(numberOfSegmentsZ) + smesh.SetName(hyp, "NumberOfSegmentsZ") + smesh.SetName(algo.GetSubMesh(), "SubMeshEdgeZ_"+str(i+1)) + salome.sg.updateObjBrowser(1) print "-------------------------- compute the mesh of the volume" -ret=smesh.Compute(mesh,vol) +ret=mesh.Compute() print ret if ret != 0: Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_hexa.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_hexa.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_hexa.py 1 Jun 2006 11:39:17 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_hexa.py 20 Oct 2006 12:02:42 -0000 1.6.2.1 @@ -24,8 +24,7 @@ # import SMESH_fixation - -import StdMeshers +import smesh compshell = SMESH_fixation.compshell idcomp = SMESH_fixation.idcomp @@ -45,65 +44,42 @@ print " check status ", status ### ---------------------------- SMESH -------------------------------------- -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) +# ---- init a Mesh with the compshell +shape_mesh = salome.IDToObject( idcomp ) + +mesh = smesh.Mesh(shape_mesh, "MeshCompShell") + -print "-------------------------- create Hypothesis" +# ---- set Hypothesis and Algorithm print "-------------------------- NumberOfSegments" numberOfSegments = 5 -hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg.SetNumberOfSegments(numberOfSegments) - +regular1D = mesh.Segment() +regular1D.SetName("Wire Discretisation") +hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() - -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_5") - -print "-------------------------- create Algorithms" - -print "-------------------------- Regular_1D" - -regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") - -smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation") +smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) print "-------------------------- Quadrangle_2D" -quad2D = smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so") - -smeshgui.SetName(salome.ObjectToID(quad2D), "Quadrangle_2D") +quad2D = mesh.Quadrangle() +quad2D.SetName("Quadrangle_2D") print "-------------------------- Hexa_3D" -hexa3D = smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so") - -smeshgui.SetName(salome.ObjectToID(hexa3D), "Hexa_3D") - -# ---- init a Mesh with the compshell -shape_mesh = salome.IDToObject( idcomp ) - -mesh = smesh.CreateMesh(shape_mesh) -smeshgui.SetName(salome.ObjectToID(mesh), "MeshCompShell") - - -print "-------------------------- add hypothesis to compshell" - -mesh.AddHypothesis(shape_mesh,regular1D) -mesh.AddHypothesis(shape_mesh,hypNbSeg) +hexa3D = mesh.Hexahedron() +hexa3D.SetName("Hexa_3D") -mesh.AddHypothesis(shape_mesh,quad2D) -mesh.AddHypothesis(shape_mesh,hexa3D) salome.sg.updateObjBrowser(1) print "-------------------------- compute compshell" -ret = smesh.Compute(mesh, shape_mesh) +ret = mesh.Compute() print ret if ret != 0: log = mesh.GetLog(0) # no erase trace Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_netgen.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_netgen.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -c -u -r1.3 -r1.3.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_netgen.py 1 Jun 2006 11:39:17 -0000 1.3 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_netgen.py 20 Oct 2006 12:02:42 -0000 1.3.2.1 @@ -23,8 +23,6 @@ # The new Netgen algorithm is used that discretizes baoundaries itself # -import StdMeshers -import NETGENPlugin import SMESH_fixation import smesh @@ -50,12 +48,11 @@ print "-------------------------- create Mesh, algorithm, hypothesis" mesh = smesh.Mesh(compshell, "MeshcompShel"); -netgen = mesh.Netgen(1) -hyp = netgen.Parameters() -hyp.SetMaxSize( 50 ) -#hyp.SetSecondOrder( 0 ) -hyp.SetFineness( 3 ) -#hyp.SetOptimize( 1 ) +netgen = mesh.Tetrahedron(smesh.FULL_NETGEN) +netgen.SetMaxSize( 50 ) +#netgen.SetSecondOrder( 0 ) +netgen.SetFineness( smesh.Fine ) +#netgen.SetOptimize( 1 ) salome.sg.updateObjBrowser(1) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_tetra.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_tetra.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_tetra.py 1 Jun 2006 11:39:17 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_fixation_tetra.py 20 Oct 2006 12:02:42 -0000 1.6.2.1 @@ -23,9 +23,8 @@ # Hypothesis and algorithms for the mesh generation are global # -import StdMeshers -import NETGENPlugin import SMESH_fixation +import smesh compshell = SMESH_fixation.compshell idcomp = SMESH_fixation.idcomp @@ -45,94 +44,65 @@ print " check status ", status ### ---------------------------- SMESH -------------------------------------- -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) +# ---- init a Mesh with the compshell + +mesh = smesh.Mesh(compshell, "MeshcompShell") + -print "-------------------------- create Hypothesis" +# ---- set Hypothesis and Algorithm print "-------------------------- NumberOfSegments" numberOfSegments = 5 -hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg.SetNumberOfSegments(numberOfSegments) - +regular1D = mesh.Segment() +regular1D.SetName("Wire Discretisation") +hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() +smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_5") - -print "-------------------------- MaxElementArea" +## print "-------------------------- MaxElementArea" ## maxElementArea = 80 -## hypArea=smesh.CreateHypothesis("MaxElementArea") -## hypArea.SetMaxElementArea(maxElementArea) +## mefisto2D = mesh.Triangle() +## mefisto2D.SetName("MEFISTO_2D") +## hypArea = mefisto2D.MaxElementArea(maxElementArea) ## print hypArea.GetName() ## print hypArea.GetId() ## print hypArea.GetMaxElementArea() -## smeshgui.SetName(salome.ObjectToID(hypArea), "MaxElementArea_160") +## smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) + +print "-------------------------- LengthFromEdges" -hypLengthFromEdges = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so") -smeshgui.SetName(salome.ObjectToID(hypLengthFromEdges), "LengthFromEdges") +mefisto2D = mesh.Triangle() +mefisto2D.SetName("MEFISTO_2D") +hypLengthFromEdges = mefisto2D.LengthFromEdges() +print hypLengthFromEdges.GetName() +print hypLengthFromEdges.GetId() +smesh.SetName(hypLengthFromEdges, "LengthFromEdges") print "-------------------------- MaxElementVolume" maxElementVolume = 1000 -hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so") -hypVolume.SetMaxElementVolume(maxElementVolume) - +netgen3D = mesh.Tetrahedron(smesh.NETGEN) +netgen3D.SetName("NETGEN_3D") +hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() print hypVolume.GetMaxElementVolume() +smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) -smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_1000") - -print "-------------------------- create Algorithms" - -print "-------------------------- Regular_1D" - -regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") - -smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation") - -print "-------------------------- MEFISTO_2D" - -mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") - -smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D") - -print "-------------------------- NETGEN_3D" - -netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so") - -smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D") - -# ---- init a Mesh with the compshell - -mesh = smesh.CreateMesh(compshell) -smeshgui.SetName(salome.ObjectToID(mesh), "MeshcompShel") - -print "-------------------------- add hypothesis to compshell" - -mesh.AddHypothesis(compshell,regular1D) -mesh.AddHypothesis(compshell,hypNbSeg) - -mesh.AddHypothesis(compshell,mefisto2D) -mesh.AddHypothesis(compshell,hypLengthFromEdges) - -mesh.AddHypothesis(compshell,netgen3D) -mesh.AddHypothesis(compshell,hypVolume) salome.sg.updateObjBrowser(1) print "-------------------------- compute compshell" -ret = smesh.Compute(mesh,compshell) +ret = mesh.Compute(mesh) print ret if ret != 0: log = mesh.GetLog(0) # no erase trace Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_flight_skin.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_flight_skin.py,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -c -u -r1.8 -r1.8.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_flight_skin.py 1 Jun 2006 11:39:17 -0000 1.8 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_flight_skin.py 20 Oct 2006 12:02:42 -0000 1.8.2.1 @@ -26,12 +26,7 @@ import os import salome import geompy -import StdMeshers - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) +import smesh # ---------------------------- GEOM -------------------------------------- @@ -61,64 +56,39 @@ ### ---------------------------- SMESH -------------------------------------- -print "-------------------------- create Hypothesis" +# ---- init a Mesh with the shell +shape_mesh = salome.IDToObject( idShape ) + +mesh = smesh.Mesh(shape_mesh, "MeshFlight") + + +# ---- set Hypothesis and Algorithm print "-------------------------- LocalLength" lengthOfSegments = 0.3 -hypLength = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so") -hypLength.SetLength(lengthOfSegments) - +regular1D = mesh.Segment() +hypLength = regular1D.LocalLength(lengthOfSegments) print hypLength.GetName() print hypLength.GetId() print hypLength.GetLength() - -smeshgui.SetName(salome.ObjectToID(hypLength), "LocalLength_0.3") +smesh.SetName(hypLength, "LocalLength_" + str(lengthOfSegments)) print "-------------------------- LengthFromEdges" -hypLengthFromEdge = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so") - +mefisto2D = mesh.Triangle() +hypLengthFromEdge = mefisto2D.LengthFromEdges() print hypLengthFromEdge.GetName() print hypLengthFromEdge.GetId() +smesh.SetName(hypLengthFromEdge,"LengthFromEdge") -smeshgui.SetName(salome.ObjectToID(hypLengthFromEdge), "LengthFromEdge") - -print "-------------------------- create Algorithms" - -print "-------------------------- Regular_1D" - -regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") - -smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation") - -print "-------------------------- MEFISTO_2D" - -mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") - -smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D") - -# ---- init a Mesh with the shell -shape_mesh = salome.IDToObject( idShape ) - -mesh = smesh.CreateMesh(shape_mesh) -smeshgui.SetName(salome.ObjectToID(mesh), "MeshFlight") - -# ---- add hypothesis to flight - -print "-------------------------- add hypothesis to flight" - -mesh.AddHypothesis(shape_mesh,regular1D) -mesh.AddHypothesis(shape_mesh,hypLength) -mesh.AddHypothesis(shape_mesh,mefisto2D) -mesh.AddHypothesis(shape_mesh,hypLengthFromEdge) salome.sg.updateObjBrowser(1) print "-------------------------- compute the skin flight" -ret = smesh.Compute(mesh,shape_mesh) +ret = mesh.Compute() print ret if ret != 0: log = mesh.GetLog(0) # no erase trace Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_freebord.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_freebord.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -c -u -r1.5 -r1.5.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_freebord.py 1 Jun 2006 11:39:17 -0000 1.5 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_freebord.py 20 Oct 2006 12:02:42 -0000 1.5.2.1 @@ -17,69 +17,51 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -import salome -import geompy -import SMESH -import StdMeshers - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) - -# Create box without one plane - -box = geompy.MakeBox(0., 0., 0., 10., 20., 30.) -subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) - -FaceList = [] -for i in range( 5 ): - FaceList.append( subShapeList[ i ] ) - -aComp = geompy.MakeCompound( FaceList ) -aBox = geompy.Sew( aComp, 1. ) -idbox = geompy.addToStudy( aBox, "box" ) - -aBox = salome.IDToObject( idbox ) - -# Create mesh - -hyp1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hyp1.SetNumberOfSegments(5) -hyp2 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hyp2.SetMaxElementArea(20) -hyp3 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hyp3.SetMaxElementArea(50) - -algo1 = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -algo2 = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") - -mesh = smesh.CreateMesh(aBox) -mesh.AddHypothesis(aBox,hyp1) -mesh.AddHypothesis(aBox,hyp2) -mesh.AddHypothesis(aBox,algo1) -mesh.AddHypothesis(aBox,algo2) - -smesh.Compute(mesh,aBox) - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId); -smeshgui.SetName( salome.ObjectToID( mesh ), "Mesh_freebord" ); - -# Criterion : Free edges -aFilterMgr = smesh.CreateFilterManager() -aPredicate = aFilterMgr.CreateFreeBorders() -aFilter = aFilterMgr.CreateFilter() -aFilter.SetPredicate( aPredicate ) - -anIds = aFilter.GetElementsId( mesh ) - -# print result -print "Criterion: Free edges Nb = ", len( anIds ) -for i in range( len( anIds ) ): - print anIds[ i ] - -# create group -aGroup = mesh.CreateGroup( SMESH.EDGE, "Free edges" ) -aGroup.Add( anIds ) - - -salome.sg.updateObjBrowser(1) +import salome +import geompy +import smesh + + +# Create box without one plane + +box = geompy.MakeBox(0., 0., 0., 10., 20., 30.) +subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) + +FaceList = [] +for i in range( 5 ): + FaceList.append( subShapeList[ i ] ) + +aComp = geompy.MakeCompound( FaceList ) +aBox = geompy.Sew( aComp, 1. ) +idbox = geompy.addToStudy( aBox, "box" ) + +aBox = salome.IDToObject( idbox ) + +# Create mesh + +mesh = smesh.Mesh(aBox, "Mesh_freebord") + +algoReg = mesh.Segment() +hypNbSeg = algoReg.NumberOfSegments(5) + +algoMef = mesh.Triangle() +hypArea = algoMef.MaxElementArea(20) + + +mesh.Compute() + + +# Criterion : Free edges. Create group. + +aCriterion = smesh.GetCriterion(smesh.EDGE, smesh.FT_FreeEdges) + +aGroup = mesh.MakeGroupByCriterion("Free edges", aCriterion) + +anIds = aGroup.GetIDs() + +# print result +print "Criterion: Free edges Nb = ", len( anIds ) +for i in range( len( anIds ) ): + print anIds[ i ] + +salome.sg.updateObjBrowser(1) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_hexaedre.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_hexaedre.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -c -u -r1.4 -r1.4.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_hexaedre.py 1 Jun 2006 11:39:17 -0000 1.4 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_hexaedre.py 20 Oct 2006 12:02:42 -0000 1.4.2.1 @@ -26,9 +26,8 @@ #============================================================================== import salome -from salome import sg - import geompy +import smesh import math @@ -37,7 +36,6 @@ geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") myBuilder = salome.myStudy.NewBuilder() gg = salome.ImportComponentGUI("GEOM") -from salome import sg ShapeTypeCompSolid = 1 ShapeTypeSolid = 2 @@ -95,72 +93,67 @@ print "-------------------------- mesh" -import SMESH -import StdMeshers -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) - -# ---- create Hypothesis -print "-------------------------- create Hypothesis" -numberOfSegments = 4 -hypNbSegA=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSegA.SetNumberOfSegments(numberOfSegments) -numberOfSegments = 10 -hypNbSegB=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSegB.SetNumberOfSegments(numberOfSegments) -numberOfSegments = 15 -hypNbSegC=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSegC.SetNumberOfSegments(numberOfSegments) - -# ---- create Algorithms -print "-------------------------- create Algorithms" -regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -quad2D=smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so") -hexa3D=smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so") - # ---- init a Mesh with the geom shape shape_mesh = blob -myMesh=smesh.CreateMesh(shape_mesh) +mesh=smesh.Mesh(shape_mesh, "MeshBlob") # ---- add hypothesis and algorithms to mesh print "-------------------------- add hypothesis to mesh" -myMesh.AddHypothesis(shape_mesh,regular1D) -myMesh.AddHypothesis(shape_mesh,quad2D) -myMesh.AddHypothesis(shape_mesh,hexa3D) - -#myMesh.AddHypothesis(shape_mesh,hypNbSeg) - -myMesh.AddHypothesis(aretes[0],hypNbSegA) -myMesh.AddHypothesis(aretes[2],hypNbSegA) -myMesh.AddHypothesis(aretes[8],hypNbSegA) -myMesh.AddHypothesis(aretes[10],hypNbSegA) - -myMesh.AddHypothesis(aretes[1],hypNbSegC) -myMesh.AddHypothesis(aretes[3],hypNbSegC) -myMesh.AddHypothesis(aretes[9],hypNbSegC) -myMesh.AddHypothesis(aretes[11],hypNbSegC) - -myMesh.AddHypothesis(aretes[4],hypNbSegB) -myMesh.AddHypothesis(aretes[5],hypNbSegB) -myMesh.AddHypothesis(aretes[6],hypNbSegB) -myMesh.AddHypothesis(aretes[7],hypNbSegB) +algo1 = mesh.Segment() +algo2 = mesh.Quadrangle() +algo3 = mesh.Hexahedron() + +numberOfSegmentsA = 4 + +algo = mesh.Segment(aretes[0]) +algo.NumberOfSegments(numberOfSegmentsA) +algo = mesh.Segment(aretes[2]) +algo.NumberOfSegments(numberOfSegmentsA) +algo = mesh.Segment(aretes[8]) +algo.NumberOfSegments(numberOfSegmentsA) +algo = mesh.Segment(aretes[10]) +algo.NumberOfSegments(numberOfSegmentsA) + + +numberOfSegmentsC = 15 + +algo = mesh.Segment(aretes[1]) +algo.NumberOfSegments(numberOfSegmentsC) +algo = mesh.Segment(aretes[3]) +algo.NumberOfSegments(numberOfSegmentsC) +algo = mesh.Segment(aretes[9]) +algo.NumberOfSegments(numberOfSegmentsC) +algo = mesh.Segment(aretes[11]) +algo.NumberOfSegments(numberOfSegmentsC) + + +numberOfSegmentsB = 10 +algo = mesh.Segment(aretes[4]) +algo.NumberOfSegments(numberOfSegmentsB) +algo = mesh.Segment(aretes[5]) +algo.NumberOfSegments(numberOfSegmentsB) +algo = mesh.Segment(aretes[6]) +algo.NumberOfSegments(numberOfSegmentsB) +algo = mesh.Segment(aretes[7]) +algo.NumberOfSegments(numberOfSegmentsB) + # ---- compute mesh print "-------------------------- compute mesh" -ret=smesh.Compute(myMesh, shape_mesh) +ret=mesh.Compute() print ret if ret != 0: - #log=myMesh.GetLog(0) # no erase trace + #log=mesh.GetLog(0) # no erase trace #for linelog in log: # print linelog print "Information about the Mesh:" - print "Number of nodes : ", myMesh.NbNodes() - print "Number of edges : ", myMesh.NbEdges() - print "Number of faces : ", myMesh.NbFaces() - print "Number of quadrangles : ", myMesh.NbQuadrangles() - print "Number of volumes : ", myMesh.NbVolumes() - print "Number of hexahedrons : ", myMesh.NbHexas() + print "Number of nodes : ", mesh.NbNodes() + print "Number of edges : ", mesh.NbEdges() + print "Number of faces : ", mesh.NbFaces() + print "Number of quadrangles : ", mesh.NbQuadrangles() + print "Number of volumes : ", mesh.NbVolumes() + print "Number of hexahedrons : ", mesh.NbHexas() else: print "problem when Computing the mesh" Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic.py,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -c -u -r1.9 -r1.9.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic.py 1 Jun 2006 11:39:17 -0000 1.9 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic.py 20 Oct 2006 12:02:42 -0000 1.9.2.1 @@ -28,6 +28,7 @@ import salome import geompy +import smesh import StdMeshers @@ -120,130 +121,55 @@ # ---------------------------- SMESH -------------------------------------- -# ---- launch SMESH, init a Mesh with shape 'mechanic' - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - # -- Init -- shape_mesh = salome.IDToObject( Id_mechanic ) -smesh.SetCurrentStudy(salome.myStudy) - -mesh = smesh.CreateMesh(shape_mesh) -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) - -idmesh = salome.ObjectToID(mesh) -smeshgui.SetName( idmesh, "Mesh_mechanic" ) +mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic") print "-------------------------- NumberOfSegments" numberOfSegment = 10 -hypNbSeg = smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" ) -hypNbSeg.SetNumberOfSegments( numberOfSegment ) +algo = mesh.Segment() +hypNbSeg = algo.NumberOfSegments(numberOfSegment) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() - -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_10") +smesh.SetName(hypNbSeg, "NumberOfSegments_10") print "-------------------------- MaxElementArea" maxElementArea = 25 -hypArea25 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) -hypArea25.SetMaxElementArea( maxElementArea ) +algo = mesh.Triangle() +hypArea25 = algo.MaxElementArea(maxElementArea) print hypArea25.GetName() print hypArea25.GetId() print hypArea25.GetMaxElementArea() +smesh.SetName(hypArea25, "MaxElementArea_25") -smeshgui.SetName(salome.ObjectToID(hypArea25), "MaxElementArea_25") - -print "-------------------------- MaxElementArea" - -maxElementArea = 35 - -hypArea35 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) -hypArea35.SetMaxElementArea( maxElementArea ) -print hypArea35.GetName() -print hypArea35.GetId() -print hypArea35.GetMaxElementArea() - -smeshgui.SetName(salome.ObjectToID(hypArea35), "MaxElementArea_35") - -print "-------------------------- Regular_1D" - -algoReg1D = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" ) -listHyp = algoReg1D.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoReg1D.GetName() -print algoReg1D.GetId() - -smeshgui.SetName(salome.ObjectToID(algoReg1D), "Regular_1D") - -print "-------------------------- MEFISTO_2D" - -algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" ) -listHyp = algoMef.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoMef.GetName() -print algoMef.GetId() - -smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D") - -print "-------------------------- SMESH_Quadrangle_2D" - -algoQuad = smesh.CreateHypothesis( "Quadrangle_2D", "libStdMeshersEngine.so" ) -listHyp = algoQuad.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoQuad.GetName() -print algoQuad.GetId() - -smeshgui.SetName(salome.ObjectToID(algoQuad), "SMESH_Quadrangle_2D") - -print "-------------------------- add hypothesis to main shape" - -mesh.AddHypothesis( shape_mesh, hypNbSeg ) # nb segments -mesh.AddHypothesis( shape_mesh, hypArea25 ) # max area - -mesh.AddHypothesis( shape_mesh, algoReg1D ) # Regular 1D/wire discretisation -mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D - -print "-------------------------- add hypothesis and algorithm to sub face 1" - -submesh = mesh.GetSubMesh(sub_face1, "SubMeshFace1") - -mesh.AddHypothesis( sub_face1, algoQuad ) # Quadrangle 2D -mesh.AddHypothesis( sub_face1, hypArea35 ) # max area - -print "-------------------------- add hypothesis and algorithm to sub face 2" - -submesh = mesh.GetSubMesh(sub_face2, "SubMeshFace2") - -mesh.AddHypothesis( sub_face2, algoQuad ) # Quadrangle 2D -mesh.AddHypothesis( sub_face2, hypArea35 ) # max area - -print "-------------------------- add hypothesis and algorith to sub face 3" - -submesh = mesh.GetSubMesh(sub_face3, "SubMeshFace3") - -mesh.AddHypothesis( sub_face3, algoQuad ) # Quadrangle 2D -mesh.AddHypothesis( sub_face3, hypArea35 ) # max area - -print "-------------------------- add hypothesis and algorith to sub face 4" - -submesh = mesh.GetSubMesh(sub_face4, "SubMeshFace4") +# Create submesh on sub_face1 - sub_face4 +# --------------------------------------- -mesh.AddHypothesis( sub_face4, algoQuad ) # Quadrangle 2D -mesh.AddHypothesis( sub_face4, hypArea35 ) # max area +# Set 2D algorithm to submesh on sub_face1 +algo = mesh.Quadrangle(sub_face1) +smesh.SetName(algo.GetSubMesh(), "SubMeshFace1") + +# Set 2D algorithm to submesh on sub_face2 +algo = mesh.Quadrangle(sub_face2) +smesh.SetName(algo.GetSubMesh(), "SubMeshFace2") + +# Set 2D algorithm to submesh on sub_face3 +algo = mesh.Quadrangle(sub_face3) +smesh.SetName(algo.GetSubMesh(), "SubMeshFace3") + +# Set 2D algorithm to submesh on sub_face4 +algo = mesh.Quadrangle(sub_face4) +smesh.SetName(algo.GetSubMesh(), "SubMeshFace4") print "-------------------------- compute the mesh of the mechanic piece" -smesh.Compute(mesh, shape_mesh) +mesh.Compute() print "Information about the Mesh_mechanic:" print "Number of nodes : ", mesh.NbNodes() Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_editor.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_editor.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -c -u -r1.5 -r1.5.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_editor.py 1 Jun 2006 11:39:17 -0000 1.5 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_editor.py 20 Oct 2006 12:02:42 -0000 1.5.2.1 @@ -28,10 +28,7 @@ import salome import geompy - -import StdMeshers - -import SMESH +import smesh # ---------------------------- GEOM -------------------------------------- @@ -122,130 +119,62 @@ # ---------------------------- SMESH -------------------------------------- -# ---- launch SMESH, init a Mesh with shape 'mechanic' - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - # -- Init -- shape_mesh = salome.IDToObject( Id_mechanic ) -smesh.SetCurrentStudy(salome.myStudy) - -mesh = smesh.CreateMesh(shape_mesh) -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) - -idmesh = salome.ObjectToID(mesh) -smeshgui.SetName( idmesh, "Mesh_mechanic" ) +mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic") print "-------------------------- NumberOfSegments" numberOfSegment = 10 -hypNbSeg = smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" ) -hypNbSeg.SetNumberOfSegments( numberOfSegment ) +algo = mesh.Segment() +hypNbSeg = algo.NumberOfSegments(numberOfSegment) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() +smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment)) -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_10") print "-------------------------- MaxElementArea" maxElementArea = 25 -hypArea25 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) -hypArea25.SetMaxElementArea( maxElementArea ) +algo = mesh.Triangle() +hypArea25 = algo.MaxElementArea(maxElementArea) print hypArea25.GetName() print hypArea25.GetId() print hypArea25.GetMaxElementArea() +smesh.SetName(hypArea25, "MaxElementArea_" + str(maxElementArea)) -smeshgui.SetName(salome.ObjectToID(hypArea25), "MaxElementArea_25") - -print "-------------------------- MaxElementArea" - -maxElementArea = 35 - -hypArea35 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) -hypArea35.SetMaxElementArea( maxElementArea ) -print hypArea35.GetName() -print hypArea35.GetId() -print hypArea35.GetMaxElementArea() - -smeshgui.SetName(salome.ObjectToID(hypArea35), "MaxElementArea_35") - -print "-------------------------- Regular_1D" - -algoReg1D = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" ) -listHyp = algoReg1D.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoReg1D.GetName() -print algoReg1D.GetId() - -smeshgui.SetName(salome.ObjectToID(algoReg1D), "Regular_1D") - -print "-------------------------- MEFISTO_2D" - -algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" ) -listHyp = algoMef.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoMef.GetName() -print algoMef.GetId() - -smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D") -print "-------------------------- SMESH_Quadrangle_2D" +# Create submesh on sub_face1 - sub_face4 +# --------------------------------------- -algoQuad = smesh.CreateHypothesis( "Quadrangle_2D", "libStdMeshersEngine.so" ) -listHyp = algoQuad.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoQuad.GetName() -print algoQuad.GetId() +# Set 2D algorithm to submesh on sub_face1 +algo = mesh.Quadrangle(sub_face1) +smesh.SetName(algo.GetSubMesh(), "SubMeshFace1") +submesh1 = algo.GetSubMesh() + +# Set 2D algorithm to submesh on sub_face2 +algo = mesh.Quadrangle(sub_face2) +smesh.SetName(algo.GetSubMesh(), "SubMeshFace2") +submesh2 = algo.GetSubMesh() + +# Set 2D algorithm to submesh on sub_face3 +algo = mesh.Quadrangle(sub_face3) +smesh.SetName(algo.GetSubMesh(), "SubMeshFace3") +submesh3 = algo.GetSubMesh() + +# Set 2D algorithm to submesh on sub_face4 +algo = mesh.Quadrangle(sub_face4) +smesh.SetName(algo.GetSubMesh(), "SubMeshFace4") +submesh4 = algo.GetSubMesh() -smeshgui.SetName(salome.ObjectToID(algoQuad), "SMESH_Quadrangle_2D") - -print "-------------------------- add hypothesis to main shape" - -mesh.AddHypothesis( shape_mesh, hypNbSeg ) # nb segments -mesh.AddHypothesis( shape_mesh, hypArea25 ) # max area - -mesh.AddHypothesis( shape_mesh, algoReg1D ) # Regular 1D/wire discretisation -mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D - -print "-------------------------- add hypothesis and algorithm to sub face 1" - -submesh = mesh.GetSubMesh(sub_face1, "SubMeshFace1") - -mesh.AddHypothesis( sub_face1, algoQuad ) # Quadrangle 2D -mesh.AddHypothesis( sub_face1, hypArea35 ) # max area - -print "-------------------------- add hypothesis and algorithm to sub face 2" - -submesh = mesh.GetSubMesh(sub_face2, "SubMeshFace2") - -mesh.AddHypothesis( sub_face2, algoQuad ) # Quadrangle 2D -mesh.AddHypothesis( sub_face2, hypArea35 ) # max area - -print "-------------------------- add hypothesis and algorith to sub face 3" - -submesh = mesh.GetSubMesh(sub_face3, "SubMeshFace3") - -mesh.AddHypothesis( sub_face3, algoQuad ) # Quadrangle 2D -mesh.AddHypothesis( sub_face3, hypArea35 ) # max area - -print "-------------------------- add hypothesis and algorith to sub face 4" - -submesh = mesh.GetSubMesh(sub_face4, "SubMeshFace4") - -mesh.AddHypothesis( sub_face4, algoQuad ) # Quadrangle 2D -mesh.AddHypothesis( sub_face4, hypArea35 ) # max area print "-------------------------- compute the mesh of the mechanic piece" -smesh.Compute(mesh, shape_mesh) +mesh.Compute() print "Information about the Mesh_mechanic:" print "Number of nodes : ", mesh.NbNodes() @@ -257,52 +186,45 @@ print "Number of tetrahedrons: ", mesh.NbTetras() -MeshEditor = mesh.GetMeshEditor() - #1 cutting of quadrangles of the 'SubMeshFace2' submesh -submesh = mesh.GetSubMesh(sub_face2, "SubMeshFace2") -MeshEditor.SplitQuadObject(submesh, 1) +mesh.SplitQuadObject(submesh2, 1) #2 cutting of triangles of the group FacesTriToQuad = [2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422] -GroupTriToQuad = mesh.CreateGroup(SMESH.FACE,"Group of faces (quad)") -GroupTriToQuad.Add(FacesTriToQuad) -MeshEditor.TriToQuadObject(GroupTriToQuad, None , 1.57) +GroupTriToQuad = mesh.MakeGroupByIds("Group of faces (quad)", smesh.FACE, FacesTriToQuad) +mesh.TriToQuadObject(GroupTriToQuad, None , 1.57) #3 extrusion of the group -point = SMESH.PointStruct(0, 0, 5) -vector = SMESH.DirStruct(point) -MeshEditor.ExtrusionSweepObject(GroupTriToQuad, vector, 5) +point = smesh.PointStruct(0, 0, 5) +vector = smesh.DirStruct(point) +mesh.ExtrusionSweepObject(GroupTriToQuad, vector, 5) #4 mirror object -MeshEditor.MirrorObject(mesh, SMESH.AxisStruct(0, 0, 0, 0, 0, 0), SMESH.SMESH_MeshEditor.POINT, 0) +mesh.Mirror([], smesh.AxisStruct(0, 0, 0, 0, 0, 0), smesh.POINT, 0) #5 mesh translation -point = SMESH.PointStruct(10, 10, 10) -vector = SMESH.DirStruct(point) -MeshEditor.TranslateObject(mesh, vector, 0) +point = smesh.PointStruct(10, 10, 10) +vector = smesh.DirStruct(point) +mesh.Translate([], vector, 0) #6 mesh rotation -axisXYZ = SMESH.AxisStruct(0, 0, 0, 10, 10, 10) +axisXYZ = smesh.AxisStruct(0, 0, 0, 10, 10, 10) angle180 = 180*3.141/180 -MeshEditor.RotateObject(mesh, axisXYZ, angle180, 0) +mesh.Rotate([], axisXYZ, angle180, 0) #7 group smoothing FacesSmooth = [864, 933, 941, 950, 1005, 1013] -GroupSmooth = mesh.CreateGroup(SMESH.FACE,"Group of faces (smooth)") -GroupSmooth.Add(FacesSmooth) -MeshEditor.SmoothObject(GroupSmooth, [], 20, 2, SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH) +GroupSmooth = mesh.MakeGroupByIds("Group of faces (smooth)", smesh.FACE, FacesSmooth) +mesh.SmoothObject(GroupSmooth, [], 20, 2, smesh.CENTROIDAL_SMOOTH) #8 rotation sweep object FacesRotate = [492, 493, 502, 503] -GroupRotate = mesh.CreateGroup(SMESH.FACE,"Group of faces (rotate)") -GroupRotate.Add(FacesRotate) +GroupRotate = mesh.MakeGroupByIds("Group of faces (rotate)", smesh.FACE, FacesRotate) angle45 = 45*3.141/180 -axisXYZ = SMESH.AxisStruct(-38.3128, -73.3658, -133.321, -13.3402, -13.3265, 6.66632) -MeshEditor.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5) +axisXYZ = smesh.AxisStruct(-38.3128, -73.3658, -133.321, -13.3402, -13.3265, 6.66632) +mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5) -#9 reorientation of the whole mesh -submesh = mesh.GetSubMesh(sub_face1, "SubMeshFace1") -MeshEditor.ReorientObject(submesh) +#9 reorientation of the submesh1 +mesh.ReorientObject(submesh1) salome.sg.updateObjBrowser(1) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_netgen.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_netgen.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -c -u -r1.3 -r1.3.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_netgen.py 1 Jun 2006 11:39:17 -0000 1.3 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_netgen.py 20 Oct 2006 12:02:42 -0000 1.3.2.1 @@ -28,8 +28,6 @@ geom = geompy.geom -import StdMeshers -import NETGENPlugin import smesh # ---------------------------- GEOM -------------------------------------- @@ -109,13 +107,12 @@ print "-------------------------- create Mesh, algorithm, hypothesis" mesh = smesh.Mesh(mechanic, "Mesh_mechanic"); -netgen = mesh.Netgen(0) -hyp = netgen.Parameters() -hyp.SetMaxSize( 50 ) -#hyp.SetSecondOrder( 0 ) -hyp.SetFineness( 3 ) -hyp.SetQuadAllowed( 1 ) -#hyp.SetOptimize( 1 ) +netgen = mesh.Triangle(smesh.NETGEN) +netgen.SetMaxSize( 50 ) +#netgen.SetSecondOrder( 0 ) +netgen.SetFineness( smesh.Fine ) +netgen.SetQuadAllowed( 1 ) +#netgen.SetOptimize( 1 ) salome.sg.updateObjBrowser(1) @@ -124,13 +121,13 @@ print ret if ret != 0: print "Information about the MeshcompShel:" - print "Number of nodes : ", mesh.GetMesh().NbNodes() - print "Number of edges : ", mesh.GetMesh().NbEdges() - print "Number of faces : ", mesh.GetMesh().NbFaces() - print "Number of triangles : ", mesh.GetMesh().NbTriangles() - print "Number of quadrangles : ", mesh.GetMesh().NbQuadrangles() - print "Number of volumes : ", mesh.GetMesh().NbVolumes() - print "Number of tetrahedrons : ", mesh.GetMesh().NbTetras() + print "Number of nodes : ", mesh.NbNodes() + print "Number of edges : ", mesh.NbEdges() + print "Number of faces : ", mesh.NbFaces() + print "Number of triangles : ", mesh.NbTriangles() + print "Number of quadrangles : ", mesh.NbQuadrangles() + print "Number of volumes : ", mesh.NbVolumes() + print "Number of tetrahedrons : ", mesh.NbTetras() else: print "problem when computing the mesh" Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_tetra.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_tetra.py,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -c -u -r1.8 -r1.8.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_tetra.py 1 Jun 2006 11:39:17 -0000 1.8 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_mechanic_tetra.py 20 Oct 2006 12:02:42 -0000 1.8.2.1 @@ -26,16 +26,9 @@ import salome import geompy +import smesh geom = geompy.geom -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) - -import StdMeshers -import NETGENPlugin # ---------------------------- GEOM -------------------------------------- @@ -111,94 +104,44 @@ ### ---------------------------- SMESH -------------------------------------- -print "-------------------------- NumberOfSegments" +shape_mesh = salome.IDToObject( Id_mechanic ) + +mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic_tetra") + +print "-------------------------- add hypothesis to main mechanic" numberOfSegment = 10 -hypNbSeg = smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" ) -hypNbSeg.SetNumberOfSegments( numberOfSegment ) +algo1 = mesh.Segment() +hypNbSeg = algo1.NumberOfSegments(numberOfSegment) print hypNbSeg.GetName() print hypNbSeg.GetId() print hypNbSeg.GetNumberOfSegments() +smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment)) -smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_10") - -print "-------------------------- MaxElementArea" maxElementArea = 20 -hypArea = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) -hypArea.SetMaxElementArea( maxElementArea ) +algo2 = mesh.Triangle(smesh.MEFISTO) +hypArea = algo2.MaxElementArea(maxElementArea) print hypArea.GetName() print hypArea.GetId() print hypArea.GetMaxElementArea() +smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) -smeshgui.SetName(salome.ObjectToID(hypArea), "MaxElementArea_20") - -print "-------------------------- MaxElementVolume" maxElementVolume = 20 -hypVolume = smesh.CreateHypothesis( "MaxElementVolume", "libStdMeshersEngine.so" ) -hypVolume.SetMaxElementVolume( maxElementVolume ) +algo3 = mesh.Tetrahedron(smesh.NETGEN) +hypVolume = algo3.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() print hypVolume.GetMaxElementVolume() +smesh.SetName(hypVolume, "maxElementVolume_" + str(maxElementVolume)) -smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_20") - -print "-------------------------- Regular_1D" - -algoReg1D = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" ) -listHyp =algoReg1D.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoReg1D.GetName() -print algoReg1D.GetId() - -smeshgui.SetName(salome.ObjectToID(algoReg1D), "Regular_1D") - -print "-------------------------- MEFISTO_2D" - -algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" ) -listHyp = algoMef.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoMef.GetName() -print algoMef.GetId() - -smeshgui.SetName(salome.ObjectToID(algoMef), "MEFISTO_2D") - -print "-------------------------- NETGEN_3D" - -algoNg = smesh.CreateHypothesis( "NETGEN_3D", "libNETGENEngine.so" ) -listHyp = algoNg.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoNg.GetName() -print algoNg.GetId() - -smeshgui.SetName(salome.ObjectToID(algoNg), "NETGEN_3D") - -print "-------------------------- add hypothesis to main mechanic" - -shape_mesh = salome.IDToObject( Id_mechanic ) - -mesh = smesh.CreateMesh(shape_mesh) - -idmesh = salome.ObjectToID(mesh) -smeshgui.SetName( idmesh, "Mesh_mechanic_tetra" ) - -mesh.AddHypothesis( shape_mesh, hypNbSeg ) # nb segments -mesh.AddHypothesis( shape_mesh, hypArea ) # max area -mesh.AddHypothesis( shape_mesh, hypVolume ) # max volume - -mesh.AddHypothesis( shape_mesh, algoReg1D ) # Regular 1D/wire discretisation -mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D -mesh.AddHypothesis( shape_mesh, algoNg ) # NETGEN 3D print "-------------------------- compute the mesh of the mechanic piece" -smesh.Compute(mesh,shape_mesh) +mesh.Compute() print "Information about the Mesh_mechanic_tetra:" print "Number of nodes : ", mesh.NbNodes() Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_reg.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_reg.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -c -u -r1.4 -r1.4.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_reg.py 1 Jun 2006 11:39:17 -0000 1.4 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_reg.py 20 Oct 2006 12:02:42 -0000 1.4.2.1 @@ -24,11 +24,10 @@ import salome import geompy +import smesh import StdMeshers -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) # ---- define a box print "Define box" @@ -60,124 +59,53 @@ smeshgui.Init(salome.myStudyId) -print "-------------------------- create Hypothesis" +# ---- Creating meshes -print "-------------------------- LocalLength" -hypLen1 = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so") -hypLen1.SetLength(100) -print hypLen1.GetName() -print hypLen1.GetId() -print hypLen1.GetLength() - -idlength = salome.ObjectToID(hypLen1) -smeshgui.SetName(idlength, "Local_Length_100"); - -hypNbSeg = [] -print "-------------------------- NumberOfSegments" -hypNbSeg1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg1.SetDistrType(0) -hypNbSeg1.SetNumberOfSegments(7) -print hypNbSeg1.GetName() -print hypNbSeg1.GetId() -print hypNbSeg1.GetNumberOfSegments() -idseg1 = salome.ObjectToID(hypNbSeg1) -smeshgui.SetName(idseg1, "NumberOfSegmentsReg"); -hypNbSeg.append(hypNbSeg1) - -hypNbSeg2 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg2.SetDistrType(1) -hypNbSeg2.SetNumberOfSegments(7) -hypNbSeg2.SetScaleFactor(2) -print hypNbSeg2.GetName() -print hypNbSeg2.GetId() -print hypNbSeg2.GetNumberOfSegments() -idseg2 = salome.ObjectToID(hypNbSeg2) -smeshgui.SetName(idseg2, "NumberOfSegmentsScale"); -hypNbSeg.append(hypNbSeg2) - -hypNbSeg3 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg3.SetDistrType(2) -hypNbSeg3.SetNumberOfSegments(7) -hypNbSeg3.SetTableFunction( [0, 0.1, 0.5, 1.0, 1.0, 0.1] ) -hypNbSeg3.SetConversionMode(0) -print hypNbSeg3.GetName() -print hypNbSeg3.GetId() -print hypNbSeg3.GetNumberOfSegments() -idseg3 = salome.ObjectToID(hypNbSeg3) -smeshgui.SetName(idseg3, "NumberOfSegmentsTable"); -hypNbSeg.append(hypNbSeg3) - -hypNbSeg4 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg4.SetDistrType(3) -hypNbSeg4.SetNumberOfSegments(10) -hypNbSeg4.SetExpressionFunction("sin(3*t)") -hypNbSeg4.SetConversionMode(1) -print hypNbSeg4.GetName() -print hypNbSeg4.GetId() -print hypNbSeg4.GetNumberOfSegments() -idseg4 = salome.ObjectToID(hypNbSeg4) -smeshgui.SetName(idseg4, "NumberOfSegmentsExpr"); -hypNbSeg.append(hypNbSeg4) - -print "-------------------------- MaxElementArea" -hypArea1 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea1.SetMaxElementArea(2500) -print hypArea1.GetName() -print hypArea1.GetId() -print hypArea1.GetMaxElementArea() - -idarea1 = salome.ObjectToID(hypArea1) -smeshgui.SetName(idarea1, "MaxElementArea_2500"); - -print "-------------------------- MaxElementArea" -hypArea2 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea2.SetMaxElementArea(500) -print hypArea2.GetName() -print hypArea2.GetId() -print hypArea2.GetMaxElementArea() - -idarea2 = salome.ObjectToID(hypArea2) -smeshgui.SetName(idarea2, "MaxElementArea_500"); - -print "-------------------------- Regular_1D" -algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -listHyp = algoReg.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoReg.GetName() -print algoReg.GetId() - -idreg = salome.ObjectToID(algoReg) -smeshgui.SetName(idreg, "Regular_1D"); - -print "-------------------------- MEFISTO_2D" -algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") -listHyp = algoMef.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoMef.GetName() -print algoMef.GetId() - -idmef = salome.ObjectToID(algoMef) -smeshgui.SetName(idmef, "MEFISTO_2D"); +box = salome.IDToObject(idbox) +names = [ "MeshBoxReg", "MeshBoxScale", "MeshBoxTable", "MeshBoxExpr" ] -salome.sg.updateObjBrowser(1); -# ---- Init a Mesh with the box +print "-------------------------- Create ", names[0], " mesh" +mesh = smesh.Mesh(box, names[0]) +algo = mesh.Segment() +hyp = algo.NumberOfSegments(7) +hyp.SetDistrType(0) +smesh.SetName(hyp, "NumberOfSegmentsReg") +algo = mesh.Triangle() +algo.MaxElementArea(2500) + +print "-------------------------- Create ", names[1], " mesh" +mesh = smesh.Mesh(box, names[1]) +algo = mesh.Segment() +hyp = algo.NumberOfSegments(7) +hyp.SetDistrType(1) +hyp.SetScaleFactor(2) +smesh.SetName(hyp, "NumberOfSegmentsScale") +algo = mesh.Triangle() +algo.MaxElementArea(2500) + +print "-------------------------- Create ", names[2], " mesh" +mesh = smesh.Mesh(box,names[2]) +algo = mesh.Segment() +hyp = algo.NumberOfSegments(7) +hyp.SetDistrType(2) +hyp.SetTableFunction( [0, 0.1, 0.5, 1.0, 1.0, 0.1] ) +hyp.SetConversionMode(0) +smesh.SetName(hyp, "NumberOfSegmentsTable") +algo = mesh.Triangle() +algo.MaxElementArea(2500) + +print "-------------------------- Create ", names[3], " mesh" +mesh = smesh.Mesh(box, names[3]) +algo = mesh.Segment() +hyp = algo.NumberOfSegments(10) +hyp.SetDistrType(3) +hyp.SetExpressionFunction("sin(3*t)") +hyp.SetConversionMode(1) +smesh.SetName(hyp, "NumberOfSegmentsExpr") +algo = mesh.Triangle() +algo.MaxElementArea(2500) -box = salome.IDToObject(idbox) -names = [ "MeshBoxReg", "MeshBoxScale", "MeshBoxTable", "MeshBoxExpr" ]; -j = 0 -for i in range(4): - mesh = smesh.CreateMesh(box) - idmesh = salome.ObjectToID(mesh) - smeshgui.SetName(idmesh, names[j]); - print "-------------------------- add hypothesis to box" - mesh.AddHypothesis(box,algoReg) - mesh.AddHypothesis(box,hypNbSeg[j]) - mesh.AddHypothesis(box,algoMef) - mesh.AddHypothesis(box,hypArea1) - j=j+1 salome.sg.updateObjBrowser(1); Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -c -u -r1.5 -r1.5.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test.py 1 Jun 2006 11:39:17 -0000 1.5 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test.py 20 Oct 2006 12:02:42 -0000 1.5.2.1 @@ -26,10 +26,7 @@ import salome import geompy -import smeshpy - -import SMESH -import StdMeshers +import smesh # ---- define a box @@ -57,94 +54,46 @@ name = geompy.SubShapeName(edge, face) ide = geompy.addToStudyInFather(face, edge, name) -# ---- launch SMESH, init a Mesh with the box - -gen = smeshpy.smeshpy() -mesh = gen.CreateMesh(idb) - -print "-------------------------- create Hypothesis" - -print "-------------------------- LocalLength" - -hypo1 = gen.CreateHypothesis("LocalLength", "libStdMeshersEngine.so") -print hypo1.GetName() -print hypo1.GetId() -print hypo1.GetLength() -hypo1.SetLength(100) -print hypo1.GetLength() - -print "-------------------------- bidon" +# ---- SMESH -hyp3 = gen.CreateHypothesis("bidon", "") - -print "-------------------------- NumberOfSegments" - -hypo3 = gen.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypo3.SetNumberOfSegments(7) -print hypo3.GetName() -print hypo3.GetNumberOfSegments() -print hypo3.GetId() - -print "-------------------------- MaxElementArea" - -hypo4 = gen.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypo4.SetMaxElementArea(5000) -print hypo4.GetName() -print hypo4.GetMaxElementArea() -print hypo4.GetId() +box = salome.IDToObject(idb) +mesh = smesh.Mesh(box, "Meshbox") -print "-------------------------- Regular_1D" +print "-------------------------- add hypothesis to box" -algo_1 = gen.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -print algo_1.GetName() -print algo_1.GetId() -listHyp = algo_1.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algo_1.GetId() +algo_1 = mesh.Segment(box) +hyp = algo_1.LocalLength(100) +print hyp.GetName() +print hyp.GetId() +print hyp.GetLength() + +algo_2 = mesh.Triangle(smesh.MEFISTO, box) +hyp = algo_2.MaxElementArea(5000) +print hyp.GetName() +print hyp.GetId() +print hyp.GetMaxElementArea() -print "-------------------------- MEFISTO_2D" +smesh.SetName(algo_2.GetSubMesh(), "SubMeshBox") -algo_2 = gen.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") -print algo_2.GetName() -print algo_2.GetId() -listHyp = algo_2.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algo_2.GetId() print "-------------------------- add hypothesis to edge" edge = salome.IDToObject(ide) -submesh = mesh.GetSubMesh(edge, "SubMeshEdge") -ret = mesh.AddHypothesis(edge,algo_1) -print ret -ret = mesh.AddHypothesis(edge,hypo1) -print ret -##print "-------------------------- compute edge" -##ret=gen.Compute(mesh,ide) -##print ret -##log=mesh.GetLog(1); -##for a in log: -## print a +algo_3 = mesh.Segment(edge) +hyp = algo_3.LocalLength(100) +print hyp.GetName() +print hyp.GetId() +print hyp.GetLength() -print "-------------------------- add hypothesis to box" +smesh.SetName(algo_3.GetSubMesh(), "SubMeshEdge") -box = salome.IDToObject(idb) -submesh = mesh.GetSubMesh(box, "SubMeshBox") -ret = mesh.AddHypothesis(box,algo_1) -print ret -ret = mesh.AddHypothesis(box,hypo1) -print ret -ret = mesh.AddHypothesis(box,algo_2) -print ret -ret = mesh.AddHypothesis(box,hypo4) -print ret print "-------------------------- compute face" -ret = gen.Compute(mesh,idf) +face = salome.IDToObject(idf) + +ret = mesh.Compute(face) print ret log = mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after for a in log: @@ -183,18 +132,3 @@ i3 = a.indexes[ii] ii = ii+1 print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3) - -##print "-------------------------- compute box" -##ret=gen.Compute(mesh,idb) -##print ret -##log=mesh.GetLog(1); -##print log - -##shell=salome.IDToObject(ids) -##submesh=mesh.GetElementsOnShape(shell) -##ret=mesh.AddHypothesis(shell,algo_1) -##print ret -##ret=mesh.AddHypothesis(shell,hypo1) -##print ret -##ret=gen.Compute(mesh,ids) -##print ret Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test0.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test0.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -c -u -r1.7 -r1.7.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test0.py 1 Jun 2006 11:39:17 -0000 1.7 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test0.py 20 Oct 2006 12:02:42 -0000 1.7.2.1 @@ -26,7 +26,6 @@ import geompy from geompy import geom -import SMESH myBuilder = salome.myStudy.NewBuilder() Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test1.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test1.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -c -u -r1.6 -r1.6.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test1.py 1 Jun 2006 11:39:17 -0000 1.6 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test1.py 20 Oct 2006 12:02:42 -0000 1.6.2.1 @@ -24,11 +24,8 @@ import salome import geompy +import smesh -import StdMeshers - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) # ---- define a box @@ -59,99 +56,51 @@ print name idedge = geompy.addToStudyInFather(face, edge, name) -# ---- launch SMESH - -smeshgui = salome.ImportComponentGUI("SMESH") -smeshgui.Init(salome.myStudyId) -print "-------------------------- create Hypothesis" +# ---- SMESH -print "-------------------------- LocalLength" -hypLen1 = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so") -hypLen1.SetLength(100) -print hypLen1.GetName() -print hypLen1.GetId() -print hypLen1.GetLength() +# ---- Init a Mesh with the box -idlength = salome.ObjectToID(hypLen1) -smeshgui.SetName(idlength, "Local_Length_100"); +mesh = smesh.Mesh(box, "Meshbox") -print "-------------------------- NumberOfSegments" -hypNbSeg1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hypNbSeg1.SetNumberOfSegments(7) +print "-------------------------- add hypothesis to box" +algoReg1 = mesh.Segment() +hypNbSeg1 = algoReg1.NumberOfSegments(7) print hypNbSeg1.GetName() print hypNbSeg1.GetId() print hypNbSeg1.GetNumberOfSegments() +smesh.SetName(hypNbSeg1, "NumberOfSegments_7") -idseg = salome.ObjectToID(hypNbSeg1) -smeshgui.SetName(idseg, "NumberOfSegments_7"); - -print "-------------------------- MaxElementArea" -hypArea1 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea1.SetMaxElementArea(2500) +algoMef1 = mesh.Triangle() +hypArea1 = algoMef1.MaxElementArea(2500) print hypArea1.GetName() print hypArea1.GetId() print hypArea1.GetMaxElementArea() - -idarea1 = salome.ObjectToID(hypArea1) -smeshgui.SetName(idarea1, "MaxElementArea_2500"); - -print "-------------------------- MaxElementArea" -hypArea2 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hypArea2.SetMaxElementArea(500) -print hypArea2.GetName() -print hypArea2.GetId() -print hypArea2.GetMaxElementArea() - -idarea2 = salome.ObjectToID(hypArea2) -smeshgui.SetName(idarea2, "MaxElementArea_500"); - -print "-------------------------- Regular_1D" -algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -listHyp = algoReg.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoReg.GetName() -print algoReg.GetId() - -idreg = salome.ObjectToID(algoReg) -smeshgui.SetName(idreg, "Regular_1D"); - -print "-------------------------- MEFISTO_2D" -algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") -listHyp = algoMef.GetCompatibleHypothesis() -for hyp in listHyp: - print hyp -print algoMef.GetName() -print algoMef.GetId() - -idmef = salome.ObjectToID(algoMef) -smeshgui.SetName(idmef, "MEFISTO_2D"); - -# ---- Init a Mesh with the box - -box = salome.IDToObject(idbox) -mesh = smesh.CreateMesh(box) -idmesh = salome.ObjectToID(mesh) -smeshgui.SetName(idmesh, "Meshbox"); - -print "-------------------------- add hypothesis to box" -mesh.AddHypothesis(box,algoReg) -mesh.AddHypothesis(box,hypNbSeg1) -mesh.AddHypothesis(box,algoMef) -mesh.AddHypothesis(box,hypArea1) +smesh.SetName(hypArea1, "MaxElementArea_2500") # ---- add hypothesis to edge - print "-------------------------- add hypothesis to edge" edge = salome.IDToObject(idedge) -submesh = mesh.GetSubMesh(edge, "SubMeshEdge") -mesh.AddHypothesis(edge, algoReg) -mesh.AddHypothesis(edge, hypLen1) +algoReg2 = mesh.Segment(edge) +hypLen1 = algoReg2.LocalLength(100) +smesh.SetName(algoReg2.GetSubMesh(), "SubMeshEdge") +print hypLen1.GetName() +print hypLen1.GetId() +print hypLen1.GetLength() +smesh.SetName(hypLen1, "Local_Length_100") + +# ---- add hypothesis to face print "-------------------------- add hypothesis to face" face = salome.IDToObject(idface) -submesh = mesh.GetSubMesh(face, "SubMeshFace") -mesh.AddHypothesis(face, hypArea2) + +algoMef2 = mesh.Triangle(face) +hypArea2 = algoMef2.MaxElementArea(500) +smesh.SetName(algoMef2.GetSubMesh(), "SubMeshFace") +print hypArea2.GetName() +print hypArea2.GetId() +print hypArea2.GetMaxElementArea() +smesh.SetName(hypArea2, "MaxElementArea_500") + salome.sg.updateObjBrowser(1); Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test2.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test2.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -c -u -r1.5 -r1.5.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test2.py 1 Jun 2006 11:39:17 -0000 1.5 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test2.py 20 Oct 2006 12:02:42 -0000 1.5.2.1 @@ -27,39 +27,10 @@ # ---- compute box print "-------------------------- compute box" -ret = smesh.Compute(mesh,box) +ret = mesh.Compute() print ret log = mesh.GetLog(0); # no erase trace for linelog in log: print linelog -salome.sg.updateObjBrowser(1); - -# ---- compute edge - -##print "-------------------------- compute edge" -##ret=gen.Compute(mesh,idedge) -##print ret -##log=mesh.GetLog(1); -##for a in log: -## print a - -# ---- add hypothesis to face - -# ---- compute face - -#print "-------------------------- compute face" -#ret=gen.Compute(mesh,idface) -#print ret -#log=mesh.GetLog(1); -#for a in log: -# print a - -##shell=salome.IDToObject(ids) -##submesh=mesh.GetElementsOnShape(shell) -##ret=mesh.AddHypothesis(shell,algoReg) -##print ret -##ret=mesh.AddHypothesis(shell,hypLen1) -##print ret -##ret=gen.Compute(mesh,ids) -##print ret +salome.sg.updateObjBrowser(1) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test4.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test4.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -c -u -r1.5 -r1.5.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test4.py 1 Jun 2006 11:39:17 -0000 1.5 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test4.py 20 Oct 2006 12:02:42 -0000 1.5.2.1 @@ -19,11 +19,10 @@ # import salome import geompy -import SMESH -import StdMeshers +import smesh -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) + +# ---- GEOM box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) idbox = geompy.addToStudy(box, "box") @@ -36,35 +35,34 @@ box = salome.IDToObject(idbox) face = salome.IDToObject(idface) -hyp1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") -hyp1.SetNumberOfSegments(10) -hyp2 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hyp2.SetMaxElementArea(10) -hyp3 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") -hyp3.SetMaxElementArea(100) - -algo1 = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") -algo2 = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") - -mesh = smesh.CreateMesh(box) -mesh.AddHypothesis(box,hyp1) -mesh.AddHypothesis(box,hyp2) -mesh.AddHypothesis(box,algo1) -mesh.AddHypothesis(box,algo2) - -submesh = mesh.GetSubMesh(face, "SubMeshFace") -mesh.AddHypothesis(face,hyp1) -mesh.AddHypothesis(face,hyp3) -mesh.AddHypothesis(face,algo1) -mesh.AddHypothesis(face,algo2) +# ---- SMESH + +mesh = smesh.Mesh(box, "Meshbox") + +# Set 1D algorithm/hypotheses to mesh +algo1 = mesh.Segment() +algo1.NumberOfSegments(10) + +# Set 2D algorithm/hypotheses to mesh +algo2 = mesh.Triangle(smesh.MEFISTO) +algo2.MaxElementArea(10) + +# Create submesh on face +algo3 = mesh.Segment(face) +algo3.NumberOfSegments(10) +algo4 = mesh.Triangle(smesh.MEFISTO, face) +algo4.MaxElementArea(100) +submesh = algo4.GetSubMesh() +smesh.SetName(submesh, "SubMeshFace") + -smesh.Compute(mesh,box) +mesh.Compute() -faces = submesh.GetElementsByType(SMESH.FACE) +faces = submesh.GetElementsByType(smesh.FACE) if len(faces) > 1: print len(faces), len(faces)/2 - group1 = mesh.CreateGroup(SMESH.FACE,"Group of faces") - group2 = mesh.CreateGroup(SMESH.FACE,"Another group of faces") + group1 = mesh.CreateEmptyGroup(smesh.FACE,"Group of faces") + group2 = mesh.CreateEmptyGroup(smesh.FACE,"Another group of faces") group1.Add(faces[:int(len(faces)/2)]) group2.Add(faces[int(len(faces)/2):]) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test5.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test5.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -c -u -r1.7 -r1.7.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test5.py 1 Jun 2006 11:39:17 -0000 1.7 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/SMESH_test5.py 20 Oct 2006 12:02:42 -0000 1.7.2.1 @@ -19,11 +19,11 @@ # # # -# File : SMESH_test1.py +# File : SMESH_test5.py # Module : SMESH import salome -import SMESH +import smesh import SALOMEDS import CORBA import os @@ -43,26 +43,21 @@ for iMesh in range(len(aMeshes)) : aMesh = aMeshes[iMesh] - anSObj = salome.ObjectToSObject(aMesh) - print anSObj.GetName(), + print aMesh.GetName(), aFileName = anInitFileName aFileName = os.path.basename(aFileName) - SetSObjName(anSObj,aFileName) - print anSObj.GetName() + aMesh.SetName(aFileName) + print aMesh.GetName() aOutPath = '/tmp/' aFileName = aOutPath + theFile + "." + str(iMesh) + ".unv" aMesh.ExportUNV(aFileName) aMesh = smesh.CreateMeshesFromUNV(aFileName) - anSObj = salome.ObjectToSObject(aMesh) - print anSObj.GetName(), + print aMesh.GetName(), os.remove(aFileName) aFileName = os.path.basename(aFileName) - SetSObjName(anSObj,aFileName) - print anSObj.GetName() - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) + aMesh.SetName(aFileName) + print aMesh.GetName() aPath = os.getenv('DATA_DIR') + '/MedFiles/' aListDir = os.listdir(aPath) Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/batchmode_mefisto.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/batchmode_mefisto.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -c -u -r1.5 -r1.5.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/batchmode_mefisto.py 1 Jun 2006 11:39:17 -0000 1.5 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/batchmode_mefisto.py 20 Oct 2006 12:02:42 -0000 1.5.2.1 @@ -49,44 +49,44 @@ # ---- SMESH + print "-------------------------- create mesh" + mesh = smesh.Mesh(shape_mesh) print "-------------------------- create Hypothesis" if (len is not None): print "-------------------------- LocalLength" - hypLength1 = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so") - hypLength1.SetLength(len) + algoReg = mesh.Segment() + hypLength1 = algoReg.LocalLength(len) print "Hypothesis type : ", hypLength1.GetName() print "Hypothesis ID : ", hypLength1.GetId() print "Hypothesis Value: ", hypLength1.GetLength() if (nbseg is not None): print "-------------------------- NumberOfSegments" - hypNbSeg1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") - hypNbSeg1.SetNumberOfSegments(nbseg) + algoReg = mesh.Segment() + hypNbSeg1 = algoReg.NumberOfSegments(nbseg) print "Hypothesis type : ", hypNbSeg1.GetName() print "Hypothesis ID : ", hypNbSeg1.GetId() print "Hypothesis Value: ", hypNbSeg1.GetNumberOfSegments() if (area == "LengthFromEdges"): print "-------------------------- LengthFromEdges" - hypLengthFromEdges = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so") - hypLengthFromEdges.SetMode(1) + algoMef = mesh.Triangle() + hypLengthFromEdges = algoMef.LengthFromEdges(1) print "Hypothesis type : ", hypLengthFromEdges.GetName() print "Hypothesis ID : ", hypLengthFromEdges.GetId() print "LengthFromEdges Mode: ", hypLengthFromEdges.GetMode() else: print "-------------------------- MaxElementArea" - hypArea1 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") - hypArea1.SetMaxElementArea(area) + algoMef = mesh.Triangle() + hypArea1 = algoMef.MaxElementArea(area) print "Hypothesis type : ", hypArea1.GetName() print "Hypothesis ID : ", hypArea1.GetId() print "Hypothesis Value: ", hypArea1.GetMaxElementArea() print "-------------------------- Regular_1D" - algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") - listHyp = algoReg.GetCompatibleHypothesis() for hyp in listHyp: print hyp @@ -95,8 +95,6 @@ print "Algo ID : ", algoReg.GetId() print "-------------------------- MEFISTO_2D" - algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") - listHyp = algoMef.GetCompatibleHypothesis() for hyp in listHyp: print hyp @@ -107,38 +105,8 @@ # ---- add hypothesis to shape - print "-------------------------- add hypothesis to shape" - mesh = smesh.CreateMesh(shape_mesh) - - ret = mesh.AddHypothesis(shape_mesh, algoReg) - print "Add Regular_1D algo .... ", - print ret - - if (nbseg is not None): - ret = mesh.AddHypothesis(shape_mesh, hypNbSeg1) - print "Add Number Of Segements algo .... ", - print ret - - if (len is not None): - ret = mesh.AddHypothesis(shape_mesh,hypLength1) - print "Add Local Length algo .... ", - print ret - - ret = mesh.AddHypothesis(shape_mesh, algoMef) - print "Add MEFISTO_2D algo....", - print ret - - if (area == "LengthFromEdges"): - ret = mesh.AddHypothesis( shape_mesh, hypLengthFromEdges) # length from edge - print "Add Length From Edges algo .... ", - print ret - else: - ret = mesh.AddHypothesis(shape_mesh, hypArea1) - print "Add Max Triangle Area algo .... ", - print ret - print "-------------------------- compute mesh" - ret = smesh.Compute(mesh,shape_mesh) + ret = mesh.Compute() print "Compute Mesh .... ", print ret log = mesh.GetLog(0); # no erase trace Index: SMESH_SRC_3.2.2/src/SMESH_SWIG/smesh.py =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/SMESH_SWIG/smesh.py,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -c -u -r1.14 -r1.14.2.1 --- SMESH_SRC_3.2.2/src/SMESH_SWIG/smesh.py 1 Jun 2006 11:39:17 -0000 1.14 +++ SMESH_SRC_3.2.2/src/SMESH_SWIG/smesh.py 20 Oct 2006 12:16:44 -0000 1.14.2.1 @@ -1,26 +1,3 @@ -# Copyright (C) 2005 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 : smesh.py -# Author : Francis KLOSS, OCC -# Module : SMESH - """ \namespace smesh \brief Module smesh @@ -30,20 +7,44 @@ import geompy import StdMeshers import SMESH +from SMESH import * - +## Types of algo REGULAR = 1 PYTHON = 2 -NETGEN = 3 -GHS3D = 4 +MEFISTO = 3 +NETGEN = 4 +GHS3D = 5 +FULL_NETGEN = 6 + +## MirrorType enumeration +POINT = SMESH_MeshEditor.POINT +AXIS = SMESH_MeshEditor.AXIS +PLANE = SMESH_MeshEditor.PLANE + +## Smooth_Method enumeration +LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH +CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH + +## Fineness enumeration(for NETGEN) +VeryCoarse = 0 +Coarse = 1 +Moderate = 2 +Fine = 3 +VeryFine = 4 +Custom = 5 + + +NO_NAME = "NoName" + smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") smesh.SetCurrentStudy(salome.myStudy) +## Global functions -NO_NAME = "NoName" - +## Gets object name def GetName(obj): ior = salome.orb.object_to_string(obj) sobj = salome.myStudy.FindObjectIOR(ior) @@ -53,13 +54,205 @@ attr = sobj.FindAttribute("AttributeName")[1] return attr.Value() +## Sets name to object def SetName(obj, name): ior = salome.orb.object_to_string(obj) sobj = salome.myStudy.FindObjectIOR(ior) if not sobj is None: attr = sobj.FindAttribute("AttributeName")[1] attr.SetValue(name) + +## Returns long value from enumeration +# Uses for FT_... enumeration +def EnumToLong(theItem): + return theItem._v + +## Get PointStruct from vertex +# @param theVertex is GEOM object(vertex) +# @return SMESH.PointStruct +def GetPointStruct(theVertex): + [x, y, z] = geompy.PointCoordinates(theVertex) + return PointStruct(x,y,z) + +## Get DirStruct from vector +# @param theVector is GEOM object(vector) +# @return SMESH.DirStruct +def GetDirStruct(theVector): + vertices = geompy.SubShapeAll( theVector, geompy.ShapeType["VERTEX"] ) + if(len(vertices) != 2): + print "Error: vector object is incorrect." + return None + p1 = geompy.PointCoordinates(vertices[0]) + p2 = geompy.PointCoordinates(vertices[1]) + pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2]) + dir = DirStruct(pnt) + return dir + +## Get AxisStruct from object +# @param theObj is GEOM object(line or plane) +# @return SMESH.AxisStruct +def GetAxisStruct(theObj): + edges = geompy.SubShapeAll( theObj, geompy.ShapeType["EDGE"] ) + if len(edges) > 1: + vertex1, vertex2 = geompy.SubShapeAll( edges[0], geompy.ShapeType["VERTEX"] ) + vertex3, vertex4 = geompy.SubShapeAll( edges[1], geompy.ShapeType["VERTEX"] ) + vertex1 = geompy.PointCoordinates(vertex1) + vertex2 = geompy.PointCoordinates(vertex2) + vertex3 = geompy.PointCoordinates(vertex3) + vertex4 = geompy.PointCoordinates(vertex4) + v1 = [vertex2[0]-vertex1[0], vertex2[1]-vertex1[1], vertex2[2]-vertex1[2]] + v2 = [vertex4[0]-vertex3[0], vertex4[1]-vertex3[1], vertex4[2]-vertex3[2]] + normal = [ v1[1]*v2[2]-v2[1]*v1[2], v1[2]*v2[0]-v2[2]*v1[0], v1[0]*v2[1]-v2[0]*v1[1] ] + axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2]) + return axis + elif len(edges) == 1: + vertex1, vertex2 = geompy.SubShapeAll( edges[0], geompy.ShapeType["VERTEX"] ) + p1 = geompy.PointCoordinates( vertex1 ) + p2 = geompy.PointCoordinates( vertex2 ) + axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2]) + return axis + return None + +## From SMESH_Gen interface: +# ------------------------ + +## Set the current mode +def SetEmbeddedMode( theMode ): + smesh.SetEmbeddedMode(theMode) + +## Get the current mode +def IsEmbeddedMode(): + return smesh.IsEmbeddedMode() + +## Set the current study +def SetCurrentStudy( theStudy ): + smesh.SetCurrentStudy(theStudy) + +## Get the current study +def GetCurrentStudy(): + return smesh.GetCurrentStudy() + +## Create Mesh object importing data from given UNV file +# @return an instance of Mesh class +def CreateMeshesFromUNV( theFileName ): + aSmeshMesh = smesh.CreateMeshesFromUNV(theFileName) + aMesh = Mesh(aSmeshMesh) + return aMesh + +## Create Mesh object(s) importing data from given MED file +# @return a list of Mesh class instances +def CreateMeshesFromMED( theFileName ): + aSmeshMeshes, aStatus = smesh.CreateMeshesFromMED(theFileName) + aMeshes = [] + for iMesh in range(len(aSmeshMeshes)) : + aMesh = Mesh(aSmeshMeshes[iMesh]) + aMeshes.append(aMesh) + return aMeshes, aStatus + +## Create Mesh object importing data from given STL file +# @return an instance of Mesh class +def CreateMeshesFromSTL( theFileName ): + aSmeshMesh = smesh.CreateMeshesFromSTL(theFileName) + aMesh = Mesh(aSmeshMesh) + return aMesh + +## From SMESH_Gen interface +def GetSubShapesId( theMainObject, theListOfSubObjects ): + return smesh.GetSubShapesId(theMainObject, theListOfSubObjects) + + +## Filtering. Auxiliary functions: +# ------------------------------ + +## Creates an empty criterion +# @return SMESH.Filter.Criterion +def GetEmptyCriterion(): + Type = EnumToLong(FT_Undefined) + Compare = EnumToLong(FT_Undefined) + Threshold = 0 + ThresholdStr = "" + ThresholdID = "" + UnaryOp = EnumToLong(FT_Undefined) + BinaryOp = EnumToLong(FT_Undefined) + Tolerance = 1e-07 + TypeOfElement = ALL + Precision = -1 ##@1e-07 + return Filter.Criterion(Type, Compare, Threshold, ThresholdStr, ThresholdID, + UnaryOp, BinaryOp, Tolerance, TypeOfElement, Precision) + +## Creates a criterion by given parameters +# @param elementType is the type of elements(NODE, EDGE, FACE, VOLUME) +# @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) +# @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo} +# @param Treshold is threshold value (range of ids as string, shape, numeric) +# @param UnaryOp is FT_LogicalNOT or FT_Undefined +# @param BinaryOp is binary logical operation FT_LogicalAND, FT_LogicalOR or +# FT_Undefined(must be for the last criterion in criteria) +# @return SMESH.Filter.Criterion +def GetCriterion(elementType, + CritType, + Compare = FT_EqualTo, + Treshold="", + UnaryOp=FT_Undefined, + BinaryOp=FT_Undefined): + aCriterion = GetEmptyCriterion() + aCriterion.TypeOfElement = elementType + aCriterion.Type = EnumToLong(CritType) + + aTreshold = Treshold + + if Compare in [FT_LessThan, FT_MoreThan, FT_EqualTo]: + aCriterion.Compare = EnumToLong(Compare) + else: + aCriterion.Compare = EnumToLong(FT_EqualTo) + aTreshold = Compare + if CritType in [FT_BelongToGeom, FT_BelongToPlane, + FT_BelongToCylinder, FT_LyingOnGeom]: + # Check treshold + if isinstance(aTreshold, geompy.GEOM._objref_GEOM_Object): + aCriterion.ThresholdStr = GetName(aTreshold) + aCriterion.ThresholdID = salome.ObjectToID(aTreshold) + else: + print "Error: Treshold should be a shape." + return None + elif CritType == FT_RangeOfIds: + # Check treshold + if isinstance(aTreshold, str): + aCriterion.ThresholdStr = aTreshold + else: + print "Error: Treshold should be a string." + return None + elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume]: + # Here we don't need treshold + if aTreshold == FT_LogicalNOT: + aCriterion.UnaryOp = EnumToLong(FT_LogicalNOT) + elif aTreshold in [FT_LogicalAND, FT_LogicalOR]: + aCriterion.BinaryOp = aTreshold + else: + # Check treshold + try: + aTreshold = float(aTreshold) + aCriterion.Threshold = aTreshold + except: + print "Error: Treshold should be a number." + return None + + if Treshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT: + aCriterion.UnaryOp = EnumToLong(FT_LogicalNOT) + + if Treshold in [FT_LogicalAND, FT_LogicalOR]: + aCriterion.BinaryOp = EnumToLong(Treshold) + + if UnaryOp in [FT_LogicalAND, FT_LogicalOR]: + aCriterion.BinaryOp = EnumToLong(UnaryOp) + + if BinaryOp in [FT_LogicalAND, FT_LogicalOR]: + aCriterion.BinaryOp = EnumToLong(BinaryOp) + + return aCriterion + + ## Mother class to define algorithm, recommended to don't use directly. # # More details. @@ -83,36 +276,55 @@ def GetAlgorithm(self): return self.algo + ## Get list of hypothesis that can be used with this algorithm + def GetCompatibleHypothesis(self): + list = [] + if self.algo: + list = self.algo.GetCompatibleHypothesis() + return list + + ## Get name of algo + def GetName(self): + GetName(self.algo) + + ## Set name to algo + def SetName(self, name): + SetName(self.algo, name) + + ## Get id of algo + def GetId(self): + return self.algo.GetId() + ## Private method. Print error message if a hypothesis was not assigned. def TreatHypoStatus(self, status, hypName, geomName, isAlgo): if isAlgo: hypType = "algorithm" else: hypType = "hypothesis" - if status == SMESH.HYP_UNKNOWN_FATAL : + if status == HYP_UNKNOWN_FATAL : reason = "for unknown reason" - elif status == SMESH.HYP_INCOMPATIBLE : + elif status == HYP_INCOMPATIBLE : reason = "this hypothesis mismatches algorithm" - elif status == SMESH.HYP_NOTCONFORM : + elif status == HYP_NOTCONFORM : reason = "not conform mesh would be built" - elif status == SMESH.HYP_ALREADY_EXIST : + elif status == HYP_ALREADY_EXIST : reason = hypType + " of the same dimension already assigned to this shape" - elif status == SMESH.HYP_BAD_DIM : + elif status == HYP_BAD_DIM : reason = hypType + " mismatches shape" - elif status == SMESH.HYP_CONCURENT : + elif status == HYP_CONCURENT : reason = "there are concurrent hypotheses on sub-shapes" - elif status == SMESH.HYP_BAD_SUBSHAPE : + elif status == HYP_BAD_SUBSHAPE : reason = "shape is neither the main one, nor its subshape, nor a valid group" else: return hypName = '"' + hypName + '"' geomName= '"' + geomName+ '"' - if status < SMESH.HYP_UNKNOWN_FATAL: + if status < HYP_UNKNOWN_FATAL: print hypName, "was assigned to", geomName,"but", reason else: print hypName, "was not assigned to",geomName,":", reason pass - + ## Private method. def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"): if geom is None: @@ -134,7 +346,7 @@ SetName(self.algo, name + "/" + hypo) status = mesh.mesh.AddHypothesis(self.geom, self.algo) self.TreatHypoStatus( status, hypo, name, 1 ) - + ## Private method def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"): hypo = smesh.CreateHypothesis(hyp, so) @@ -151,7 +363,7 @@ status = self.mesh.mesh.AddHypothesis(self.geom, hypo) self.TreatHypoStatus( status, hyp, name, 0 ) return hypo - + # Public class: Mesh_Segment # -------------------------- @@ -163,14 +375,14 @@ ## Private constructor. def __init__(self, mesh, geom=0): self.Create(mesh, geom, "Regular_1D") - + ## Define "LocalLength" hypothesis to cut an edge in several segments with the same length # @param l for the length of segments that cut an edge def LocalLength(self, l): hyp = self.Hypothesis("LocalLength", [l]) hyp.SetLength(l) return hyp - + ## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments # @param n for the number of segments that cut an edge # @param s for the scale factor (optional) @@ -183,7 +395,7 @@ hyp.SetScaleFactor(s) hyp.SetNumberOfSegments(n) return hyp - + ## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing # @param start for the length of the first segment # @param end for the length of the last segment @@ -192,7 +404,7 @@ hyp.SetLength(start, 1) hyp.SetLength(end , 0) return hyp - + ## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing # @param start for the length of the first segment # @param end for the length of the last segment @@ -201,14 +413,14 @@ hyp.SetLength(start, 1) hyp.SetLength(end , 0) return hyp - + ## Define "Deflection1D" hypothesis # @param d for the deflection def Deflection1D(self, d): hyp = self.Hypothesis("Deflection1D", [d]) hyp.SetDeflection(d) return hyp - + ## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in # the opposite side in the case of quadrangular faces def Propagation(self): @@ -243,7 +455,7 @@ def __init__(self, mesh, geom=0): import Python1dPlugin self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so") - + ## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality # @param n for the number of segments that cut an edge # @param func for the python function that calculate the length of all segments @@ -252,7 +464,7 @@ hyp.SetNumberOfSegments(n) hyp.SetPythonLog10RatioFunction(func) return hyp - + # Public class: Mesh_Triangle # --------------------------- @@ -261,21 +473,97 @@ # More details. class Mesh_Triangle(Mesh_Algorithm): + algoType = 0 + params = 0 + ## Private constructor. - def __init__(self, mesh, geom=0): - self.Create(mesh, geom, "MEFISTO_2D") + def __init__(self, mesh, algoType, geom=0): + if algoType == MEFISTO: + self.Create(mesh, geom, "MEFISTO_2D") + elif algoType == NETGEN: + self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so") + self.algoType = algoType ## Define "MaxElementArea" hypothesis to give the maximun area of each triangles # @param area for the maximum area of each triangles def MaxElementArea(self, area): - hyp = self.Hypothesis("MaxElementArea", [area]) - hyp.SetMaxElementArea(area) - return hyp - + if self.algoType == MEFISTO: + hyp = self.Hypothesis("MaxElementArea", [area]) + hyp.SetMaxElementArea(area) + return hyp + elif self.algoType == NETGEN: + print "Netgen 1D-2D algo doesn't support this hypothesis" + return None + ## Define "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire def LengthFromEdges(self): - return self.Hypothesis("LengthFromEdges") - + if self.algoType == MEFISTO: + hyp = self.Hypothesis("LengthFromEdges") + return hyp + elif self.algoType == NETGEN: + print "Netgen 1D-2D algo doesn't support this hypothesis" + return None + + ## Define "Netgen 2D Parameters" hypothesis + def Parameters(self): + if self.algoType == NETGEN: + self.params = self.Hypothesis("NETGEN_Parameters_2D", [], "libNETGENEngine.so") + return self.params + elif self.algoType == MEFISTO: + print "Mefisto algo doesn't support this hypothesis" + return None + + ## Set MaxSize + def SetMaxSize(self, theSize): + if self.params == 0: + self.Parameters() + self.params.SetMaxSize(theSize) + + ## Set SecondOrder flag + def SetSecondOrder(seld, theVal): + if self.params == 0: + self.Parameters() + self.params.SetSecondOrder(theVal) + + ## Set Optimize flag + def SetOptimize(self, theVal): + if self.params == 0: + self.Parameters() + self.params.SetOptimize(theVal) + + ## Set Fineness + # @param theFineness is: + # VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom + def SetFineness(self, theFineness): + if self.params == 0: + self.Parameters() + self.params.SetFineness(theFineness) + + ## Set GrowthRate + def SetGrowthRate(self, theRate): + if self.params == 0: + self.Parameters() + self.params.SetGrowthRate(theRate) + + ## Set NbSegPerEdge + def SetNbSegPerEdge(self, theVal): + if self.params == 0: + self.Parameters() + self.params.SetNbSegPerEdge(theVal) + + ## Set NbSegPerRadius + def SetNbSegPerRadius(self, theVal): + if self.params == 0: + self.Parameters() + self.params.SetNbSegPerRadius(theVal) + + ## Set QuadAllowed flag + def SetQuadAllowed(self, toAllow): + if self.params == 0: + self.Parameters() + self.params.SetQuadAllowed(toAllow) + + # Public class: Mesh_Quadrangle # ----------------------------- @@ -287,14 +575,14 @@ ## Private constructor. def __init__(self, mesh, geom=0): self.Create(mesh, geom, "Quadrangle_2D") - + ## Define "QuadranglePreference" hypothesis, forcing construction # of quadrangles if the number of nodes on opposite edges is not the same # in the case where the global number of nodes on edges is even def QuadranglePreference(self): hyp = self.Hypothesis("QuadranglePreference") return hyp - + # Public class: Mesh_Tetrahedron # ------------------------------ @@ -303,13 +591,19 @@ # More details. class Mesh_Tetrahedron(Mesh_Algorithm): + params = 0 + algoType = 0 + ## Private constructor. - def __init__(self, mesh, algo, geom=0): - if algo == NETGEN: + def __init__(self, mesh, algoType, geom=0): + if algoType == NETGEN: self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so") - elif algo == GHS3D: + elif algoType == GHS3D: import GHS3DPlugin self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so") + elif algoType == FULL_NETGEN: + self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so") + self.algoType = algoType ## Define "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedral # @param vol for the maximum volume of each tetrahedral @@ -318,6 +612,59 @@ hyp.SetMaxElementVolume(vol) return hyp + ## Define "Netgen 3D Parameters" hypothesis + def Parameters(self): + if (self.algoType == FULL_NETGEN): + self.params = self.Hypothesis("NETGEN_Parameters", [], "libNETGENEngine.so") + return self.params + else: + print "Algo doesn't support this hypothesis" + return None + + ## Set MaxSize + def SetMaxSize(self, theSize): + if self.params == 0: + self.Parameters() + self.params.SetMaxSize(theSize) + + ## Set SecondOrder flag + def SetSecondOrder(self, theVal): + if self.params == 0: + self.Parameters() + self.params.SetSecondOrder(theVal) + + ## Set Optimize flag + def SetOptimize(self, theVal): + if self.params == 0: + self.Parameters() + self.params.SetOptimize(theVal) + + ## Set Fineness + # @param theFineness is: + # VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom + def SetFineness(self, theFineness): + if self.params == 0: + self.Parameters() + self.params.SetFineness(theFineness) + + ## Set GrowthRate + def SetGrowthRate(self, theRate): + if self.params == 0: + self.Parameters() + self.params.SetGrowthRate(theRate) + + ## Set NbSegPerEdge + def SetNbSegPerEdge(self, theVal): + if self.params == 0: + self.Parameters() + self.params.SetNbSegPerEdge(theVal) + + ## Set NbSegPerRadius + def SetNbSegPerRadius(self, theVal): + if self.params == 0: + self.Parameters() + self.params.SetNbSegPerRadius(theVal) + # Public class: Mesh_Hexahedron # ------------------------------ @@ -330,6 +677,7 @@ def __init__(self, mesh, geom=0): self.Create(mesh, geom, "Hexa_3D") +# Deprecated, only for compatibility! # Public class: Mesh_Netgen # ------------------------------ @@ -356,40 +704,104 @@ else: hyp = self.Hypothesis("NETGEN_Parameters_2D", [], "libNETGENEngine.so") return hyp - + # Public class: Mesh # ================== ## Class to define a mesh # +# The class contains mesh shape, SMESH_Mesh, SMESH_MeshEditor # More details. class Mesh: geom = 0 mesh = 0 + editor = 0 ## Constructor # - # Creates mesh on the shape \a geom, + # Creates mesh on the shape \a geom(or the empty mesh if geom equal to 0), # sets GUI name of this mesh to \a name. - # @param geom Shape to be meshed + # @param obj Shape to be meshed or SMESH_Mesh object # @param name Study name of the mesh - def __init__(self, geom, name=0): - self.geom = geom - self.mesh = smesh.CreateMesh(geom) - if name == 0: - SetName(self.mesh, GetName(geom)) + def __init__(self, obj=0, name=0): + if obj != 0: + if isinstance(obj, geompy.GEOM._objref_GEOM_Object): + self.geom = obj + self.mesh = smesh.CreateMesh(self.geom) + elif isinstance(obj, SMESH._objref_SMESH_Mesh): + self.SetMesh(obj) else: + self.mesh = smesh.CreateEmptyMesh() + if name != 0: SetName(self.mesh, name) + elif obj != 0: + SetName(self.mesh, GetName(obj)) + self.editor = self.mesh.GetMeshEditor() + + ## Method that inits the Mesh object from 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 + # @return SMESH_Mesh object def GetMesh(self): return self.mesh + ## Get mesh name + def GetName(self): + name = GetName(self.GetMesh()) + return name + + ## Set name to 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. + # SubMesh will be used instead of SubShape in a next idl version to + # adress a specific subMesh... + def GetSubMesh(self, theSubObject, name): + submesh = self.mesh.GetSubMesh(theSubObject, name) + return submesh + ## Method that returns the shape associated to the mesh + # @return GEOM_Object def GetShape(self): return self.geom + ## Method that associates given shape to the mesh(entails the mesh recreation) + # @param geom shape to be meshed(GEOM_Object) + def SetShape(self, geom): + self.mesh = smesh.CreateMesh(geom) + + ## Return true if hypotheses are defined well + # @param theMesh is an instance of Mesh class + # @param theSubObject subshape of a mesh shape + def IsReadyToCompute(self, theSubObject): + return smesh.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 + # @param theSubObject subshape of a mesh shape + # @return a list of errors + def GetAlgoState(self, theSubObject): + return smesh.GetAlgoState(self.mesh, theSubObject) + + ## 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 smesh.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName ) + ## Returns mesh dimension depending on shape one def MeshDimension(self): shells = geompy.SubShapeAllIDs( self.geom, geompy.ShapeType["SHELL"] ) @@ -402,7 +814,7 @@ else: return 0; 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. @@ -420,14 +832,20 @@ return Mesh_Segment_Python(self, geom) else: return Mesh_Segment(self, geom) - + ## Creates a triangle 2D algorithm for faces. # 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 algo values are: smesh.MEFISTO or smesh.NETGEN # @param geom If defined, subshape to be meshed - def Triangle(self, geom=0): - return Mesh_Triangle(self, geom) - + def Triangle(self, algo=MEFISTO, geom=0): + ## if Triangle(geom) is called by mistake + if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)): + geom = algo + algo = MEFISTO + + 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. # Otherwise, this algorithm define a submesh based on \a geom subshape. @@ -439,15 +857,15 @@ # The parameter \a algo permits to choice the algorithm: NETGEN or GHS3D # 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 algo values are: smesh.NETGEN, smesh.GHS3D + # @param algo values are: smesh.NETGEN, smesh.GHS3D, smesh.FULL_NETGEN # @param geom If defined, subshape to be meshed - def Tetrahedron(self, algo, geom=0): + def Tetrahedron(self, algo=NETGEN, geom=0): ## if Tetrahedron(geom) is called by mistake if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)): algo, geom = geom, algo pass return Mesh_Tetrahedron(self, algo, geom) - + ## Creates a hexahedron 3D algorithm for solids. # If the optional \a geom parameter is not sets, this algorithm is global. # Otherwise, this algorithm define a submesh based on \a geom subshape. @@ -455,7 +873,8 @@ def Hexahedron(self, geom=0): return Mesh_Hexahedron(self, geom) - ## Creates a NETGEN-based 2D or 3D independent algorithm (i.e. needs no + ## Deprecated, only for compatibility! + # Creates a NETGEN-based 2D or 3D independent algorithm (i.e. needs no # discrete boundary). # If the optional \a geom parameter is not sets, this algorithm is global. # Otherwise, this algorithm defines a submesh based on \a geom subshape. @@ -463,12 +882,18 @@ # @param geom If defined, subshape to be meshed def Netgen(self, is3D, geom=0): return Mesh_Netgen(self, is3D, geom) - + ## Compute the mesh and return the status of the computation - def Compute(self): - ok = smesh.Compute(self.mesh, self.geom) + def Compute(self, geom=0): + if geom == 0 or not isinstance(geom, geompy.GEOM._objref_GEOM_Object): + if self.geom == 0: + print "Compute impossible: mesh is not constructed on geom shape." + return 0 + else: + geom = self.geom + ok = smesh.Compute(self.mesh, geom) if not ok: - errors = smesh.GetAlgoState( self.mesh, self.geom ) + errors = smesh.GetAlgoState( self.mesh, geom ) allReasons = "" for err in errors: if err.isGlobalAlgo: @@ -477,9 +902,9 @@ glob = " local " pass dim = str(err.algoDim) - if err.name == SMESH.MISSING_ALGO: + if err.name == MISSING_ALGO: reason = glob + dim + "D algorithm is missing" - elif err.name == SMESH.MISSING_HYPO: + elif err.name == MISSING_HYPO: name = '"' + err.algoName + '"' reason = glob + dim + "D algorithm " + name + " misses " + dim + "D hypothesis" else: @@ -517,7 +942,7 @@ self.Tetrahedron(NETGEN) pass return self.Compute() - + ## Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron # The parameter \a fineness [0.-1.] defines mesh fineness def AutomaticHexahedralization(self, fineness=0): @@ -532,7 +957,12 @@ self.Hexahedron() pass return self.Compute() - + + ## Get the list of hypothesis added on a geom + # @param geom is subhape of mesh geometry + def GetHypothesisList(self, geom): + return self.mesh.GetHypothesisList( geom ) + ## Removes all global hypotheses def RemoveGlobalHypotheses(self): current_hyps = self.mesh.GetHypothesisList( self.geom ) @@ -540,71 +970,949 @@ self.mesh.RemoveHypothesis( self.geom, hyp ) pass pass - + ## Create a mesh group based on geometric object \a grp # and give a \a name, if this parameter is not defined # the name is the same as the geometric group name + # Note: this function is obsolete. Works like GroupOnGeom(). # @param grp is a geometric group, a vertex, an edge, a face or a solid # @param name is the name of the mesh group + # @return SMESH_GroupOnGeom def Group(self, grp, name=""): - if name == "": - name = grp.GetName() - - type = [] - tgeo = str(grp.GetShapeType()) - if tgeo == "VERTEX": - type = SMESH.NODE - elif tgeo == "EDGE": - type = SMESH.EDGE - elif tgeo == "FACE": - type = SMESH.FACE - elif tgeo == "SOLID": - type = SMESH.VOLUME - elif tgeo == "SHELL": - type = SMESH.VOLUME - elif tgeo == "COMPOUND": - if len( geompy.GetObjectIDs( grp )) == 0: - print "Mesh.Group: empty geometric group", GetName( grp ) - return 0 - tgeo = geompy.GetType(grp) - if tgeo == geompy.ShapeType["VERTEX"]: - type = SMESH.NODE - elif tgeo == geompy.ShapeType["EDGE"]: - type = SMESH.EDGE - elif tgeo == geompy.ShapeType["FACE"]: - type = SMESH.FACE - elif tgeo == geompy.ShapeType["SOLID"]: - type = SMESH.VOLUME - - if type == []: - print "Mesh.Group: bad first argument: expected a group, a vertex, an edge, a face or a solid" - return 0 - else: - return self.mesh.CreateGroupFromGEOM(type, name, grp) - - ## Export the mesh in a file with the MED format and choice the \a version of MED format + return self.GroupOnGeom(grp, name) + + ## Deprecated, only for compatibility! Please, use ExportMED() method instead. + # Export the mesh in a file with the MED format and choice the \a version of MED format # @param f is the file name # @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2 def ExportToMED(self, f, version, opt=0): self.mesh.ExportToMED(f, opt, version) - + ## Export the mesh in a file with the MED format # @param f is the file name - def ExportMED(self, f, opt=0): - self.mesh.ExportMED(f, opt) - + # @param auto_groups boolean parameter for creating/not creating + # the groups Group_On_All_Nodes, Group_On_All_Faces, ... ; + # the typical use is auto_groups=false. + # @param version MED format version(MED_V2_1 or MED_V2_2) + def ExportMED(self, f, auto_groups=0, version=MED_V2_2): + self.mesh.ExportToMED(f, auto_groups, version) + ## Export the mesh in a file with the DAT format # @param f is the file name def ExportDAT(self, f): self.mesh.ExportDAT(f) - + ## Export the mesh in a file with the UNV format # @param f is the file name def ExportUNV(self, f): self.mesh.ExportUNV(f) - + ## Export the mesh in a file with the STL format # @param f is the file name # @param ascii defined the kind of file contents def ExportSTL(self, f, ascii=1): self.mesh.ExportSTL(f, ascii) + + ################################################################################### + + ## Operations with groups + # ---------------------- + + ## Creates an empty mesh group + # @param elementType is the type of elements in the group + # @param name is the name of the mesh group + # @return SMESH_Group + def CreateEmptyGroup(self, elementType, name): + return self.mesh.CreateGroup(elementType, name) + + ## Creates a mesh group based on geometric object \a grp + # and give a \a name, if this parameter is not defined + # the name is the same as the geometric group name + # @param grp is a geometric group, a vertex, an edge, a face or a solid + # @param name is the name of the mesh group + # @return SMESH_GroupOnGeom + def GroupOnGeom(self, grp, name="", type=None): + if name == "": + name = grp.GetName() + + if type == None: + tgeo = str(grp.GetShapeType()) + if tgeo == "VERTEX": + type = NODE + elif tgeo == "EDGE": + type = EDGE + elif tgeo == "FACE": + type = FACE + elif tgeo == "SOLID": + type = VOLUME + elif tgeo == "SHELL": + type = VOLUME + elif tgeo == "COMPOUND": + if len( geompy.GetObjectIDs( grp )) == 0: + print "Mesh.Group: empty geometric group", GetName( grp ) + return 0 + tgeo = geompy.GetType(grp) + if tgeo == geompy.ShapeType["VERTEX"]: + type = NODE + elif tgeo == geompy.ShapeType["EDGE"]: + type = EDGE + elif tgeo == geompy.ShapeType["FACE"]: + type = FACE + elif tgeo == geompy.ShapeType["SOLID"]: + type = VOLUME + + if type == None: + print "Mesh.Group: bad first argument: expected a group, a vertex, an edge, a face or a solid" + return 0 + else: + return self.mesh.CreateGroupFromGEOM(type, name, grp) + + ## Create a mesh group by the given ids of elements + # @param groupName is the name of the mesh group + # @param elementType is the type of elements in the group + # @param elemIDs is the list of ids + # @return SMESH_Group + def MakeGroupByIds(self, groupName, elementType, elemIDs): + group = self.mesh.CreateGroup(elementType, groupName) + group.Add(elemIDs) + return group + + ## Create a mesh group by the given conditions + # @param groupName is the name of the mesh group + # @param elementType is the type of elements in the group + # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) + # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo} + # @param Treshold is threshold value (range of id ids as string, shape, numeric) + # @param UnaryOp is FT_LogicalNOT or FT_Undefined + # @return SMESH_Group + def MakeGroup(self, + groupName, + elementType, + CritType=FT_Undefined, + Compare=FT_EqualTo, + Treshold="", + UnaryOp=FT_Undefined): + aCriterion = GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined) + group = self.MakeGroupByCriterion(groupName, aCriterion) + return group + + ## Create a mesh group by the given criterion + # @param groupName is the name of the mesh group + # @param Criterion is the instance of Criterion class + # @return SMESH_Group + def MakeGroupByCriterion(self, groupName, Criterion): + aFilterMgr = smesh.CreateFilterManager() + aFilter = aFilterMgr.CreateFilter() + aCriteria = [] + aCriteria.append(Criterion) + aFilter.SetCriteria(aCriteria) + group = self.MakeGroupByFilter(groupName, aFilter) + return group + + ## Create a mesh group by the given criteria(list of criterions) + # @param groupName is the name of the mesh group + # @param Criteria is the list of criterions + # @return SMESH_Group + def MakeGroupByCriteria(self, groupName, theCriteria): + aFilterMgr = smesh.CreateFilterManager() + aFilter = aFilterMgr.CreateFilter() + aFilter.SetCriteria(theCriteria) + group = self.MakeGroupByFilter(groupName, aFilter) + return group + + ## Create a mesh group by the given filter + # @param groupName is the name of the mesh group + # @param Criterion is the instance of Filter class + # @return SMESH_Group + def MakeGroupByFilter(self, groupName, theFilter): + anIds = theFilter.GetElementsId(self.mesh) + anElemType = theFilter.GetElementType() + group = self.MakeGroupByIds(groupName, anElemType, anIds) + return group + + ## Creates filter by given parameters of criterion + # @param elementType is the type of elements in the group + # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) + # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo} + # @param Treshold is threshold value (range of id ids as string, shape, numeric) + # @param UnaryOp is FT_LogicalNOT or FT_Undefined + # @return SMESH_Filter + def GetFilter(self, + elementType, + CritType=FT_Undefined, + Compare=FT_EqualTo, + Treshold="", + UnaryOp=FT_Undefined): + aCriterion = GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined) + aFilterMgr = smesh.CreateFilterManager() + aFilter = aFilterMgr.CreateFilter() + aCriteria = [] + aCriteria.append(aCriterion) + aFilter.SetCriteria(aCriteria) + return aFilter + + ## Remove a group + def RemoveGroup(self, group): + self.mesh.RemoveGroup(group) + + ## Remove group with its contents + def RemoveGroupWithContents(self, group): + self.mesh.RemoveGroupWithContents(group) + + ## Get the list of groups existing in the mesh + def GetGroups(self): + return self.mesh.GetGroups() + + ## Get the list of names of groups existing in the mesh + def GetGroupNames(self): + groups = self.GetGroups() + names = [] + for group in groups: + names.append(group.GetName()) + return names + + ## Union of two groups + # New group is created. All mesh elements that are + # present in initial groups are added to the new one + 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. + 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 + def CutGroups(self, mainGroup, toolGroup, name): + return self.mesh.CutGroups(mainGroup, toolGroup, name) + + + ## Get some info about mesh: + # ------------------------ + + ## Get the log of nodes and elements added or removed since previous + # clear of the log. + # @param clearAfterGet log is emptied after Get (safe if concurrents access) + # @return list of log_block structures: + # commandType + # number + # coords + # indexes + def GetLog(self, clearAfterGet): + return self.mesh.GetLog(clearAfterGet) + + ## Clear the log of nodes and elements added or removed since previous + # clear. Must be used immediately after GetLog if clearAfterGet is false. + def ClearLog(self): + self.mesh.ClearLog() + + ## Get the internal Id + def GetId(self): + return self.mesh.GetId() + + ## Get the study Id + def GetStudyId(self): + return self.mesh.GetStudyId() + + ## Check group names for duplications. + # Consider maximum group name length stored in MED file. + def HasDuplicatedGroupNamesMED(self): + return self.mesh.GetStudyId() + + ## Obtain instance of SMESH_MeshEditor + def GetMeshEditor(self): + return self.mesh.GetMeshEditor() + + ## Get MED Mesh + def GetMEDMesh(self): + return self.mesh.GetMEDMesh() + + + ## Get informations about mesh contents: + # ------------------------------------ + + ## Returns number of nodes in mesh + def NbNodes(self): + return self.mesh.NbNodes() + + ## Returns number of elements in mesh + def NbElements(self): + return self.mesh.NbElements() + + ## Returns number of edges in mesh + 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 + def NbEdgesOfOrder(self, elementOrder): + return self.mesh.NbEdgesOfOrder(elementOrder) + + ## Returns number of faces in mesh + 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 + def NbFacesOfOrder(self, elementOrder): + return self.mesh.NbFacesOfOrder(elementOrder) + + ## Returns number of triangles in mesh + 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 + def NbTrianglesOfOrder(self, elementOrder): + return self.mesh.NbTrianglesOfOrder(elementOrder) + + ## Returns number of quadrangles in mesh + 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 + def NbQuadranglesOfOrder(self, elementOrder): + return self.mesh.NbQuadranglesOfOrder(elementOrder) + + ## Returns number of polygons in mesh + def NbPolygons(self): + return self.mesh.NbPolygons() + + ## Returns number of volumes in mesh + 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 + def NbVolumesOfOrder(self, elementOrder): + return self.mesh.NbVolumesOfOrder(elementOrder) + + ## Returns number of tetrahedrons in mesh + 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 + def NbTetrasOfOrder(self, elementOrder): + return self.mesh.NbTetrasOfOrder(elementOrder) + + ## Returns number of hexahedrons in mesh + 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 + def NbHexasOfOrder(self, elementOrder): + return self.mesh.NbHexasOfOrder(elementOrder) + + ## Returns number of pyramids in mesh + 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 + def NbPyramidsOfOrder(self, elementOrder): + return self.mesh.NbPyramidsOfOrder(elementOrder) + + ## Returns number of prisms in mesh + 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 + def NbPrismsOfOrder(self, elementOrder): + return self.mesh.NbPrismsOfOrder(elementOrder) + + ## Returns number of polyhedrons in mesh + def NbPolyhedrons(self): + return self.mesh.NbPolyhedrons() + + ## Returns number of submeshes in mesh + def NbSubMesh(self): + return self.mesh.NbSubMesh() + + ## Returns list of mesh elements ids + def GetElementsId(self): + return self.mesh.GetElementsId() + + ## Returns list of ids of mesh elements with given type + # @param elementType is required type of elements + def GetElementsByType(self, elementType): + return self.mesh.GetElementsByType(elementType) + + ## Returns list of mesh nodes ids + def GetNodesId(self): + return self.mesh.GetNodesId() + + ## Get informations about mesh elements: + # ------------------------------------ + + ## Returns type of mesh element + def GetElementType(self, id, iselem): + return self.mesh.GetElementType(id, iselem) + + ## Returns list of submesh elements ids + # @param shapeID is geom object(subshape) IOR + def GetSubMeshElementsId(self, shapeID): + return self.mesh.GetSubMeshElementsId(shapeID) + + ## Returns list of submesh nodes ids + # @param shapeID is geom object(subshape) IOR + def GetSubMeshNodesId(self, shapeID, all): + return self.mesh.GetSubMeshNodesId(shapeID, all) + + ## Returns list of ids of submesh elements with given type + # @param shapeID is geom object(subshape) IOR + def GetSubMeshElementType(self, shapeID): + return self.mesh.GetSubMeshElementType(shapeID) + + ## Get mesh description + def Dump(self): + return self.mesh.Dump() + + + ## Get information about nodes and elements of mesh by its ids: + # ----------------------------------------------------------- + + ## Get XYZ coordinates of node as list of double + # If there is not node for given ID - returns empty list + def GetNodeXYZ(self, id): + return self.mesh.GetNodeXYZ(id) + + ## For given node returns list of IDs of inverse elements + # If there is not node for given ID - returns empty list + def GetNodeInverseElements(self, id): + return self.mesh.GetNodeInverseElements(id) + + ## If given element is node returns IDs of shape from position + # else - return ID of result shape after Mesh.FindShape() + # If there is not element for given ID - returns -1 + def GetShapeID(self, id): + return self.mesh.GetShapeID(id) + + ## Returns number of nodes for given element + # If there is not element for given ID - returns -1 + def GetElemNbNodes(self, id): + return self.mesh.GetElemNbNodes(id) + + ## Returns ID of node by given index for given element + # If there is not element for given ID - returns -1 + # If there is not node for given index - returns -2 + def GetElemNode(self, id, index): + return self.mesh.GetElemNode(id, index) + + ## 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 + def IsMediumNodeOfAnyElem(self, nodeID, elementType): + return self.mesh.IsMediumNodeOfAnyElem(nodeID, elementType) + + ## Returns number of edges for given element + def ElemNbEdges(self, id): + return self.mesh.ElemNbEdges(id) + + ## Returns number of faces for given element + def ElemNbFaces(self, id): + return self.mesh.ElemNbFaces(id) + + ## Returns true if given element is polygon + def IsPoly(self, id): + return self.mesh.IsPoly(id) + + ## Returns true if given element is quadratic + def IsQuadratic(self, id): + return self.mesh.IsQuadratic(id) + + ## Returns XYZ coordinates of bary center for given element + # as list of double + # If there is not element for given ID - returns empty list + def BaryCenter(self, id): + return self.mesh.BaryCenter(id) + + + ## Mesh edition (SMESH_MeshEditor functionality): + # --------------------------------------------- + + ## Removes elements from mesh by ids + # @param IDsOfElements is list of ids of elements to remove + 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 + def RemoveNodes(self, IDsOfNodes): + return self.editor.RemoveNodes(IDsOfNodes) + + ## Add node to mesh by coordinates + def AddNode(self, x, y, z): + return self.editor.AddNode( x, y, z) + + + ## Create edge both similar and quadratic (this is determed + # 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. 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. + def AddEdge(self, IDsOfNodes): + return self.editor.AddEdge(IDsOfNodes) + + ## Create face both similar and quadratic (this is determed + # 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. 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. + def AddFace(self, IDsOfNodes): + return self.editor.AddFace(IDsOfNodes) + + ## Add polygonal face to mesh by list of nodes ids + def AddPolygonalFace(self, IdsOfNodes): + return self.editor.AddPolygonalFace(IdsOfNodes) + + ## Create volume both similar and quadratic (this is determed + # 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. 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. + def AddVolume(self, IDsOfNodes): + return self.editor.AddVolume(IDsOfNodes) + + ## Create volume of many faces, giving nodes for each face. + # @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. + def AddPolyhedralVolume (self, IdsOfNodes, Quantities): + return self.editor.AddPolyhedralVolume(IdsOfNodes, Quantities) + + ## Create volume of many faces, giving IDs of existing faces. + # @param IdsOfFaces List of face IDs for volume creation. + # + # Note: The created volume will refer only to nodes + # of the given faces, not to the faces itself. + def AddPolyhedralVolumeByFaces (self, IdsOfFaces): + return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces) + + ## Move node with given id + # @param NodeID id of the node + # @param x displacing along the X axis + # @param y displacing along the Y axis + # @param z displacing along the Z axis + def MoveNode(self, NodeID, x, y, z): + return self.editor.MoveNode(NodeID, x, y, z) + + ## Replace two neighbour triangles sharing Node1-Node2 link + # with ones built on the same 4 nodes but having other common link. + # @param NodeID1 first node id + # @param NodeID2 second node id + # @return false if proper faces not found + def InverseDiag(self, NodeID1, NodeID2): + return self.editor.InverseDiag(NodeID1, NodeID2) + + ## Replace two neighbour triangles sharing Node1-Node2 link + # with a quadrangle built on the same 4 nodes. + # @param NodeID1 first node id + # @param NodeID2 second node id + # @return false if proper faces not found + def DeleteDiag(self, NodeID1, NodeID2): + return self.editor.DeleteDiag(NodeID1, NodeID2) + + ## Reorient elements by ids + # @param IDsOfElements if undefined reorient all mesh elements + def Reorient(self, IDsOfElements=None): + if IDsOfElements == None: + IDsOfElements = self.GetElementsId() + return self.editor.Reorient(IDsOfElements) + + ## Reorient all elements of the object + # @param theObject is mesh, submesh or group + def ReorientObject(self, theObject): + return self.editor.ReorientObject(theObject) + + ## Fuse neighbour triangles into quadrangles. + # @param IDsOfElements The triangles to be fused, + # @param Criterion is used to choose a neighbour to fuse with. + # @param MaxAngle is a max angle between element normals at which fusion + # is still performed; theMaxAngle is mesured in radians. + # @return TRUE in case of success, FALSE otherwise. + def TriToQuad(self, IDsOfElements, Criterion, MaxAngle): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + return self.editor.TriToQuad(IDsOfElements, Criterion, MaxAngle) + + ## Fuse neighbour triangles of the object into quadrangles + # @param theObject is mesh, submesh or group + # @param Criterion is used to choose a neighbour to fuse with. + # @param MaxAngle is a max angle between element normals at which fusion + # is still performed; theMaxAngle is mesured in radians. + # @return TRUE in case of success, FALSE otherwise. + def TriToQuadObject (self, theObject, Criterion, MaxAngle): + return self.editor.TriToQuadObject(theObject, Criterion, MaxAngle) + + ## Split quadrangles into triangles. + # @param IDsOfElements the faces to be splitted. + # @param theCriterion is used to choose a diagonal for splitting. + # @param @return TRUE in case of success, FALSE otherwise. + def QuadToTri (self, IDsOfElements, Criterion): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + return self.editor.QuadToTri(IDsOfElements, Criterion) + + ## Split quadrangles into triangles. + # @param theObject object to taking list of elements from, is mesh, submesh or group + def QuadToTriObject (self, theObject, Criterion): + return self.editor.QuadToTriObject(theObject, Criterion) + + ## Split quadrangles into triangles. + # @param theElems The faces to be splitted + # @param the13Diag is used to choose a diagonal for splitting. + # @return TRUE in case of success, FALSE otherwise. + def SplitQuad (self, IDsOfElements, Diag13): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + return self.editor.SplitQuad(IDsOfElements, Diag13) + + ## Split quadrangles into triangles. + # @param theObject is object to taking list of elements from, is mesh, submesh or group + def SplitQuadObject (self, theObject, Diag13): + return self.editor.SplitQuadObject(theObject, Diag13) + + ## Find better splitting of the given quadrangle. + # @param IDOfQuad ID of the quadrangle to be splitted. + # @param Criterion is a criterion to choose a diagonal for splitting. + # @return 1 if 1-3 diagonal is better, 2 if 2-4 + # diagonal is better, 0 if error occurs. + def BestSplit (self, IDOfQuad, Criterion): + return self.editor.BestSplit(IDOfQuad, Criterion) + + ## Smooth elements + # @param IDsOfElements list if ids of elements to smooth + # @param IDsOfFixedNodes list of ids of fixed nodes. + # Note that nodes built on edges and boundary nodes are always fixed. + # @param MaxNbOfIterations maximum number of iterations + # @param MaxAspectRatio varies in range [1.0, inf] + # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + def Smooth(self, IDsOfElements, IDsOfFixedNodes, + MaxNbOfIterations, MaxAspectRatio, Method): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes, + MaxNbOfIterations, MaxAspectRatio, Method) + + ## Smooth elements belong to given object + # @param theObject object to smooth + # @param IDsOfFixedNodes list of ids of fixed nodes. + # Note that nodes built on edges and boundary nodes are always fixed. + # @param MaxNbOfIterations maximum number of iterations + # @param MaxAspectRatio varies in range [1.0, inf] + # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + def SmoothObject(self, theObject, IDsOfFixedNodes, + MaxNbOfIterations, MaxxAspectRatio, Method): + return self.editor.SmoothObject(theObject, IDsOfFixedNodes, + MaxNbOfIterations, MaxxAspectRatio, Method) + + ## Parametric smooth the given elements + # @param IDsOfElements list if ids of elements to smooth + # @param IDsOfFixedNodes list of ids of fixed nodes. + # Note that nodes built on edges and boundary nodes are always fixed. + # @param MaxNbOfIterations maximum number of iterations + # @param MaxAspectRatio varies in range [1.0, inf] + # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + def SmoothParametric(IDsOfElements, IDsOfFixedNodes, + MaxNbOfIterations, MaxAspectRatio, Method): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes, + MaxNbOfIterations, MaxAspectRatio, Method) + + ## Parametric smooth elements belong to given object + # @param theObject object to smooth + # @param IDsOfFixedNodes list of ids of fixed nodes. + # Note that nodes built on edges and boundary nodes are always fixed. + # @param MaxNbOfIterations maximum number of iterations + # @param MaxAspectRatio varies in range [1.0, inf] + # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + def SmoothParametricObject(self, theObject, IDsOfFixedNodes, + MaxNbOfIterations, MaxAspectRatio, Method): + return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes, + MaxNbOfIterations, MaxAspectRatio, Method) + + ## Converts all mesh to quadratic one, deletes old elements, replacing + # them with quadratic ones with the same id. + def ConvertToQuadratic(self, theForce3d): + self.editor.ConvertToQuadratic(theForce3d) + + ## Converts all mesh from quadratic to ordinary ones, + # deletes old quadratic elements, replacing + # them with ordinary mesh elements with the same id. + def ConvertFromQuadratic(self): + return self.editor.ConvertFromQuadratic() + + ## Renumber mesh nodes + def RenumberNodes(self): + self.editor.RenumberNodes() + + ## Renumber mesh elements + def RenumberElements(self): + self.editor.RenumberElements() + + ## Generate new elements by rotation of the elements around the axis + # @param IDsOfElements list of ids of elements to sweep + # @param Axix axis of rotation, AxisStruct or line(geom object) + # @param AngleInRadians angle of Rotation + # @param NbOfSteps number of steps + # @param Tolerance tolerance + def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + if ( isinstance( Axix, geompy.GEOM._objref_GEOM_Object)): + Axix = GetAxisStruct(Axix) + self.editor.RotationSweep(IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance) + + ## Generate new elements by rotation of the elements of object around the axis + # @param theObject object wich elements should be sweeped + # @param Axix axis of rotation, AxisStruct or line(geom object) + # @param AngleInRadians angle of Rotation + # @param NbOfSteps number of steps + # @param Tolerance tolerance + def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance): + if ( isinstance( Axix, geompy.GEOM._objref_GEOM_Object)): + Axix = GetAxisStruct(Axix) + self.editor.RotationSweepObject(theObject, Axix, AngleInRadians, NbOfSteps, Tolerance) + + ## Generate new elements by extrusion of the elements with given ids + # @param IDsOfElements list of elements ids for extrusion + # @param StepVector vector, defining the direction and value of extrusion + # @param NbOfSteps the number of steps + def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)): + StepVector = GetDirStruct(StepVector) + self.editor.ExtrusionSweep(IDsOfElements, StepVector, NbOfSteps) + + ## Generate new elements by extrusion of the elements with given ids + # @param IDsOfElements is ids of elements + # @param StepVector vector, defining the direction and value of extrusion + # @param NbOfSteps the number of steps + # @param ExtrFlags set flags for performing extrusion + # @param SewTolerance uses for comparing locations of nodes if flag + # EXTRUSION_FLAG_SEW is set + def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance): + if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)): + StepVector = GetDirStruct(StepVector) + self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance) + + ## Generate new elements by extrusion of the elements belong to object + # @param theObject object wich elements should be processed + # @param StepVector vector, defining the direction and value of extrusion + # @param NbOfSteps the number of steps + def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps): + if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)): + StepVector = GetDirStruct(StepVector) + self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps) + + ## Generate new elements by extrusion of the elements belong to object + # @param theObject object wich elements should be processed + # @param StepVector vector, defining the direction and value of extrusion + # @param NbOfSteps the number of steps + def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps): + if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)): + StepVector = GetDirStruct(StepVector) + self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps) + + ## Generate new elements by extrusion of the elements belong to object + # @param theObject object wich elements should be processed + # @param StepVector vector, defining the direction and value of extrusion + # @param NbOfSteps the number of steps + def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps): + if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)): + StepVector = GetDirStruct(StepVector) + self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps) + + ## Generate new elements by extrusion of the given elements + # A path of extrusion must be a meshed edge. + # @param IDsOfElements is ids of elements + # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion + # @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path + # @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion + # @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion + # @param Angles list of angles + # @param HasRefPoint allows to use base point + # @param RefPoint point around which the shape is rotated(the mass center of the shape by default). + # User can specify any point as the Base Point and the shape will be rotated with respect to this point. + def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart, + HasAngles, Angles, HasRefPoint, RefPoint): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + if ( isinstance( RefPoint, geompy.GEOM._objref_GEOM_Object)): + RefPoint = GetPointStruct(RefPoint) + return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh, PathShape, NodeStart, + HasAngles, Angles, HasRefPoint, RefPoint) + + ## Generate new elements by extrusion of the elements belong to object + # A path of extrusion must be a meshed edge. + # @param IDsOfElements is ids of elements + # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion + # @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path + # @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion + # @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion + # @param Angles list of angles + # @param HasRefPoint allows to use base point + # @param RefPoint point around which the shape is rotated(the mass center of the shape by default). + # User can specify any point as the Base Point and the shape will be rotated with respect to this point. + def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart, + HasAngles, Angles, HasRefPoint, RefPoint): + if ( isinstance( RefPoint, geompy.GEOM._objref_GEOM_Object)): + RefPoint = GetPointStruct(RefPoint) + return self.editor.ExtrusionAlongPathObject(theObject, PathMesh, PathShape, NodeStart, + HasAngles, Angles, HasRefPoint, RefPoint) + + ## Symmetrical copy of mesh elements + # @param IDsOfElements list of elements ids + # @param Mirror is AxisStruct or geom object(point, line, plane) + # @param theMirrorType is POINT, AXIS or PLANE + # 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) + def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)): + Mirror = GetAxisStruct(Mirror) + self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy) + + ## Symmetrical copy of object + # @param theObject mesh, submesh or group + # @param Mirror is AxisStruct or geom object(point, line, plane) + # @param theMirrorType is POINT, AXIS or PLANE + # 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) + def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0): + if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)): + Mirror = GetAxisStruct(Mirror) + self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy) + + ## Translates the elements + # @param IDsOfElements list of elements ids + # @param Vector direction of translation(DirStruct or vector) + # @param Copy allows to copy the translated elements + def Translate(self, IDsOfElements, Vector, Copy): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)): + Vector = GetDirStruct(Vector) + self.editor.Translate(IDsOfElements, Vector, Copy) + + ## Translates the object + # @param theObject object to translate(mesh, submesh, or group) + # @param Vector direction of translation(DirStruct or geom vector) + # @param Copy allows to copy the translated elements + def TranslateObject(self, theObject, Vector, Copy): + if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)): + Vector = GetDirStruct(Vector) + self.editor.TranslateObject(theObject, Vector, Copy) + + ## Rotates the elements + # @param IDsOfElements list of elements ids + # @param Axis axis of rotation(AxisStruct or geom line) + # @param AngleInRadians angle of rotation(in radians) + # @param Copy allows to copy the rotated elements + def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy): + if IDsOfElements == []: + IDsOfElements = self.GetElementsId() + if ( isinstance( Axis, geompy.GEOM._objref_GEOM_Object)): + Axis = GetAxisStruct(Axis) + self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy) + + ## Rotates the object + # @param theObject object to rotate(mesh, submesh, or group) + # @param Axis axis of rotation(AxisStruct or geom line) + # @param AngleInRadians angle of rotation(in radians) + # @param Copy allows to copy the rotated elements + def RotateObject (self, theObject, Axis, AngleInRadians, Copy): + self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy) + + ## Find group of nodes close to each other within Tolerance. + # @param Tolerance tolerance value + # @param list of group of nodes + def FindCoincidentNodes (self, Tolerance): + return self.editor.FindCoincidentNodes(Tolerance) + + ## Merge nodes + # @param list of group of nodes + def MergeNodes (self, GroupsOfNodes): + self.editor.MergeNodes(GroupsOfNodes) + + ## Remove all but one of elements built on the same nodes. + def MergeEqualElements(self): + self.editor.MergeEqualElements() + + ## Sew free borders + def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1, + FirstNodeID2, SecondNodeID2, LastNodeID2, + CreatePolygons, CreatePolyedrs): + return self.editor.SewFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1, + FirstNodeID2, SecondNodeID2, LastNodeID2, + CreatePolygons, CreatePolyedrs) + + ## Sew conform free borders + def SewConformFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1, + FirstNodeID2, SecondNodeID2): + return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1, + FirstNodeID2, SecondNodeID2) + + ## Sew border to side + def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, + FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs): + return self.editor.SewBorderToSide(FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, + FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs) + + ## Sew two sides of a mesh. Nodes belonging to Side1 are + # merged with nodes of elements of Side2. + # Number of elements in theSide1 and in theSide2 must be + # 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. + def SewSideElements (self, IDsOfSide1Elements, IDsOfSide2Elements, + NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, + NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge): + return self.editor.SewSideElements(IDsOfSide1Elements, IDsOfSide2Elements, + NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, + NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge) + + ## Set new nodes for given element. + # @param ide the element id + # @param newIDs nodes ids + # @return If number of nodes is not corresponded to type of element - returns false + def ChangeElemNodes(self, ide, newIDs): + return self.editor.ChangeElemNodes(ide, newIDs) + + ## If during last operation of MeshEditor some nodes were + # created this method returns list of it's IDs, if new nodes + # not created - returns empty list + def GetLastCreatedNodes(self): + return self.editor.GetLastCreatedNodes() + + ## If during last operation of MeshEditor some elements were + # created this method returns list of it's IDs, if new elements + # not creared - returns empty list + def GetLastCreatedElems(self): + return self.editor.GetLastCreatedElems() Index: SMESH_SRC_3.2.2/src/StdMeshers_I/Makefile.in =================================================================== RCS file: /home/server/cvs/SMESH/SMESH_SRC_3.2.2/src/StdMeshers_I/Makefile.in,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -c -u -r1.10 -r1.10.2.1 --- SMESH_SRC_3.2.2/src/StdMeshers_I/Makefile.in 1 Jun 2006 11:39:17 -0000 1.10 +++ SMESH_SRC_3.2.2/src/StdMeshers_I/Makefile.in 26 Sep 2006 08:21:46 -0000 1.10.2.1 @@ -85,7 +85,7 @@ SALOMEDS.idl SALOME_Exception.idl \ GEOM_Gen.idl MED.idl SALOMEDS_Attributes.idl \ SMESH_Gen.idl SMESH_Hypothesis.idl SMESH_Group.idl \ - SALOME_Comm.idl + SALOME_Comm.idl SALOME_Component.idl SALOME_GenericObj.idl SMESH_Mesh.idl # Executables targets BIN =