Salome HOME
Merge from V6_main 11/02/2013
authorvsr <vsr@opencascade.com>
Tue, 12 Feb 2013 14:37:44 +0000 (14:37 +0000)
committervsr <vsr@opencascade.com>
Tue, 12 Feb 2013 14:37:44 +0000 (14:37 +0000)
319 files changed:
configure.ac
doc/salome/Makefile.am
doc/salome/examples/3dmesh.py [new file with mode: 0644]
doc/salome/examples/Makefile.am [new file with mode: 0644]
doc/salome/examples/cartesian_algo.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex01.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex02.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex03.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex04.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex05.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex06.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex07.py [new file with mode: 0644]
doc/salome/examples/creating_meshes_ex08.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex01.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex02.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex03.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex04.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex05.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex06.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex07.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex08.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex09.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex10.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex11.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex12.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex13.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex14.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex15.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex16.py [new file with mode: 0644]
doc/salome/examples/defining_hypotheses_ex17.py [new file with mode: 0644]
doc/salome/examples/filters_ex01.py [new file with mode: 0644]
doc/salome/examples/filters_ex02.py [new file with mode: 0644]
doc/salome/examples/filters_ex03.py [new file with mode: 0644]
doc/salome/examples/filters_ex04.py [new file with mode: 0644]
doc/salome/examples/filters_ex05.py [new file with mode: 0644]
doc/salome/examples/filters_ex06.py [new file with mode: 0644]
doc/salome/examples/filters_ex07.py [new file with mode: 0644]
doc/salome/examples/filters_ex08.py [new file with mode: 0644]
doc/salome/examples/filters_ex09.py [new file with mode: 0644]
doc/salome/examples/filters_ex10.py [new file with mode: 0644]
doc/salome/examples/filters_ex11.py [new file with mode: 0644]
doc/salome/examples/filters_ex12.py [new file with mode: 0644]
doc/salome/examples/filters_ex13.py [new file with mode: 0644]
doc/salome/examples/filters_ex14.py [new file with mode: 0644]
doc/salome/examples/filters_ex15.py [new file with mode: 0644]
doc/salome/examples/filters_ex16.py [new file with mode: 0644]
doc/salome/examples/filters_ex17.py [new file with mode: 0644]
doc/salome/examples/filters_ex18.py [new file with mode: 0644]
doc/salome/examples/filters_ex19.py [new file with mode: 0644]
doc/salome/examples/filters_ex20.py [new file with mode: 0644]
doc/salome/examples/filters_ex21.py [new file with mode: 0644]
doc/salome/examples/filters_ex22.py [new file with mode: 0644]
doc/salome/examples/filters_ex23.py [new file with mode: 0644]
doc/salome/examples/filters_ex24.py [new file with mode: 0644]
doc/salome/examples/filters_ex25.py [new file with mode: 0644]
doc/salome/examples/filters_ex26.py [new file with mode: 0644]
doc/salome/examples/filters_ex27.py [new file with mode: 0644]
doc/salome/examples/filters_ex28.py [new file with mode: 0644]
doc/salome/examples/filters_ex29.py [new file with mode: 0644]
doc/salome/examples/filters_ex30.py [new file with mode: 0644]
doc/salome/examples/filters_ex31.py [new file with mode: 0644]
doc/salome/examples/filters_ex32.py [new file with mode: 0644]
doc/salome/examples/filters_ex33.py [new file with mode: 0644]
doc/salome/examples/filters_ex34.py [new file with mode: 0644]
doc/salome/examples/filters_ex35.py [new file with mode: 0644]
doc/salome/examples/filters_ex36.py [new file with mode: 0644]
doc/salome/examples/generate_flat_elements.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex01.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex02.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex03.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex04.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex05.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex06.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex07.py [new file with mode: 0644]
doc/salome/examples/grouping_elements_ex08.py [new file with mode: 0644]
doc/salome/examples/measurements_ex01.py [new file with mode: 0644]
doc/salome/examples/measurements_ex02.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex01.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex02.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex03.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex04.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex05.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex06.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex07.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex08.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex09.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex10.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex11.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex12.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex13.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex14.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex15.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex16.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex17.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex18.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex19.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex20.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex21.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex22.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex23.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex24.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex25.py [new file with mode: 0644]
doc/salome/examples/modifying_meshes_ex26.py [new file with mode: 0644]
doc/salome/examples/notebook_smesh.py [new file with mode: 0644]
doc/salome/examples/prism_3d_algo.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex01.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex02.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex03.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex04.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex05.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex06.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex07.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex08.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex09.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex10.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex11.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex12.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex13.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex14.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex15.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex16.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex17.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex18.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex19.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex20.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex21.py [new file with mode: 0644]
doc/salome/examples/quality_controls_ex22.py [new file with mode: 0644]
doc/salome/examples/testme.py [new file with mode: 0755]
doc/salome/examples/transforming_meshes_ex01.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex02.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex03.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex04.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex05.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex06.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex07.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex08.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex09.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex10.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex11.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex12.py [new file with mode: 0644]
doc/salome/examples/transforming_meshes_ex13.py [new file with mode: 0644]
doc/salome/examples/use_existing_faces.py [new file with mode: 0644]
doc/salome/examples/viewing_meshes_ex01.py [new file with mode: 0644]
doc/salome/examples/viewing_meshes_ex02.py [new file with mode: 0644]
doc/salome/gui/SMESH/doxyfile.in
doc/salome/gui/SMESH/images/addinfo_group.png
doc/salome/gui/SMESH/images/addinfo_mesh.png
doc/salome/gui/SMESH/images/addinfo_submesh.png
doc/salome/gui/SMESH/images/advanced_mesh_infos.png
doc/salome/gui/SMESH/images/eleminfo1.png
doc/salome/gui/SMESH/images/eleminfo2.png
doc/salome/gui/SMESH/images/pref21.png
doc/salome/gui/SMESH/images/prism_needs_hyps.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/prism_ok_ko.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/prism_stack.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/prism_tui_sample.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/scalar_bar_dlg.png
doc/salome/gui/SMESH/input/about_hypo.doc
doc/salome/gui/SMESH/input/about_meshes.doc
doc/salome/gui/SMESH/input/basic_meshing_algos.doc
doc/salome/gui/SMESH/input/constructing_submeshes.doc
doc/salome/gui/SMESH/input/extrusion.doc
doc/salome/gui/SMESH/input/mesh_infos.doc
doc/salome/gui/SMESH/input/mesh_preferences.doc
doc/salome/gui/SMESH/input/prism_3d_algo.doc
doc/salome/gui/SMESH/input/projection_algos.doc
doc/salome/gui/SMESH/input/scalar_bar.doc
doc/salome/gui/SMESH/input/smeshpy_interface.doc
doc/salome/gui/SMESH/input/tui_cartesian_algo.doc
doc/salome/gui/SMESH/input/tui_creating_meshes.doc
doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc
doc/salome/gui/SMESH/input/tui_filters.doc
doc/salome/gui/SMESH/input/tui_generate_flat_elements.doc
doc/salome/gui/SMESH/input/tui_grouping_elements.doc
doc/salome/gui/SMESH/input/tui_measurements.doc
doc/salome/gui/SMESH/input/tui_modifying_meshes.doc
doc/salome/gui/SMESH/input/tui_notebook_smesh.doc
doc/salome/gui/SMESH/input/tui_prism_3d_algo.doc [new file with mode: 0644]
doc/salome/gui/SMESH/input/tui_quality_controls.doc
doc/salome/gui/SMESH/input/tui_transforming_meshes.doc
doc/salome/gui/SMESH/input/tui_use_existing_faces.doc
doc/salome/gui/SMESH/input/tui_viewing_meshes.doc
doc/salome/gui/SMESH/input/use_existing_algos.doc
idl/SMESH_Filter.idl
idl/SMESH_Mesh.idl
resources/SalomeApp.xml.in
src/Controls/SMESH_Controls.cxx
src/Controls/SMESH_ControlsDef.hxx
src/Driver/Driver_Mesh.h
src/DriverGMF/libmesh5.c
src/DriverGMF/libmesh5.h
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/Makefile.am
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h
src/OBJECT/SMESH_ActorUtils.cxx
src/OBJECT/SMESH_ActorUtils.h
src/OBJECT/SMESH_CellLabelActor.cxx
src/OBJECT/SMESH_CellLabelActor.h
src/OBJECT/SMESH_DeviceActor.cxx
src/OBJECT/SMESH_NodeLabelActor.cxx
src/OBJECT/SMESH_NodeLabelActor.h
src/OBJECT/SMESH_Object.cxx
src/OBJECT/SMESH_Object.h
src/OBJECT/SMESH_ObjectDef.h
src/OBJECT/SMESH_PreviewActorsCollection.cxx
src/OBJECT/SMESH_SVTKActor.cxx
src/PluginUtils/GeomSelectionTools.cxx
src/SMDS/ObjectPool.hxx
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_MeshGroup.cxx
src/SMDS/SMDS_MeshGroup.hxx
src/SMDS/SMDS_MeshNode.cxx
src/SMDS/SMDS_UnstructuredGrid.cxx
src/SMDS/SMDS_UnstructuredGrid.hxx
src/SMDS/SMDS_VtkEdge.cxx
src/SMDS/SMDS_VtkEdge.hxx
src/SMESH/Makefile.am
src/SMESH/SMESH_Algo.cxx
src/SMESH/SMESH_Algo.hxx
src/SMESH/SMESH_Gen.cxx
src/SMESH/SMESH_Hypothesis.cxx
src/SMESH/SMESH_Hypothesis.hxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_MesherHelper.hxx
src/SMESH/SMESH_Pattern.cxx
src/SMESH/SMESH_Pattern.hxx
src/SMESH/SMESH_subMesh.cxx
src/SMESH/SMESH_subMesh.hxx
src/SMESH/memoire.h
src/SMESHDS/SMESHDS_Document.cxx
src/SMESHDS/SMESHDS_Document.hxx
src/SMESHDS/SMESHDS_GroupOnFilter.cxx
src/SMESHDS/SMESHDS_GroupOnFilter.hxx
src/SMESHDS/SMESHDS_SubMesh.cxx
src/SMESHDS/SMESH_Controls.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h
src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESHGUI_ComputeDlg.h
src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOnShapeDlg.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.h
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_MergeDlg.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.h
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx
src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.h
src/SMESHGUI/SMESH_msg_en.ts
src/SMESHGUI/SMESH_msg_fr.ts
src/SMESHUtils/Makefile.am
src/SMESHUtils/SMESH_Block.cxx
src/SMESHUtils/SMESH_Block.hxx
src/SMESHUtils/SMESH_TryCatch.cxx [new file with mode: 0644]
src/SMESHUtils/SMESH_TryCatch.hxx [new file with mode: 0644]
src/SMESHUtils/SMESH_TypeDefs.hxx
src/SMESH_I/Makefile.am
src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_I/SMESH_DumpPython.cxx
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_I/SMESH_Group_i.cxx
src/SMESH_I/SMESH_Group_i.hxx
src/SMESH_I/SMESH_Hypothesis_i.cxx
src/SMESH_I/SMESH_MEDMesh_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_I/SMESH_NoteBook.cxx
src/SMESH_I/SMESH_PreMeshInfo.cxx
src/SMESH_I/SMESH_PreMeshInfo.hxx
src/SMESH_I/smeshpy.py [deleted file]
src/SMESH_SWIG/smeshDC.py
src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx
src/StdMeshers/StdMeshers_Cartesian_3D.cxx
src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx
src/StdMeshers/StdMeshers_FaceSide.cxx
src/StdMeshers/StdMeshers_FaceSide.hxx
src/StdMeshers/StdMeshers_Hexa_3D.cxx
src/StdMeshers/StdMeshers_Prism_3D.cxx
src/StdMeshers/StdMeshers_Prism_3D.hxx
src/StdMeshers/StdMeshers_ProjectionSource2D.cxx
src/StdMeshers/StdMeshers_ProjectionUtils.cxx
src/StdMeshers/StdMeshers_ProjectionUtils.hxx
src/StdMeshers/StdMeshers_Projection_1D2D.cxx
src/StdMeshers/StdMeshers_Projection_2D.cxx
src/StdMeshers/StdMeshers_Projection_3D.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.hxx
src/StdMeshers/StdMeshers_RadialPrism_3D.cxx
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx
src/StdMeshers_I/StdMeshers_ImportSource1D_i.cxx
src/StdMeshers_I/StdMeshers_ImportSource2D_i.cxx
src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx
src/StdMeshers_I/StdMeshers_ObjRefUlils.cxx
src/Tools/MeshCut/MeshCut_Maillage.cxx
src/Tools/YamsPlug/monYamsPlugDialog.py
src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx
src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx
src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx

index c45c59f18cbc99bca270feb7652dfb9ae35b8cfd..98147ad5870864b28081da3d3db898c7e81c1e55 100644 (file)
@@ -537,6 +537,7 @@ AC_OUTPUT([ \
   doc/docutils/Makefile \
   doc/docutils/conf.py \
   doc/salome/Makefile \
+  doc/salome/examples/Makefile \
   doc/salome/gui/Makefile \
   doc/salome/gui/SMESH/Makefile \
   doc/salome/gui/SMESH/doxyfile \
index 8bf9f392d938f95a5f3a183a5526b993547d42d4..10bcc3f2528a8488e8c94a6ccb5fc4aad204b46b 100644 (file)
@@ -23,7 +23,7 @@
 #  Modified by : Alexander BORODIN (OCN) - autotools usage
 # $Header:
 #
-SUBDIRS = tui gui
+SUBDIRS = tui gui examples
 SUBDIRSTUI = tui
 SUBDIRSGUI = gui
 
diff --git a/doc/salome/examples/3dmesh.py b/doc/salome/examples/3dmesh.py
new file mode 100644 (file)
index 0000000..bd6d3b4
--- /dev/null
@@ -0,0 +1,72 @@
+# 3d mesh generation
+
+from geompy import * 
+import smesh 
+
+###
+# Geometry: an assembly of a box, a cylinder and a truncated cone
+# meshed with tetrahedral 
+###
+
+# Define values
+name = "ex21_lamp" 
+cote = 60 
+section = 20 
+size = 200 
+radius_1 = 80 
+radius_2 = 40 
+height = 100 
+
+# Build a box
+box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote) 
+
+# Build a cylinder
+pt1 = MakeVertex(0, 0, cote/3) 
+di1 = MakeVectorDXDYDZ(0, 0, 1) 
+cyl = MakeCylinder(pt1, di1, section, size) 
+
+# Build a truncated cone
+pt2 = MakeVertex(0, 0, size) 
+cone = MakeCone(pt2, di1, radius_1, radius_2, height) 
+
+# Fuse
+box_cyl = MakeFuse(box, cyl) 
+piece = MakeFuse(box_cyl, cone) 
+
+# Add to the study
+addToStudy(piece, name) 
+
+# Create a group of faces
+group = CreateGroup(piece, ShapeType["FACE"]) 
+group_name = name + "_grp" 
+addToStudy(group, group_name) 
+group.SetName(group_name) 
+
+# Add faces to the group
+faces = SubShapeAllIDs(piece, ShapeType["FACE"]) 
+UnionIDs(group, faces) 
+
+###
+# Create a mesh
+###
+
+# Define a mesh on a geometry
+tetra = smesh.Mesh(piece, name) 
+
+# Define 1D hypothesis
+algo1d = tetra.Segment() 
+algo1d.LocalLength(10) 
+
+# Define 2D hypothesis
+algo2d = tetra.Triangle() 
+algo2d.LengthFromEdges() 
+
+# Define 3D hypothesis
+algo3d = tetra.Tetrahedron()
+algo3d.MaxElementVolume(100) 
+
+# Compute the mesh
+tetra.Compute() 
+
+# Create a groupe of faces
+tetra.Group(group)
diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am
new file mode 100644 (file)
index 0000000..930edd9
--- /dev/null
@@ -0,0 +1,180 @@
+# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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   : Makefile
+#  Author : Alexander KOVALEV (Open Cascade NN)
+#  Modified by : 
+#  Module : doc
+#
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+pyexamplesdir = $(docdir)/examples/SMESH
+
+BAD_TESTS = 
+
+GOOD_TESTS = \
+       3dmesh.py \
+       cartesian_algo.py \
+       creating_meshes_ex01.py \
+       creating_meshes_ex02.py \
+       creating_meshes_ex03.py \
+       creating_meshes_ex04.py \
+       creating_meshes_ex05.py \
+       creating_meshes_ex06.py \
+       creating_meshes_ex07.py \
+       creating_meshes_ex08.py \
+       defining_hypotheses_ex01.py \
+       defining_hypotheses_ex02.py \
+       defining_hypotheses_ex03.py \
+       defining_hypotheses_ex04.py \
+       defining_hypotheses_ex05.py \
+       defining_hypotheses_ex06.py \
+       defining_hypotheses_ex07.py \
+       defining_hypotheses_ex08.py \
+       defining_hypotheses_ex09.py \
+       defining_hypotheses_ex10.py \
+       defining_hypotheses_ex11.py \
+       defining_hypotheses_ex12.py \
+       defining_hypotheses_ex13.py \
+       defining_hypotheses_ex14.py \
+       defining_hypotheses_ex15.py \
+       defining_hypotheses_ex16.py \
+       defining_hypotheses_ex17.py \
+       filters_ex01.py \
+       filters_ex02.py \
+       filters_ex03.py \
+       filters_ex04.py \
+       filters_ex05.py \
+       filters_ex06.py \
+       filters_ex07.py \
+       filters_ex08.py \
+       filters_ex09.py \
+       filters_ex10.py \
+       filters_ex11.py \
+       filters_ex12.py \
+       filters_ex13.py \
+       filters_ex14.py \
+       filters_ex15.py \
+       filters_ex16.py \
+       filters_ex17.py \
+       filters_ex18.py \
+       filters_ex19.py \
+       filters_ex20.py \
+       filters_ex21.py \
+       filters_ex22.py \
+       filters_ex23.py \
+       filters_ex24.py \
+       filters_ex25.py \
+       filters_ex26.py \
+       filters_ex27.py \
+       filters_ex28.py \
+       filters_ex29.py \
+       filters_ex30.py \
+       filters_ex31.py \
+       filters_ex32.py \
+       filters_ex33.py \
+       filters_ex34.py \
+       filters_ex35.py \
+       filters_ex36.py \
+       generate_flat_elements.py \
+       grouping_elements_ex01.py \
+       grouping_elements_ex02.py \
+       grouping_elements_ex03.py \
+       grouping_elements_ex04.py \
+       grouping_elements_ex05.py \
+       grouping_elements_ex06.py \
+       grouping_elements_ex07.py \
+       grouping_elements_ex08.py \
+       measurements_ex01.py \
+       measurements_ex02.py \
+       modifying_meshes_ex01.py \
+       modifying_meshes_ex02.py \
+       modifying_meshes_ex03.py \
+       modifying_meshes_ex04.py \
+       modifying_meshes_ex05.py \
+       modifying_meshes_ex06.py \
+       modifying_meshes_ex07.py \
+       modifying_meshes_ex08.py \
+       modifying_meshes_ex09.py \
+       modifying_meshes_ex10.py \
+       modifying_meshes_ex11.py \
+       modifying_meshes_ex12.py \
+       modifying_meshes_ex13.py \
+       modifying_meshes_ex14.py \
+       modifying_meshes_ex15.py \
+       modifying_meshes_ex16.py \
+       modifying_meshes_ex17.py \
+       modifying_meshes_ex18.py \
+       modifying_meshes_ex19.py \
+       modifying_meshes_ex20.py \
+       modifying_meshes_ex21.py \
+       modifying_meshes_ex22.py \
+       modifying_meshes_ex23.py \
+       modifying_meshes_ex24.py \
+       modifying_meshes_ex25.py \
+       modifying_meshes_ex26.py \
+       notebook_smesh.py \
+       prism_3d_algo.py \
+       quality_controls_ex01.py \
+       quality_controls_ex02.py \
+       quality_controls_ex03.py \
+       quality_controls_ex04.py \
+       quality_controls_ex05.py \
+       quality_controls_ex06.py \
+       quality_controls_ex07.py \
+       quality_controls_ex08.py \
+       quality_controls_ex09.py \
+       quality_controls_ex10.py \
+       quality_controls_ex11.py \
+       quality_controls_ex12.py \
+       quality_controls_ex13.py \
+       quality_controls_ex14.py \
+       quality_controls_ex15.py \
+       quality_controls_ex16.py \
+       quality_controls_ex17.py \
+       quality_controls_ex18.py \
+       quality_controls_ex19.py \
+       quality_controls_ex20.py \
+       quality_controls_ex21.py \
+       quality_controls_ex22.py \
+       transforming_meshes_ex01.py \
+       transforming_meshes_ex02.py \
+       transforming_meshes_ex03.py \
+       transforming_meshes_ex04.py \
+       transforming_meshes_ex05.py \
+       transforming_meshes_ex06.py \
+       transforming_meshes_ex07.py \
+       transforming_meshes_ex08.py \
+       transforming_meshes_ex09.py \
+       transforming_meshes_ex10.py \
+       transforming_meshes_ex11.py \
+       transforming_meshes_ex12.py \
+       transforming_meshes_ex13.py \
+       use_existing_faces.py \
+       viewing_meshes_ex01.py \
+       viewing_meshes_ex02.py
+
+pyexamples_SCRIPTS = $(BAD_TESTS) $(GOOD_TESTS)
+
+EXTRA_DIST += $(pyexamples_SCRIPTS) testme.py
+
+check-local:
+       @for f in $(GOOD_TESTS) ; do \
+         python $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \
+       done
diff --git a/doc/salome/examples/cartesian_algo.py b/doc/salome/examples/cartesian_algo.py
new file mode 100644 (file)
index 0000000..b15455f
--- /dev/null
@@ -0,0 +1,42 @@
+# Usage of Body Fitting algorithm
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+# create a sphere
+sphere = geompy.MakeSphereR( 50 )
+geompy.addToStudy( sphere, "sphere" )
+
+# create a mesh and assign a "Body Fitting" algo
+mesh = Mesh( sphere )
+cartAlgo = mesh.BodyFitted()
+
+# define a cartesian grid using Coordinates
+coords = range(-100,100,10)
+cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000)
+
+# compute the mesh
+mesh.Compute()
+print "nb hexahedra",mesh.NbHexas()
+print "nb tetrahedra",mesh.NbTetras()
+print "nb polyhedra",mesh.NbPolyhedrons()
+print
+
+# define the grid by setting constant spacing
+cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
+
+mesh.Compute()
+print "nb hexahedra",mesh.NbHexas()
+print "nb tetrahedra",mesh.NbTetras()
+print "nb polyhedra",mesh.NbPolyhedrons()
+
+
+# define the grid by setting different spacing in 2 sub-ranges of geometry
+spaceFuns = ["5","10+10*t"]
+cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 )
+
+mesh.Compute()
+print "nb hexahedra",mesh.NbHexas()
+print "nb tetrahedra",mesh.NbTetras()
+print "nb polyhedra",mesh.NbPolyhedrons()
+print
diff --git a/doc/salome/examples/creating_meshes_ex01.py b/doc/salome/examples/creating_meshes_ex01.py
new file mode 100644 (file)
index 0000000..0b93356
--- /dev/null
@@ -0,0 +1,28 @@
+# Construction of a Mesh
+
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+tetra = smesh.Mesh(box, "MeshBox")
+
+algo1D = tetra.Segment()
+algo1D.NumberOfSegments(7)
+
+algo2D = tetra.Triangle()
+algo2D.MaxElementArea(800.)
+
+algo3D = tetra.Tetrahedron()
+algo3D.MaxElementVolume(900.)
+
+# compute the mesh
+ret = tetra.Compute()
+if ret == 0:
+    print "problem when computing the mesh"
+else:
+    print "mesh computed"
+    pass
diff --git a/doc/salome/examples/creating_meshes_ex02.py b/doc/salome/examples/creating_meshes_ex02.py
new file mode 100644 (file)
index 0000000..c541b4a
--- /dev/null
@@ -0,0 +1,39 @@
+# Construction of a Submesh
+
+from geompy import *
+import smesh
+
+# create a box
+box = MakeBoxDXDYDZ(10., 10., 10.)
+addToStudy(box, "Box")
+
+# select one edge of the box for definition of a local hypothesis
+p5 = MakeVertex(5., 0., 0.)
+EdgeX = GetEdgeNearPoint(box, p5)
+addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+
+# create a hexahedral mesh on the box
+quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
+
+# create a regular 1D algorithm for the faces
+algo1D = quadra.Segment()
+
+# define "NumberOfSegments" hypothesis to cut
+# all the edges in a fixed number of segments
+algo1D.NumberOfSegments(4)
+
+# create a quadrangle 2D algorithm for the faces
+quadra.Quadrangle()
+
+# construct a submesh on the edge with a local hypothesis
+algo_local = quadra.Segment(EdgeX)
+
+# define "Arithmetic1D" hypothesis to cut the edge in several segments with increasing arithmetic length
+algo_local.Arithmetic1D(1, 4)
+
+# define "Propagation" hypothesis that propagates all other hypotheses
+# on all edges of the opposite side in case of quadrangular faces
+algo_local.Propagation()
+
+# compute the mesh
+quadra.Compute()
diff --git a/doc/salome/examples/creating_meshes_ex03.py b/doc/salome/examples/creating_meshes_ex03.py
new file mode 100644 (file)
index 0000000..7b219f3
--- /dev/null
@@ -0,0 +1,57 @@
+# Change priority of submeshes in Mesh
+
+import salome
+import geompy
+import smesh
+import SMESH
+
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+[Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
+
+# create Mesh object on Box shape
+Mesh_1 = smesh.Mesh(Box_1)
+
+# assign mesh algorithms
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
+Nb_Segments_1.SetDistrType( 0 )
+MEFISTO_2D = Mesh_1.Triangle()
+Max_Element_Area_1 = MEFISTO_2D.MaxElementArea(1200)
+Tetrahedron = Mesh_1.Tetrahedron()
+Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000)
+
+# create submesh and assign algorithms on Face_1
+Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
+Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
+Nb_Segments_2.SetDistrType( 0 )
+MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
+Length_From_Edges_2D = MEFISTO_2D_1.LengthFromEdges()
+SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
+
+# create submesh and assign algorithms on Face_2
+Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
+Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
+Nb_Segments_3.SetDistrType( 0 )
+MEFISTO_2D_2 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_2)
+Length_From_Edges_2D_1 = MEFISTO_2D_2.LengthFromEdges()
+SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
+
+# create submesh and assign algorithms on Face_3
+Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
+Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
+Nb_Segments_4.SetDistrType( 0 )
+MEFISTO_2D_3 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_3)
+Length_From_Edges_2D_2 = MEFISTO_2D_3.LengthFromEdges()
+SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
+
+# check exisiting submesh priority order
+[ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder()
+# set new submesh order
+isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ])
+# compute mesh
+isDone = Mesh_1.Compute()
+
+# clear mesh result and compute with other submesh order
+Mesh_1.Clear()
+isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ])
+isDone = Mesh_1.Compute()
diff --git a/doc/salome/examples/creating_meshes_ex04.py b/doc/salome/examples/creating_meshes_ex04.py
new file mode 100644 (file)
index 0000000..33106c7
--- /dev/null
@@ -0,0 +1,54 @@
+# Editing of a mesh
+
+import geompy
+import smesh
+
+def PrintMeshInfo(theMesh):
+    aMesh = theMesh.GetMesh()
+    print "Information about mesh:"
+    print "Number of nodes       : ", aMesh.NbNodes()
+    print "Number of edges       : ", aMesh.NbEdges()
+    print "Number of faces       : ", aMesh.NbFaces()
+    print "Number of volumes     : ", aMesh.NbVolumes()
+    pass
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
+geompy.addToStudy(box, "box")
+
+# select one edge of the box for definition of a local hypothesis
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
+edge = subShapeList[0]
+name = geompy.SubShapeName(edge, box)
+geompy.addToStudyInFather(box, edge, name)
+
+# create a mesh
+tria = smesh.Mesh(box, "Mesh 2D")
+algo1D = tria.Segment()
+hyp1 = algo1D.NumberOfSegments(3)
+algo2D = tria.Triangle()
+hyp2 = algo2D.MaxElementArea(10.)
+
+# create a sub-mesh
+algo_local = tria.Segment(edge)
+hyp3 = algo_local.Arithmetic1D(1, 6)
+hyp4 = algo_local.Propagation()
+
+# compute the mesh
+tria.Compute()
+PrintMeshInfo(tria)
+
+# remove a local hypothesis
+mesh = tria.GetMesh()
+mesh.RemoveHypothesis(edge, hyp4)
+
+# compute the mesh
+tria.Compute()
+PrintMeshInfo(tria)
+
+# change the value of the 2D hypothesis
+hyp2.SetMaxElementArea(2.)
+
+# compute the mesh
+tria.Compute()
+PrintMeshInfo(tria)
diff --git a/doc/salome/examples/creating_meshes_ex05.py b/doc/salome/examples/creating_meshes_ex05.py
new file mode 100644 (file)
index 0000000..6ba4103
--- /dev/null
@@ -0,0 +1,31 @@
+# Export of a Mesh
+
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+tetra = smesh.Mesh(box, "MeshBox")
+
+algo1D = tetra.Segment()
+algo1D.NumberOfSegments(7)
+
+algo2D = tetra.Triangle()
+algo2D.MaxElementArea(800.)
+
+algo3D = tetra.Tetrahedron()
+algo3D.MaxElementVolume(900.)
+
+# compute the mesh
+tetra.Compute()
+
+# export the mesh in a MED file
+tetra.ExportMED("/tmp/meshMED.med", 0)
+
+# export a group in a MED file
+face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
+group = tetra.GroupOnGeom( face, "face group" ) # group of 2D elements on the <face>
+tetra.ExportMED("/tmp/groupMED.med", meshPart=group)
diff --git a/doc/salome/examples/creating_meshes_ex06.py b/doc/salome/examples/creating_meshes_ex06.py
new file mode 100644 (file)
index 0000000..96b2a29
--- /dev/null
@@ -0,0 +1,106 @@
+# Creating a hexahedral mesh on a cylinder.
+# Note: it is a copy of 'ex24_cylinder.py' from SMESH_SWIG
+
+import math
+
+import geompy
+import smesh
+import salome
+geo = geompy
+
+# Parameters
+# ----------
+
+radius =  50
+height = 200
+
+# Build a cylinder
+# ----------------
+
+base = geo.MakeVertex(0, 0, 0)
+direction = geo.MakeVectorDXDYDZ(0, 0, 1)
+
+cylinder = geo.MakeCylinder(base, direction, radius, height)
+
+geo.addToStudy(cylinder, "cylinder")
+
+# Build blocks
+# ------------
+
+size = radius/2.0
+
+box_rot = geo.MakeBox(-size, -size, 0,  +size, +size, height)
+box_axis = geo.MakeLine(base, direction)
+box = geo.MakeRotation(box_rot, box_axis, math.pi/4)
+
+hole = geo.MakeCut(cylinder, box)
+
+plane_trim = 2000
+
+plane_a = geo.MakePlane(base, geo.MakeVectorDXDYDZ(1, 0, 0), plane_trim)
+plane_b = geo.MakePlane(base, geo.MakeVectorDXDYDZ(0, 1, 0), plane_trim)
+
+blocks_part = geo.MakePartition([hole], [plane_a, plane_b], [], [], geo.ShapeType["SOLID"])
+blocks_list = [box] + geo.SubShapeAll(blocks_part, geo.ShapeType["SOLID"])
+blocks_all = geo.MakeCompound(blocks_list)
+blocks = geo.MakeGlueFaces(blocks_all, 0.0001)
+
+geo.addToStudy(blocks, "cylinder:blocks")
+
+# Build geometric groups
+# ----------------------
+
+def group(name, shape, type, base=None, direction=None):
+    t = geo.ShapeType[type]
+    g = geo.CreateGroup(shape, t)
+
+    geo.addToStudy(g, name)
+    g.SetName(name)
+
+    if base!=None:
+        l = geo.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, geo.GEOM.ST_ON)
+        geo.UnionIDs(g, l)
+
+    return g
+
+group_a = group("baseA", blocks, "FACE", base, direction)
+
+base_b  = geo.MakeVertex(0, 0, height)
+group_b = group("baseB", blocks, "FACE", base_b, direction)
+
+group_1 = group("limit", blocks, "SOLID")
+group_1_all = geo.SubShapeAllIDs(blocks, geo.ShapeType["SOLID"])
+geo.UnionIDs(group_1, group_1_all)
+group_1_box = geo.GetBlockNearPoint(blocks, base)
+geo.DifferenceList(group_1, [group_1_box])
+
+# Mesh the blocks with hexahedral
+# -------------------------------
+
+smesh.SetCurrentStudy(salome.myStudy)
+
+def discretize(x, y, z,  n, s=blocks):
+    p = geo.MakeVertex(x, y, z)
+    e = geo.GetEdgeNearPoint(s, p)
+    a = hexa.Segment(e)
+    a.NumberOfSegments(n)
+    a.Propagation()
+
+hexa = smesh.Mesh(blocks)
+
+hexa_1d = hexa.Segment()
+hexa_1d.NumberOfSegments(1)
+
+discretize(+radius        , +radius,        0,   5)
+discretize(-radius        , +radius,        0,   8)
+discretize((radius+size)/2,       0,        0,  10)
+discretize(        +radius,       0, height/2,  20)
+
+hexa.Quadrangle()
+hexa.Hexahedron()
+
+hexa.Compute()
+
+hexa.Group(group_a)
+hexa.Group(group_b)
+hexa.Group(group_1)
diff --git a/doc/salome/examples/creating_meshes_ex07.py b/doc/salome/examples/creating_meshes_ex07.py
new file mode 100644 (file)
index 0000000..3140ace
--- /dev/null
@@ -0,0 +1,73 @@
+# Building a compound of meshes
+# Note: it is a copy of 'SMESH_BuildCompound.py' from SMESH_SWIG
+
+import salome
+import geompy
+import smesh
+
+## create a bottom box
+Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.)
+
+# get a top face
+Psup1=geompy.MakeVertex(100., 100., 50.)
+Fsup1=geompy.GetFaceNearPoint(Box_inf, Psup1)
+# get a bottom face
+Pinf1=geompy.MakeVertex(100., 100., 0.)
+Finf1=geompy.GetFaceNearPoint(Box_inf, Pinf1)
+
+## create a top box
+Box_sup = geompy.MakeBox(100., 100., 50., 200., 200., 100.)
+
+# get a top face
+Psup2=geompy.MakeVertex(150., 150., 100.)
+Fsup2=geompy.GetFaceNearPoint(Box_sup, Psup2)
+# get a bottom face
+Pinf2=geompy.MakeVertex(150., 150., 50.)
+Finf2=geompy.GetFaceNearPoint(Box_sup, Pinf2)
+
+## Publish in the study
+geompy.addToStudy(Box_inf, "Box_inf")
+geompy.addToStudyInFather(Box_inf, Fsup1, "Fsup")
+geompy.addToStudyInFather(Box_inf, Finf1, "Finf")
+
+geompy.addToStudy(Box_sup, "Box_sup")
+geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup")
+geompy.addToStudyInFather(Box_sup, Finf2, "Finf")
+
+smesh.SetCurrentStudy(salome.myStudy)
+
+## create a bottom mesh
+Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf")
+algo1D_1=Mesh_inf.Segment()
+algo1D_1.NumberOfSegments(10)
+algo2D_1=Mesh_inf.Quadrangle()
+algo3D_1=Mesh_inf.Hexahedron()
+Mesh_inf.Compute()
+
+# create a group on the top face
+Gsup1=Mesh_inf.Group(Fsup1, "Sup")
+# create a group on the bottom face
+Ginf1=Mesh_inf.Group(Finf1, "Inf")
+
+## create a top mesh
+Mesh_sup = smesh.Mesh(Box_sup, "Mesh_sup")
+algo1D_2=Mesh_sup.Segment()
+algo1D_2.NumberOfSegments(5)
+algo2D_2=Mesh_sup.Quadrangle()
+algo3D_2=Mesh_sup.Hexahedron()
+Mesh_sup.Compute()
+
+# create a group on the top face
+Gsup2=Mesh_sup.Group(Fsup2, "Sup")
+# create a group on the bottom face
+Ginf2=Mesh_sup.Group(Finf2, "Inf")
+
+## create compounds
+# create a compound of two meshes with renaming groups with the same names and
+# merging of elements with the given tolerance
+Compound1 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
+smesh.SetName(Compound1, 'Compound_with_RenamedGrps_and_MergeElems')
+# create a compound of two meshes with uniting groups with the same names and
+# creating groups of all elements
+Compound2 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
+smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
diff --git a/doc/salome/examples/creating_meshes_ex08.py b/doc/salome/examples/creating_meshes_ex08.py
new file mode 100644 (file)
index 0000000..a76e8d1
--- /dev/null
@@ -0,0 +1,40 @@
+# Mesh Copying
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+# make geometry of a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
+
+# generate 3D mesh
+mesh = Mesh(box)
+localAlgo = mesh.Triangle(face)
+mesh.AutomaticHexahedralization()
+
+# objects to copy
+fGroup = mesh.GroupOnGeom( face, "2D on face")
+nGroup = mesh.GroupOnGeom( face, "nodes on face", NODE)
+subMesh = localAlgo.GetSubMesh()
+
+# make a new mesh by copying different parts of the mesh
+
+# 1. copy the whole mesh
+newMesh = CopyMesh( mesh, "whole mesh copy")
+
+# 2. copy a group of 2D elements along with groups
+newMesh = CopyMesh( fGroup,  "face group copy with groups",toCopyGroups=True)
+
+# 3. copy a group of nodes with preseving their ids
+newMesh = CopyMesh( nGroup, "node group copy", toKeepIDs=True)
+
+# 4. copy some faces
+faceIds = fGroup.GetIDs()[-10:]
+newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy")
+
+# 5. copy some nodes
+nodeIds = nGroup.GetIDs()[-10:]
+newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy")
+
+# 6. copy a sub-mesh
+newMesh = CopyMesh( subMesh, "submesh copy" )
diff --git a/doc/salome/examples/defining_hypotheses_ex01.py b/doc/salome/examples/defining_hypotheses_ex01.py
new file mode 100644 (file)
index 0000000..6efb1cf
--- /dev/null
@@ -0,0 +1,30 @@
+# Arithmetic 1D
+
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
+geompy.addToStudy(box, "Box")
+
+# create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# create a Regular 1D algorithm for edges
+algo1D = hexa.Segment()
+
+# optionally reverse node distribution on certain edges
+allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"])
+reversedEdges = [ allEdges[0], allEdges[4] ]
+
+# define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length 
+algo1D.Arithmetic1D(1, 4, reversedEdges)
+
+# create a quadrangle 2D algorithm for faces
+hexa.Quadrangle()
+
+# create a hexahedron 3D algorithm for solids
+hexa.Hexahedron()
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex02.py b/doc/salome/examples/defining_hypotheses_ex02.py
new file mode 100644 (file)
index 0000000..b0726a1
--- /dev/null
@@ -0,0 +1,40 @@
+# Deflection 1D and Number of Segments
+
+import geompy
+import smesh
+
+# create a face from arc and straight segment
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+pz = geompy.MakeVertex(0.  , 0.  , 100.)
+
+exy = geompy.MakeEdge(px, py)
+arc = geompy.MakeArc(py, pz, px)
+
+wire = geompy.MakeWire([exy, arc])
+
+isPlanarFace = 1
+face1 = geompy.MakeFace(wire, isPlanarFace)
+geompy.addToStudy(face1,"Face1")
+
+# get edges from the face
+e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
+geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
+
+# create hexahedral mesh
+hexa = smesh.Mesh(face1, "Face : triangle mesh")
+
+# define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
+algo1D = hexa.Segment()
+algo1D.NumberOfSegments(6)
+
+# define "MaxElementArea" hypothesis
+algo2D = hexa.Triangle()
+algo2D.MaxElementArea(70.0)
+
+# define a local "Deflection1D" hypothesis on the arc
+algo_local = hexa.Segment(e_arc)
+algo_local.Deflection1D(1.0)
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex03.py b/doc/salome/examples/defining_hypotheses_ex03.py
new file mode 100644 (file)
index 0000000..cfb1ca8
--- /dev/null
@@ -0,0 +1,37 @@
+# Start and End Length
+
+from geompy import *
+import smesh
+
+# create a box
+box = MakeBoxDXDYDZ(10., 10., 10.)
+addToStudy(box, "Box")
+
+# get one edge of the box to put local hypothesis on
+p5 = MakeVertex(5., 0., 0.)
+EdgeX = GetEdgeNearPoint(box, p5)
+addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+
+# create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# set algorithms
+algo1D = hexa.Segment()
+hexa.Quadrangle()
+hexa.Hexahedron()
+
+# define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
+algo1D.NumberOfSegments(4)
+
+# create a local hypothesis
+algo_local = hexa.Segment(EdgeX)
+
+# define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
+algo_local.StartEndLength(1, 6)
+
+# define "Propagation" hypothesis that propagates all other hypothesis
+# on all edges on the opposite side in case of quadrangular faces
+algo_local.Propagation()
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex04.py b/doc/salome/examples/defining_hypotheses_ex04.py
new file mode 100644 (file)
index 0000000..0a17f5c
--- /dev/null
@@ -0,0 +1,37 @@
+# Local Length
+
+from geompy import *
+import smesh
+
+# create a box
+box = MakeBoxDXDYDZ(10., 10., 10.)
+addToStudy(box, "Box")
+
+# get one edge of the box to put local hypothesis on
+p5 = MakeVertex(5., 0., 0.)
+EdgeX = GetEdgeNearPoint(box, p5)
+addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+
+# create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# set algorithms
+algo1D = hexa.Segment()
+hexa.Quadrangle()
+hexa.Hexahedron()
+
+# define "NumberOfSegments" hypothesis to cut all edges in a fixed number of segments
+algo1D.NumberOfSegments(4)
+
+# create a sub-mesh
+algo_local = hexa.Segment(EdgeX)
+
+# define "LocalLength" hypothesis to cut an edge in several segments with the same length
+algo_local.LocalLength(2.)
+
+# define "Propagation" hypothesis that propagates all other hypothesis
+# on all edges on the opposite side in case of quadrangular faces
+algo_local.Propagation()
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex05.py b/doc/salome/examples/defining_hypotheses_ex05.py
new file mode 100644 (file)
index 0000000..fcf03d0
--- /dev/null
@@ -0,0 +1,38 @@
+# Maximum Element Area
+
+import geompy
+import smesh
+import salome 
+
+# create a face
+px   = geompy.MakeVertex(100., 0.  , 0.  )
+py   = geompy.MakeVertex(0.  , 100., 0.  )
+pz   = geompy.MakeVertex(0.  , 0.  , 100.)
+
+vxy = geompy.MakeVector(px, py)
+arc = geompy.MakeArc(py, pz, px)
+wire = geompy.MakeWire([vxy, arc])
+
+isPlanarFace = 1
+face = geompy.MakeFace(wire, isPlanarFace)
+
+# add the face in the study
+id_face = geompy.addToStudy(face, "Face to be meshed")
+
+# create a mesh
+tria_mesh = smesh.Mesh(face, "Face : triangulation")
+
+# define 1D meshing:
+algo = tria_mesh.Segment()
+algo.NumberOfSegments(20)
+
+# define 2D meshing:
+
+# assign triangulation algorithm
+algo = tria_mesh.Triangle()
+
+# apply "Max Element Area" hypothesis to each triangle
+algo.MaxElementArea(100)
+
+# compute the mesh
+tria_mesh.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex06.py b/doc/salome/examples/defining_hypotheses_ex06.py
new file mode 100644 (file)
index 0000000..24bc4da
--- /dev/null
@@ -0,0 +1,30 @@
+# Maximum Element Volume
+
+import geompy
+import smesh
+
+# create a cylinder
+cyl = geompy.MakeCylinderRH(30., 50.)
+geompy.addToStudy(cyl, "cyl")
+
+# create a mesh on the cylinder
+tetra = smesh.Mesh(cyl, "Cylinder : tetrahedrical mesh")
+
+# assign algorithms
+algo1D = tetra.Segment()
+algo2D = tetra.Triangle()
+algo3D = tetra.Tetrahedron()
+
+# assign 1D and 2D hypotheses
+algo1D.NumberOfSegments(7)
+algo2D.MaxElementArea(150.)
+
+# assign Max Element Volume hypothesis
+algo3D.MaxElementVolume(200.)
+
+# compute the mesh
+ret = tetra.Compute()
+if ret == 0:
+    print "probleme when computing the mesh"
+else:
+    print "Computation succeded"
diff --git a/doc/salome/examples/defining_hypotheses_ex07.py b/doc/salome/examples/defining_hypotheses_ex07.py
new file mode 100644 (file)
index 0000000..59d7521
--- /dev/null
@@ -0,0 +1,29 @@
+# Length from Edges
+
+import geompy
+import smesh
+
+# create sketchers
+sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
+sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
+
+# create a face from two wires
+isPlanarFace = 1
+face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
+geompy.addToStudy(face1, "Face1")
+
+# create a mesh
+tria = smesh.Mesh(face1, "Face : triangle 2D mesh")
+
+# Define 1D meshing
+algo1D = tria.Segment()
+algo1D.NumberOfSegments(2)
+
+# create and assign the algorithm for 2D meshing with triangles
+algo2D = tria.Triangle()
+
+# create and assign "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
+algo2D.LengthFromEdges()
+
+# compute the mesh
+tria.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex08.py b/doc/salome/examples/defining_hypotheses_ex08.py
new file mode 100644 (file)
index 0000000..4387734
--- /dev/null
@@ -0,0 +1,35 @@
+# Propagation
+
+from geompy import *
+import smesh
+
+# create a box
+box = MakeBoxDXDYDZ(10., 10., 10.)
+addToStudy(box, "Box")
+
+# get one edge of the box to put local hypothesis on
+p5 = MakeVertex(5., 0., 0.)
+EdgeX = GetEdgeNearPoint(box, p5)
+addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+
+# create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# set global algorithms and hypotheses
+algo1D = hexa.Segment()
+hexa.Quadrangle()
+hexa.Hexahedron()
+algo1D.NumberOfSegments(4)
+
+# create a sub-mesh with local 1D hypothesis and propagation
+algo_local = hexa.Segment(EdgeX)
+
+# define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
+algo_local.Arithmetic1D(1, 4)
+
+# define "Propagation" hypothesis that propagates all other 1D hypotheses
+# from all edges on the opposite side of a face in case of quadrangular faces
+algo_local.Propagation()
+
+# compute the mesh
+hexa.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex09.py b/doc/salome/examples/defining_hypotheses_ex09.py
new file mode 100644 (file)
index 0000000..9956e4b
--- /dev/null
@@ -0,0 +1,45 @@
+# Defining Meshing Algorithms
+
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
+geompy.addToStudy(box, "Box")
+
+# 1. Create a hexahedral mesh on the box
+hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
+
+# create a Regular 1D algorithm for edges
+algo1D = hexa.Segment()
+
+# create a quadrangle 2D algorithm for faces
+algo2D = hexa.Quadrangle()
+
+# create a hexahedron 3D algorithm for solids
+algo3D = hexa.Hexahedron()
+
+# define hypotheses
+algo1D.Arithmetic1D(1, 4)
+
+# compute the mesh
+hexa.Compute()
+
+# 2. Create a tetrahedral mesh on the box
+tetra = smesh.Mesh(box, "Box : tetrahedrical mesh")
+
+# create a Regular 1D algorithm for edges
+algo1D = tetra.Segment()
+
+# create a Mefisto 2D algorithm for faces
+algo2D = tetra.Triangle()
+
+# create a 3D algorithm for solids
+algo3D = tetra.Tetrahedron()
+
+# define hypotheses
+algo1D.Arithmetic1D(1, 4)
+algo2D.LengthFromEdges()
+
+# compute the mesh
+tetra.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex10.py b/doc/salome/examples/defining_hypotheses_ex10.py
new file mode 100644 (file)
index 0000000..644908b
--- /dev/null
@@ -0,0 +1,76 @@
+# Projection Algorithms
+
+# Project prisms from one meshed box to another mesh on the same box
+
+from smesh import *
+
+# Prepare geometry
+
+# Create a parallelepiped
+box = geompy.MakeBoxDXDYDZ(200, 100, 70)
+geompy.addToStudy( box, "box" )
+
+# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
+faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+# 2 adjacent faces of the box
+f1 = faces[2]
+f2 = faces[0]
+# face opposite to f2
+f2opp = faces[1]
+
+# Get vertices used to specify how to associate sides of faces at projection
+[v1F1, v2F1] = geompy.SubShapeAll(f1, geompy.ShapeType["VERTEX"])[:2]
+[v1F2, v2F2] = geompy.SubShapeAll(f2, geompy.ShapeType["VERTEX"])[:2]
+geompy.addToStudyInFather( box, v1F1, "v1F1" )
+geompy.addToStudyInFather( box, v2F1, "v2F1" )
+geompy.addToStudyInFather( box, v1F2, "v1F2" )
+geompy.addToStudyInFather( box, v2F2, "v2F2" )
+
+# Make group of 3 edges of f1 and f2
+edgesF1 = geompy.CreateGroup(f1, geompy.ShapeType["EDGE"])
+geompy.UnionList( edgesF1, geompy.SubShapeAll(f1, geompy.ShapeType["EDGE"])[:3])
+edgesF2 = geompy.CreateGroup(f2, geompy.ShapeType["EDGE"])
+geompy.UnionList( edgesF2, geompy.SubShapeAll(f2, geompy.ShapeType["EDGE"])[:3])
+geompy.addToStudyInFather( box, edgesF1, "edgesF1" )
+geompy.addToStudyInFather( box, edgesF2, "edgesF2" )
+
+
+# Make the source mesh with prisms
+src_mesh = Mesh(box, "Source mesh")
+src_mesh.Segment().NumberOfSegments(9,10)
+src_mesh.Quadrangle()
+src_mesh.Hexahedron()
+src_mesh.Triangle(f1) # triangular sumbesh 
+src_mesh.Compute()
+
+
+# Mesh the box using projection algoritms
+
+# Define the same global 1D and 2D hypotheses
+tgt_mesh = Mesh(box, "Target mesh")
+tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True)
+tgt_mesh.Quadrangle()
+
+# Define Projection 1D algorithm to project 1d mesh elements from group edgesF2 to edgesF1
+# It is actually not needed, just a demonstration
+proj1D = tgt_mesh.Projection1D( edgesF1 )
+# each vertex must be at the end of a connected group of edges (or a sole edge)
+proj1D.SourceEdge( edgesF2, src_mesh, v2F1, v2F2 )
+
+# Define 2D hypotheses to project triangles from f1 face of the source mesh to
+# f2 face in the target mesh. Vertices specify how to associate sides of faces
+proj2D = tgt_mesh.Projection2D( f2 )
+proj2D.SourceFace( f1, src_mesh, v1F1, v1F2, v2F1, v2F2 )
+
+# 2D hypotheses to project triangles from f2 of target mesh to the face opposite to f2.
+# Association of face sides is default
+proj2D = tgt_mesh.Projection2D( f2opp )
+proj2D.SourceFace( f2 )
+
+# 3D hypotheses to project prisms from the source to the target mesh
+proj3D = tgt_mesh.Projection3D()
+proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 )
+tgt_mesh.Compute()
+
+# Move the source mesh to visualy compare the two meshes
+src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
diff --git a/doc/salome/examples/defining_hypotheses_ex11.py b/doc/salome/examples/defining_hypotheses_ex11.py
new file mode 100644 (file)
index 0000000..be55047
--- /dev/null
@@ -0,0 +1,31 @@
+# Projection 1D2D
+
+# Project triangles from one meshed face to another mesh on the same box
+
+from smesh import *
+
+# Prepare geometry
+
+# Create a box
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+
+# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
+faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+# 2 adjacent faces of the box
+Face_1 = faces[2]
+Face_2 = faces[0]
+
+geompy.addToStudy( box, 'box' )
+geompy.addToStudyInFather( box, Face_1, 'Face_1' )
+geompy.addToStudyInFather( box, Face_2, 'Face_2' )
+
+# Make the source mesh with Netgem2D
+src_mesh = Mesh(Face_1, "Source mesh")
+src_mesh.Segment().NumberOfSegments(15)
+src_mesh.Triangle()
+src_mesh.Compute()
+
+# Mesh the target mesh using the algoritm Projection1D2D
+tgt_mesh = smesh.Mesh(Face_2, "Target mesh")
+tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh)
+tgt_mesh.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex12.py b/doc/salome/examples/defining_hypotheses_ex12.py
new file mode 100644 (file)
index 0000000..dd891a7
--- /dev/null
@@ -0,0 +1,36 @@
+# 1D Mesh with Fixed Points example
+
+import salome
+import geompy
+import smesh
+import StdMeshers
+
+# Create face and explode it on edges
+face = geompy.MakeFaceHW(100, 100, 1)
+edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"])
+geompy.addToStudy( face, "Face" )
+
+# get the first edge from exploded result
+edge1 = geompy.GetSubShapeID(face, edges[0])
+
+# Define Mesh on previously created face
+Mesh_1 = smesh.Mesh(face)
+
+# Create Fixed Point 1D hypothesis and define parameters.
+# Note: values greater than 1.0 and less than 0.0 are not taken into account;
+# duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0
+# add added automatically.
+# The number of segments should correspond to the number of points (NbSeg = NbPnt-1);
+# extra values of segments splitting parameter are not taken into account,
+# while missing values are considered to be equal to 1.
+Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D')
+Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
+Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
+Fixed_points_1D_1.SetReversedEdges( [edge1] )
+
+# Add hypothesis to mesh and define 2D parameters
+Mesh_1.AddHypothesis(Fixed_points_1D_1)
+Regular_1D = Mesh_1.Segment()
+Quadrangle_2D = Mesh_1.Quadrangle()
+# Compute mesh
+Mesh_1.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex13.py b/doc/salome/examples/defining_hypotheses_ex13.py
new file mode 100644 (file)
index 0000000..2839849
--- /dev/null
@@ -0,0 +1,34 @@
+# Radial Quadrangle 1D2D example
+
+from smesh import *
+
+SetCurrentStudy(salome.myStudy)
+
+# Create face from the wire and add to study
+Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
+geompy.addToStudy(Face,"Face")
+edges = geompy.SubShapeAllSorted(Face, geompy.ShapeType["EDGE"])
+circle, radius1, radius2 = edges
+geompy.addToStudyInFather(Face, radius1,"radius1")
+geompy.addToStudyInFather(Face, radius2,"radius2")
+geompy.addToStudyInFather(Face, circle,"circle")
+
+
+# Define geometry for mesh, and Radial Quadrange algorithm
+mesh = smesh.Mesh(Face)
+radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD)
+
+# The Radial Quadrange algorithm can work without any hypothesis
+# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
+mesh.Compute()
+
+# The Radial Quadrange uses global or local 1d hypotheses if it does
+# not have its own hypotheses.
+# Define global hypotheses to discretize radial edges and a local one for circular edge
+global_Nb_Segments = mesh.Segment().NumberOfSegments(5)
+local_Nb_Segments  = mesh.Segment(circle).NumberOfSegments(10)
+mesh.Compute()
+
+# Define own parameters of Radial Quadrange algorithm
+radial_Quad_algo.NumberOfLayers( 4 )
+mesh.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex14.py b/doc/salome/examples/defining_hypotheses_ex14.py
new file mode 100644 (file)
index 0000000..6c93e3d
--- /dev/null
@@ -0,0 +1,26 @@
+# Quadrangle Parameters example 1 (meshing a face with 3 edges)
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+# Get 1/4 part from the disk face.
+Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
+Disk_1 = geompy.MakeDiskR(100, 1)
+Common_1 = geompy.MakeCommon(Disk_1, Box_1)
+geompy.addToStudy( Disk_1, "Disk_1" )
+geompy.addToStudy( Box_1, "Box_1" )
+geompy.addToStudy( Common_1, "Common_1" )
+
+# Set the Geometry for meshing
+Mesh_1 = smesh.Mesh(Common_1)
+
+
+# Define 1D hypothesis and compute the mesh
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
+Nb_Segments_1.SetDistrType( 0 )
+
+# Create Quadrangle parameters and define the Base Vertex.
+Quadrangle_2D = Mesh_1.Quadrangle().TriangleVertex( 8 )
+
+Mesh_1.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex15.py b/doc/salome/examples/defining_hypotheses_ex15.py
new file mode 100644 (file)
index 0000000..a08dfbf
--- /dev/null
@@ -0,0 +1,47 @@
+# Quadrangle Parameters example 2 (using different types)
+
+import geompy
+import smesh
+import StdMeshers
+
+# Make quadrangle face and explode it on edges.
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(40, 0, 0)
+Vertex_3 = geompy.MakeVertex(40, 30, 0)
+Vertex_4 = geompy.MakeVertex(0, 30, 0)
+Quadrangle_Face_1 = geompy.MakeQuad4Vertices(Vertex_1, Vertex_4, Vertex_3, Vertex_2)
+[Edge_1,Edge_2,Edge_3,Edge_4] = geompy.SubShapeAllSorted(Quadrangle_Face_1, geompy.ShapeType["EDGE"])
+geompy.addToStudy( Vertex_1, "Vertex_1" )
+geompy.addToStudy( Vertex_2, "Vertex_2" )
+geompy.addToStudy( Vertex_3, "Vertex_3" )
+geompy.addToStudy( Vertex_4, "Vertex_4" )
+geompy.addToStudy( Quadrangle_Face_1, "Quadrangle Face_1" )
+geompy.addToStudyInFather( Quadrangle_Face_1, Edge_2, "Edge_2" )
+
+# Set the Geometry for meshing
+Mesh_1 = smesh.Mesh(Quadrangle_Face_1)
+
+# Create Quadrangle parameters and
+# define the Type as Quadrangle Preference
+Quadrangle_Parameters_1 = smesh.CreateHypothesis('QuadrangleParams')
+Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_QUADRANGLE_PREF )
+
+# Define other hypotheses and algorithms
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(4)
+Nb_Segments_1.SetDistrType( 0 )
+status = Mesh_1.AddHypothesis(Quadrangle_Parameters_1)
+Quadrangle_2D = Mesh_1.Quadrangle()
+
+# Define submesh on one edge to provide different number of segments
+Regular_1D_1 = Mesh_1.Segment(geom=Edge_2)
+Nb_Segments_2 = Regular_1D_1.NumberOfSegments(10)
+Nb_Segments_2.SetDistrType( 0 )
+SubMesh_1 = Regular_1D_1.GetSubMesh()
+
+# Compute mesh (with Quadrangle Preference type)
+isDone = Mesh_1.Compute()
+
+# Change type to Reduced and compute again
+Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_REDUCED )
+isDone = Mesh_1.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex16.py b/doc/salome/examples/defining_hypotheses_ex16.py
new file mode 100644 (file)
index 0000000..4930340
--- /dev/null
@@ -0,0 +1,43 @@
+# "Use Existing Elements" example
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+# Make a patritioned box
+
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+
+N = geompy.MakeVectorDXDYDZ( 1,0,0 )
+O = geompy.MakeVertex( 50,0,0 )
+plane = geompy.MakePlane( O, N, 200 ) # plane YOZ
+
+shape2boxes = geompy.MakeHalfPartition( box, plane )
+boxes = geompy.SubShapeAllSorted(shape2boxes, geompy.ShapeType["SOLID"])
+
+geompy.addToStudy( boxes[0], "boxes[0]")
+geompy.addToStudy( boxes[1], "boxes[1]")
+midFace0 = geompy.SubShapeAllSorted(boxes[0], geompy.ShapeType["FACE"])[5]
+geompy.addToStudyInFather( boxes[0], midFace0, "middle Face")
+midFace1 = geompy.SubShapeAllSorted(boxes[1], geompy.ShapeType["FACE"])[0]
+geompy.addToStudyInFather( boxes[1], midFace1, "middle Face")
+
+# Mesh one of boxes with quadrangles. It is a source mesh
+
+srcMesh = Mesh(boxes[0], "source mesh") # box coloser to CS origin
+nSeg1 = srcMesh.Segment().NumberOfSegments(4)
+srcMesh.Quadrangle()
+srcMesh.Compute()
+srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", FACE )
+
+# Import faces from midFace0 to the target mesh
+
+tgtMesh = Mesh(boxes[1], "target mesh")
+importAlgo = tgtMesh.UseExisting2DElements(midFace1)
+import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
+tgtMesh.Segment().NumberOfSegments(3)
+tgtMesh.Quadrangle()
+tgtMesh.Compute()
+
+# Import the whole source mesh with groups
+import2hyp.SetCopySourceMesh(True,True)
+tgtMesh.Compute()
diff --git a/doc/salome/examples/defining_hypotheses_ex17.py b/doc/salome/examples/defining_hypotheses_ex17.py
new file mode 100644 (file)
index 0000000..dc3ee9b
--- /dev/null
@@ -0,0 +1,40 @@
+# Viscous layers construction
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+X = geompy.MakeVectorDXDYDZ( 1,0,0 )
+O = geompy.MakeVertex( 100,50,50 )
+plane = geompy.MakePlane( O, X, 200 ) # plane YZ
+
+box = geompy.MakeBoxDXDYDZ(200,100,100)
+
+shape = geompy.MakeHalfPartition( box, plane )
+
+faces = geompy.SubShapeAllSorted(shape, geompy.ShapeType["FACE"])
+face1 = faces[1]
+ignoreFaces = [ faces[0], faces[-1]]
+
+geompy.addToStudy( shape, "shape" )
+geompy.addToStudyInFather( shape, face1, "face1")
+
+
+mesh = Mesh(shape, "CFD")
+
+mesh.Segment().NumberOfSegments( 4 )
+
+mesh.Triangle()
+mesh.Quadrangle(face1)
+mesh.Compute()
+algo3D = mesh.Tetrahedron()
+
+thickness = 20
+numberOfLayers = 10
+stretchFactor = 1.5
+layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFaces)
+
+mesh.Compute()
+
+mesh.MakeGroup("Tetras",VOLUME,FT_ElemGeomType,"=",Geom_TETRA)
+mesh.MakeGroup("Pyras",VOLUME,FT_ElemGeomType,"=",Geom_PYRAMID)
+mesh.MakeGroup("Prims",VOLUME,FT_ElemGeomType,"=",Geom_PENTA)
diff --git a/doc/salome/examples/filters_ex01.py b/doc/salome/examples/filters_ex01.py
new file mode 100644 (file)
index 0000000..9869047
--- /dev/null
@@ -0,0 +1,8 @@
+# Aspect ratio
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with aspect ratio > 6.5
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with aspect ratio > 6.5:", len(ids)
diff --git a/doc/salome/examples/filters_ex02.py b/doc/salome/examples/filters_ex02.py
new file mode 100644 (file)
index 0000000..f692173
--- /dev/null
@@ -0,0 +1,10 @@
+# Aspect ratio 3D
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get volumes with aspect ratio < 2.0
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_LessThan, 2.0)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of volumes with aspect ratio < 2.0:", len(ids)
diff --git a/doc/salome/examples/filters_ex03.py b/doc/salome/examples/filters_ex03.py
new file mode 100644 (file)
index 0000000..5afe3a4
--- /dev/null
@@ -0,0 +1,11 @@
+# Warping angle
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
+criterion = smesh.GetCriterion(smesh.FACE, smesh.FT_Warping, smesh.FT_EqualTo, 2.0e-13)
+criterion.Tolerance = 5.0e-14
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion])
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids)
diff --git a/doc/salome/examples/filters_ex04.py b/doc/salome/examples/filters_ex04.py
new file mode 100644 (file)
index 0000000..d4d31a7
--- /dev/null
@@ -0,0 +1,8 @@
+# Minimum angle
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with minimum angle > 75
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 75)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with minimum angle > 75:", len(ids)
diff --git a/doc/salome/examples/filters_ex05.py b/doc/salome/examples/filters_ex05.py
new file mode 100644 (file)
index 0000000..b152251
--- /dev/null
@@ -0,0 +1,8 @@
+# Taper
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with taper < 1.e-15
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_LessThan, 1.e-15)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with taper < 1.e-15:", len(ids)
diff --git a/doc/salome/examples/filters_ex06.py b/doc/salome/examples/filters_ex06.py
new file mode 100644 (file)
index 0000000..0f609a5
--- /dev/null
@@ -0,0 +1,8 @@
+# Skew
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with skew > 50
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 50)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with skew > 50:", len(ids)
diff --git a/doc/salome/examples/filters_ex07.py b/doc/salome/examples/filters_ex07.py
new file mode 100644 (file)
index 0000000..723d8d2
--- /dev/null
@@ -0,0 +1,12 @@
+# Area
+
+# create mesh
+from SMESH_mechanic import *
+# get faces with area > 60 and < 90
+criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 60,\
+                                smesh.FT_Undefined, smesh.FT_LogicalAND)
+criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 90)
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion1,criterion2])
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with area in range (60,90):", len(ids)
diff --git a/doc/salome/examples/filters_ex08.py b/doc/salome/examples/filters_ex08.py
new file mode 100644 (file)
index 0000000..2bc96b6
--- /dev/null
@@ -0,0 +1,10 @@
+# Volume
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get volumes faces with volume > 100
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_MoreThan, 100)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of volumes with volume > 100:", len(ids)
diff --git a/doc/salome/examples/filters_ex09.py b/doc/salome/examples/filters_ex09.py
new file mode 100644 (file)
index 0000000..0d045b7
--- /dev/null
@@ -0,0 +1,14 @@
+# Free borders
+
+# create mesh
+import geompy, smesh, StdMeshers
+face = geompy.MakeFaceHW(100, 100, 1)
+geompy.addToStudy( face, "quadrangle" )
+mesh = smesh.Mesh(face)
+mesh.Segment().NumberOfSegments(10)
+mesh.Triangle().MaxElementArea(25)
+mesh.Compute()
+# get all free borders
+filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of edges on free borders:", len(ids)
diff --git a/doc/salome/examples/filters_ex10.py b/doc/salome/examples/filters_ex10.py
new file mode 100644 (file)
index 0000000..bbbdd98
--- /dev/null
@@ -0,0 +1,14 @@
+# Free edges
+
+# create mesh
+import geompy, smesh, StdMeshers
+face = geompy.MakeFaceHW(100, 100, 1)
+geompy.addToStudy( face, "quadrangle" )
+mesh = smesh.Mesh(face)
+mesh.Segment().NumberOfSegments(10)
+mesh.Triangle().MaxElementArea(25)
+mesh.Compute()
+# get all faces with free edges
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeEdges)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with free edges:", len(ids)
diff --git a/doc/salome/examples/filters_ex11.py b/doc/salome/examples/filters_ex11.py
new file mode 100644 (file)
index 0000000..4d754bc
--- /dev/null
@@ -0,0 +1,10 @@
+# Free nodes
+
+# create mesh
+from SMESH_mechanic import *
+# add node
+mesh.AddNode(0,0,0)
+# get all free nodes
+filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of free nodes:", len(ids)
diff --git a/doc/salome/examples/filters_ex12.py b/doc/salome/examples/filters_ex12.py
new file mode 100644 (file)
index 0000000..dfb0f40
--- /dev/null
@@ -0,0 +1,8 @@
+# Free faces
+
+# create mesh
+from SMESH_mechanic import *
+# get all free faces
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of free faces:", len(ids)
diff --git a/doc/salome/examples/filters_ex13.py b/doc/salome/examples/filters_ex13.py
new file mode 100644 (file)
index 0000000..d5415e2
--- /dev/null
@@ -0,0 +1,10 @@
+# Bare border faces
+
+# create mesh
+from SMESH_mechanic import *
+# remove some faces to have faces with bare borders
+mesh.RemoveElements( mesh.GetElementsByType(FACE)[0:5] )
+# get all faces bare borders
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace)
+ids = mesh.GetIdsFromFilter(filter)
+print "Faces with bare borders:", ids
diff --git a/doc/salome/examples/filters_ex14.py b/doc/salome/examples/filters_ex14.py
new file mode 100644 (file)
index 0000000..45c356c
--- /dev/null
@@ -0,0 +1,9 @@
+# Coplanar faces
+
+# create mesh
+from SMESH_mechanic import *
+faceID = mesh.GetElementsByType(FACE)[0]
+# get all faces co-planar to the first face with tolerance 5 degrees
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_CoplanarFaces,faceID,Tolerance=5.0)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces coplanar with the first one:", len(ids)
diff --git a/doc/salome/examples/filters_ex15.py b/doc/salome/examples/filters_ex15.py
new file mode 100644 (file)
index 0000000..2044c60
--- /dev/null
@@ -0,0 +1,7 @@
+# Over-constrained faces
+# create mesh
+from SMESH_mechanic import *
+# get all over-constrained faces
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_OverConstrainedFace)
+ids = mesh.GetIdsFromFilter(filter)
+print "Over-constrained faces:", ids
diff --git a/doc/salome/examples/filters_ex16.py b/doc/salome/examples/filters_ex16.py
new file mode 100644 (file)
index 0000000..3c7159d
--- /dev/null
@@ -0,0 +1,21 @@
+# Double edges, Double faces, Double volumes
+
+from smesh import *
+# make a mesh on a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+mesh = Mesh( box, "Box" )
+mesh.Segment().NumberOfSegments(10)
+mesh.Quadrangle()
+mesh.Hexahedron()
+mesh.Compute()
+# copy all elements with translation and Merge nodes
+mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
+mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) )
+# create filters to find equal elements
+equalEdgesFilter   = GetFilter(SMESH.EDGE, FT_EqualEdges)
+equalFacesFilter   = GetFilter(SMESH.FACE, FT_EqualFaces)
+equalVolumesFilter = GetFilter(SMESH.VOLUME, FT_EqualVolumes)
+# get equal elements
+print "Number of equal edges:",   len( mesh.GetIdsFromFilter( equalEdgesFilter ))
+print "Number of equal faces:",   len( mesh.GetIdsFromFilter( equalFacesFilter ))
+print "Number of equal volumes:", len( mesh.GetIdsFromFilter( equalVolumesFilter ))
diff --git a/doc/salome/examples/filters_ex17.py b/doc/salome/examples/filters_ex17.py
new file mode 100644 (file)
index 0000000..b79f4a7
--- /dev/null
@@ -0,0 +1,16 @@
+# Double nodes
+
+from smesh import *
+# make a mesh on a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+mesh = Mesh( box, "Box" )
+mesh.Segment().NumberOfSegments(10)
+mesh.Quadrangle()
+mesh.Hexahedron()
+mesh.Compute()
+# copy all elements with translation
+mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
+# create filters to find nodes equal within tolerance of 1e-5
+filter = GetFilter(SMESH.NODE, FT_EqualNodes, Tolerance=1e-5)
+# get equal nodes
+print "Number of equal nodes:", len( mesh.GetIdsFromFilter( filter ))
diff --git a/doc/salome/examples/filters_ex18.py b/doc/salome/examples/filters_ex18.py
new file mode 100644 (file)
index 0000000..30158e2
--- /dev/null
@@ -0,0 +1,8 @@
+# Borders at multi-connection
+
+# create mesh
+from SMESH_mechanic import *
+# get border edges with number of connected faces = 5
+filter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, 5)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of border edges with 5 faces connected:", len(ids)
diff --git a/doc/salome/examples/filters_ex19.py b/doc/salome/examples/filters_ex19.py
new file mode 100644 (file)
index 0000000..41b7cc7
--- /dev/null
@@ -0,0 +1,8 @@
+# Borders at multi-connection 2D
+
+# create mesh
+from SMESH_mechanic import *
+# get faces which consist of edges belonging to 2 mesh elements
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, 2)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces consisting of edges belonging to 2 faces:", len(ids)
diff --git a/doc/salome/examples/filters_ex20.py b/doc/salome/examples/filters_ex20.py
new file mode 100644 (file)
index 0000000..37227c4
--- /dev/null
@@ -0,0 +1,8 @@
+# Length
+
+# create mesh
+from SMESH_mechanic import *
+# get edges with length > 14
+filter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, 14)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of edges with length > 14:", len(ids)
diff --git a/doc/salome/examples/filters_ex21.py b/doc/salome/examples/filters_ex21.py
new file mode 100644 (file)
index 0000000..0882fe2
--- /dev/null
@@ -0,0 +1,8 @@
+# Length 2D
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces that have edges with length > 14
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, 14)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with maximum edge length > 14:", len(ids)
diff --git a/doc/salome/examples/filters_ex22.py b/doc/salome/examples/filters_ex22.py
new file mode 100644 (file)
index 0000000..f654217
--- /dev/null
@@ -0,0 +1,8 @@
+# Element Diameter 2D
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces that have elements with length > 10
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces with maximum element length > 10:", len(ids)
diff --git a/doc/salome/examples/filters_ex23.py b/doc/salome/examples/filters_ex23.py
new file mode 100644 (file)
index 0000000..848f8d9
--- /dev/null
@@ -0,0 +1,10 @@
+# Element Diameter 3D
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all volumes that have elements with length > 10
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, 10)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of volumes with maximum element length > 10:", len(ids)
diff --git a/doc/salome/examples/filters_ex24.py b/doc/salome/examples/filters_ex24.py
new file mode 100644 (file)
index 0000000..036ba03
--- /dev/null
@@ -0,0 +1,12 @@
+# Bare border volumes
+
+# create mesh
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# remove some volumes to have volumes with bare borders
+mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] )
+# get all volumes with bare borders
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BareBorderVolume)
+ids = mesh.GetIdsFromFilter(filter)
+print "Volumes with bare borders:", ids
diff --git a/doc/salome/examples/filters_ex25.py b/doc/salome/examples/filters_ex25.py
new file mode 100644 (file)
index 0000000..7e44898
--- /dev/null
@@ -0,0 +1,10 @@
+# Over-constrained volumes
+
+# create mesh
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all over-constrained volumes
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_OverConstrainedVolume)
+ids = mesh.GetIdsFromFilter(filter)
+print "Over-constrained volumes:", ids
diff --git a/doc/salome/examples/filters_ex26.py b/doc/salome/examples/filters_ex26.py
new file mode 100644 (file)
index 0000000..3c5ce29
--- /dev/null
@@ -0,0 +1,8 @@
+# Belong to Geom
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces which nodes lie on the face sub_face3
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToGeom, sub_face3)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces which nodes lie on sub_face3:", len(ids)
diff --git a/doc/salome/examples/filters_ex27.py b/doc/salome/examples/filters_ex27.py
new file mode 100644 (file)
index 0000000..10067ea
--- /dev/null
@@ -0,0 +1,8 @@
+# Lying on Geom
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces at least one node of each lies on the face sub_face3
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_LyingOnGeom, sub_face3)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces at least one node of each lies on sub_face3:", len(ids)
diff --git a/doc/salome/examples/filters_ex28.py b/doc/salome/examples/filters_ex28.py
new file mode 100644 (file)
index 0000000..032b966
--- /dev/null
@@ -0,0 +1,12 @@
+# Belong to Plane
+
+# create mesh
+from SMESH_mechanic import *
+# create plane
+import geompy
+plane_1 = geompy.MakePlane(p3,seg1,2000)
+geompy.addToStudy(plane_1, "plane_1")
+# get all nodes which lie on the plane \a plane_1
+filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToPlane, plane_1)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of nodes which lie on the plane plane_1:", len(ids)
diff --git a/doc/salome/examples/filters_ex29.py b/doc/salome/examples/filters_ex29.py
new file mode 100644 (file)
index 0000000..c256724
--- /dev/null
@@ -0,0 +1,8 @@
+# Belong to Cylinder
+
+# create mesh
+from SMESH_mechanic import *
+# get all faces which lie on the cylindrical face \a sub_face1
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToCylinder, sub_face1)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids)
diff --git a/doc/salome/examples/filters_ex30.py b/doc/salome/examples/filters_ex30.py
new file mode 100644 (file)
index 0000000..19c2138
--- /dev/null
@@ -0,0 +1,12 @@
+# Belong to Surface
+
+# create mesh
+from SMESH_mechanic import *
+# create b-spline
+spline_1 = geompy.MakeInterpol([p4,p6,p3,p1])
+surface_1 = geompy.MakePrismVecH( spline_1, vz, 70.0 )
+geompy.addToStudy(surface_1, "surface_1")
+# get all nodes which lie on the surface \a surface_1
+filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToGenSurface, surface_1)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of nodes which lie on the surface surface_1:", len(ids)
diff --git a/doc/salome/examples/filters_ex31.py b/doc/salome/examples/filters_ex31.py
new file mode 100644 (file)
index 0000000..a20f7d7
--- /dev/null
@@ -0,0 +1,12 @@
+# Range of IDs
+
+# create mesh
+from SMESH_mechanic import *
+# get nodes with identifiers [5-10] and [15-30]
+criterion1 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Treshold="5-10",\
+                                BinaryOp=smesh.FT_LogicalOR)
+criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Treshold="15-30")
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion1,criterion2])
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of nodes in ranges [5-10] and [15-30]:", len(ids)
diff --git a/doc/salome/examples/filters_ex32.py b/doc/salome/examples/filters_ex32.py
new file mode 100644 (file)
index 0000000..726ca15
--- /dev/null
@@ -0,0 +1,10 @@
+# Badly oriented volume
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all badly oriented volumes
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BadOrientedVolume)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of badly oriented volumes:", len(ids)
diff --git a/doc/salome/examples/filters_ex33.py b/doc/salome/examples/filters_ex33.py
new file mode 100644 (file)
index 0000000..2fbaab0
--- /dev/null
@@ -0,0 +1,17 @@
+# Linear / quadratic
+
+# create mesh
+from SMESH_mechanic import *
+# get number of linear and quadratic edges
+filter_linear = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic)
+filter_quadratic = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic, smesh.FT_LogicalNOT)
+ids_linear = mesh.GetIdsFromFilter(filter_linear)
+ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
+print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
+# convert mesh to quadratic
+print "Convert to quadratic..."
+mesh.ConvertToQuadratic(True)
+# get number of linear and quadratic edges
+ids_linear = mesh.GetIdsFromFilter(filter_linear)
+ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
+print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
diff --git a/doc/salome/examples/filters_ex34.py b/doc/salome/examples/filters_ex34.py
new file mode 100644 (file)
index 0000000..8e63056
--- /dev/null
@@ -0,0 +1,14 @@
+# Group color
+
+# create mesh
+from SMESH_mechanic import *
+# create group of edges
+all_edges = mesh.GetElementsByType(smesh.EDGE)
+grp = mesh.MakeGroupByIds("edges group", smesh.EDGE, all_edges[:len(all_edges)/4])
+import SALOMEDS
+c = SALOMEDS.Color(0.1, 0.5, 1.0)
+grp.SetColor(c)
+# get number of the edges not belonging to the group with the given color
+filter = smesh.GetFilter(smesh.EDGE, smesh.FT_GroupColor, c, smesh.FT_LogicalNOT)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids)
diff --git a/doc/salome/examples/filters_ex35.py b/doc/salome/examples/filters_ex35.py
new file mode 100644 (file)
index 0000000..369d732
--- /dev/null
@@ -0,0 +1,19 @@
+# Geometry type
+
+# create mesh with volumes
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all triangles, quadrangles, tetrahedrons, pyramids
+filter_tri = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_TRIANGLE)
+filter_qua = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE)
+filter_tet = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_TETRA)
+filter_pyr = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_PYRAMID)
+ids_tri = mesh.GetIdsFromFilter(filter_tri)
+ids_qua = mesh.GetIdsFromFilter(filter_qua)
+ids_tet = mesh.GetIdsFromFilter(filter_tet)
+ids_pyr = mesh.GetIdsFromFilter(filter_pyr)
+print "Number of triangles:", len(ids_tri)
+print "Number of quadrangles:", len(ids_qua)
+print "Number of tetrahedrons:", len(ids_tet)
+print "Number of pyramids:", len(ids_pyr)
diff --git a/doc/salome/examples/filters_ex36.py b/doc/salome/examples/filters_ex36.py
new file mode 100644 (file)
index 0000000..7675bc9
--- /dev/null
@@ -0,0 +1,13 @@
+# Combine filters with Criterion structures using of "criteria".
+
+# create mesh
+from SMESH_mechanic import *
+# get all the quadrangle faces ...
+criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE, smesh.FT_LogicalAND)
+# ... AND do NOT get those from sub_face3
+criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_BelongToGeom, sub_face3, smesh.FT_LogicalNOT)
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion1,criterion2])
+ids = mesh.GetIdsFromFilter(filter)
+
+myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",smesh.FACE,ids)
diff --git a/doc/salome/examples/generate_flat_elements.py b/doc/salome/examples/generate_flat_elements.py
new file mode 100644 (file)
index 0000000..a23c200
--- /dev/null
@@ -0,0 +1,57 @@
+# Double nodes on groups boundaries
+
+# This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).
+# The big cylinder is defined by two geometric volumes.
+
+import geompy
+import smesh
+import SMESH
+
+# geometry 
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Vertex_1 = geompy.MakeVertex(50, 0, 0)
+Cylinder_1 = geompy.MakeCylinder(O, OX, 10, 500)
+Cylinder_2 = geompy.MakeCylinder(Vertex_1, OX, 100, 400)
+Vertex_2 = geompy.MakeVertex(-200, -200, -200)
+Vertex_3 = geompy.MakeVertex(250, 200, 200)
+Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3)
+Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2)
+Partition_1 = geompy.MakePartition([Fuse_1], [Cylinder_1, Box_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
+[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
+Vertex_4 = geompy.MakeVertex(450, 0, 0)
+Vertex_5 = geompy.MakeVertex(500, 0, 0)
+Vertex_6 = geompy.MakeVertex(550, 0, 0)
+vec1 = geompy.MakeVector(Vertex_4, Vertex_5)
+vec2 = geompy.MakeVector(Vertex_5, Vertex_6)
+[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, geompy.GEOM.ST_ON)
+[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, geompy.GEOM.ST_ON)
+
+# meshing (we have linear tetrahedrons here, but other elements are OK)
+
+Mesh_1 = smesh.Mesh(Partition_1)
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
+MEFISTO_2D = Mesh_1.Triangle(algo=smesh.MEFISTO)
+Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges()
+ALGO3D = Mesh_1.Tetrahedron()
+isDone = Mesh_1.Compute()
+
+# relevant groups of volumes and faces
+
+Solid_1_1 = Mesh_1.GroupOnGeom(Solid_1,'Solid_1',SMESH.VOLUME)
+Solid_2_1 = Mesh_1.GroupOnGeom(Solid_2,'Solid_2',SMESH.VOLUME)
+Solid_3_1 = Mesh_1.GroupOnGeom(Solid_3,'Solid_3',SMESH.VOLUME)
+Solid_4_1 = Mesh_1.GroupOnGeom(Solid_4,'Solid_4',SMESH.VOLUME)
+Face_1_1 = Mesh_1.GroupOnGeom(Face_1,'Face_1',SMESH.FACE)
+Face_2_1 = Mesh_1.GroupOnGeom(Face_2,'Face_2',SMESH.FACE)
+
+# Building of flat elements
+
+Mesh_1.DoubleNodesOnGroupBoundaries([Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1], 1)
+
+Mesh_1.CreateFlatElementsOnFacesGroups([Face_1_1, Face_2_1])
diff --git a/doc/salome/examples/grouping_elements_ex01.py b/doc/salome/examples/grouping_elements_ex01.py
new file mode 100644 (file)
index 0000000..d0971d6
--- /dev/null
@@ -0,0 +1,21 @@
+# Create a Standalone Group
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Get ids of all faces with area > 100 
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# create a group consisting of faces with area > 100
+aGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
+
+# create a group that contains all nodes from the mesh
+aGroup2 = mesh.CreateEmptyGroup(smesh.NODE, "all nodes")
+aGroup2.AddFrom(mesh.mesh)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex02.py b/doc/salome/examples/grouping_elements_ex02.py
new file mode 100644 (file)
index 0000000..228248d
--- /dev/null
@@ -0,0 +1,39 @@
+# Create a Group on Geometry
+
+import salome
+import geompy
+import smesh
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
+geompy.addToStudy(box, "box")
+
+# add the first face of the box to the study
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+geompy.addToStudyInFather(box, face, "face 1") 
+
+# create group of edges on the face
+aGeomGroupE = geompy.CreateGroup(face, geompy.ShapeType["EDGE"])
+geompy.AddObject(aGeomGroupE, 3)
+geompy.AddObject(aGeomGroupE, 6)
+geompy.AddObject(aGeomGroupE, 8)
+geompy.AddObject(aGeomGroupE, 10)
+geompy.addToStudyInFather(face, aGeomGroupE, "Group of Edges")
+
+# create quadrangle 2D mesh on the box
+quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
+algo1D = quadra.Segment()
+quadra.Quadrangle()
+algo1D.NumberOfSegments(7) 
+
+# compute the mesh
+quadra.Compute()
+
+# create SMESH group on the face with name "SMESHGroup1"
+aSmeshGroup1 = quadra.GroupOnGeom(face, "SMESHGroup1")
+
+# create SMESH group on <aGeomGroupE> with default name
+aSmeshGroup2 = quadra.GroupOnGeom(aGeomGroupE) 
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex03.py b/doc/salome/examples/grouping_elements_ex03.py
new file mode 100644 (file)
index 0000000..05fb69d
--- /dev/null
@@ -0,0 +1,39 @@
+# Create a Group on Filter
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+box = geompy.MakeBoxDXDYDZ(10,10,10)
+
+# make a mesh with quadrangles of different area in range [1,16]
+mesh = Mesh(box,"Quad mesh")
+hyp1D = mesh.Segment().StartEndLength( 1, 4 )
+mesh.Quadrangle()
+mesh.Compute()
+
+# create a group on filter selecting faces of medium size
+critaria = [ \
+    GetCriterion(FACE, FT_Area, ">", 1.1, BinaryOp=FT_LogicalAND ),
+    GetCriterion(FACE, FT_Area, "<", 15.0 )
+    ]
+filt = GetFilterFromCriteria( critaria )
+filtGroup = mesh.GroupOnFilter( FACE, "group on filter", filt )
+print "Group on filter contains %s elemens" % filtGroup.Size()
+
+# group on filter is updated if the mesh is modified
+hyp1D.SetStartLength( 2.5 )
+hyp1D.SetEndLength( 2.5 )
+mesh.Compute()
+print "After mesh change, group on filter contains %s elemens" % filtGroup.Size()
+
+# set a new filter defining the group
+filt2 = GetFilter( FACE, FT_RangeOfIds, "1-50" )
+filtGroup.SetFilter( filt2 )
+print "With a new filter, group on filter contains %s elemens" % filtGroup.Size()
+
+# group is updated at modification of the filter
+filt2.SetCriteria( [ GetCriterion( FACE, FT_RangeOfIds, "1-70" )])
+filtIDs3 = filtGroup.GetIDs()
+print "After filter modification, group on filter contains %s elemens" % filtGroup.Size()
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex04.py b/doc/salome/examples/grouping_elements_ex04.py
new file mode 100644 (file)
index 0000000..730a2ca
--- /dev/null
@@ -0,0 +1,43 @@
+# Edit a Group
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Get ids of all faces with area > 35
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 35.)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+print "Criterion: Area > 35, Nb = ", len(anIds)
+
+# create a group by adding elements with area > 35
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > 35")
+aGroup.Add(anIds) 
+
+# Get ids of all faces with area > 40
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 40.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 40, Nb = ", len(anIds) 
+
+# create a group of elements with area [35; 40] by removing elements with area > 40 from group aGroup
+aGroup.Remove(anIds) 
+
+# print the result
+aGroupElemIDs = aGroup.GetListOfID()
+
+print "Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs)
+
+j = 1
+for i in range(len(aGroupElemIDs)):
+  if j > 20: j = 1; print ""
+  print aGroupElemIDs[i],
+  j = j + 1
+  pass
+print ""
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex05.py b/doc/salome/examples/grouping_elements_ex05.py
new file mode 100644 (file)
index 0000000..90453fe
--- /dev/null
@@ -0,0 +1,52 @@
+# Union of groups
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 20, Nb = ", len( anIds ) 
+
+# create a group by adding elements with area > 20
+aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
+aGroup1.Add(anIds)
+
+# Criterion : AREA = 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area = 20, Nb = ", len( anIds ) 
+
+# create a group by adding elements with area = 20
+aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" )
+
+aGroup2.Add(anIds)
+
+# create union group : area >= 20
+aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20")
+print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
+# Please note that also there is UnionGroups() method which works with two groups only
+
+# Criterion : AREA < 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area < 20, Nb = ", len(anIds)
+
+# create a group by adding elements with area < 20
+aGroup4 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 20")
+aGroup4.Add(anIds)
+
+# create union group : area >= 20 and area < 20
+aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area")
+print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex06.py b/doc/salome/examples/grouping_elements_ex06.py
new file mode 100644 (file)
index 0000000..cc8146f
--- /dev/null
@@ -0,0 +1,36 @@
+# Intersection of groups
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 20, Nb = ", len(anIds) 
+
+# create a group by adding elements with area > 20
+aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
+aGroup1.Add(anIds)
+
+# Criterion : AREA < 60
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area < 60, Nb = ", len(anIds) 
+
+# create a group by adding elements with area < 60
+aGroup2 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 60")
+aGroup2.Add(anIds)
+
+# create an intersection of groups : 20 < area < 60
+aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60")
+print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())
+# Please note that also there is IntersectGroups() method which works with two groups only
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex07.py b/doc/salome/examples/grouping_elements_ex07.py
new file mode 100644 (file)
index 0000000..5bcccd0
--- /dev/null
@@ -0,0 +1,34 @@
+# Cut of groups
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 20
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 20, Nb = ", len(anIds) 
+
+# create a group by adding elements with area > 20
+aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)
+
+# Criterion : AREA < 60
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area < 60, Nb = ", len(anIds) 
+
+# create a group by adding elements with area < 60
+aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
+# create a cut of groups : area >= 60
+aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
+print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())
+# Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/grouping_elements_ex08.py b/doc/salome/examples/grouping_elements_ex08.py
new file mode 100644 (file)
index 0000000..a86ec63
--- /dev/null
@@ -0,0 +1,35 @@
+# Creating groups of entities from existing groups of superior dimensions
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 100
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area > 100, Nb = ", len(anIds) 
+
+# create a group by adding elements with area > 100
+aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
+
+# Criterion : AREA < 30
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 30.)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+print "Criterion: Area < 30, Nb = ", len(anIds) 
+
+# create a group by adding elements with area < 30
+aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", smesh.FACE, anIds)
+
+# Create group of edges using source groups of faces
+aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.EDGE, "Edges" )
+
+# Create group of nodes using source groups of faces
+aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.NODE, "Nodes" )
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/measurements_ex01.py b/doc/salome/examples/measurements_ex01.py
new file mode 100644 (file)
index 0000000..9677547
--- /dev/null
@@ -0,0 +1,48 @@
+# Minimum Distance
+
+import smesh
+from SMESH_mechanic import mesh as mesh1
+from SMESH_test1 import mesh as mesh2
+
+mesh1.Compute()
+mesh2.Compute()
+
+# compute min distance from mesh1 to the origin (not available yet)
+smesh.MinDistance(mesh1)
+
+# compute min distance from node 10 of mesh1 to the origin
+smesh.MinDistance(mesh1, id1=10)
+# ... or
+mesh1.MinDistance(10)
+
+# compute min distance between nodes 10 and 20 of mesh1
+smesh.MinDistance(mesh1, id1=10, id2=20)
+# ... or
+mesh1.MinDistance(10, 20)
+
+# compute min distance from element 100 of mesh1 to the origin (not available yet)
+smesh.MinDistance(mesh1, id1=100, isElem1=True)
+# ... or
+mesh1.MinDistance(100, isElem1=True)
+
+# compute min distance between elements 100 and 200 of mesh1 (not available yet)
+smesh.MinDistance(mesh1, id1=100, id2=200, isElem1=True, isElem2=True)
+# ... or
+mesh1.MinDistance(100, 200, True, True)
+
+# compute min distance from element 100 to node 20 of mesh1 (not available yet)
+smesh.MinDistance(mesh1, id1=100, id2=20, isElem1=True)
+# ... or
+mesh1.MinDistance(100, 20, True)
+
+# compute min distance from mesh1 to mesh2 (not available yet)
+smesh.MinDistance(mesh1, mesh2)
+
+# compute min distance from node 10 of mesh1 to node 20 of mesh2
+smesh.MinDistance(mesh1, mesh2, 10, 20)
+
+# compute min distance from node 10 of mesh1 to element 200 of mesh2 (not available yet)
+smesh.MinDistance(mesh1, mesh2, 10, 200, isElem2=True)
+
+# etc...
+
diff --git a/doc/salome/examples/measurements_ex02.py b/doc/salome/examples/measurements_ex02.py
new file mode 100644 (file)
index 0000000..3333bc0
--- /dev/null
@@ -0,0 +1,22 @@
+# Bounding Box
+
+import smesh
+from SMESH_mechanic import mesh as mesh1
+from SMESH_test1 import mesh as mesh2
+
+mesh1.Compute()
+mesh2.Compute()
+
+# compute bounding box for mesh1
+mesh1.BoundingBox()
+
+# compute bounding box for list of nodes of mesh1
+mesh1.BoundingBox([363, 364, 370, 371, 372, 373, 379, 380, 381])
+
+# compute bounding box for list of elements of mesh1
+mesh1.BoundingBox([363, 364, 370, 371, 372, 373, 379, 380, 381], isElem=True)
+
+# compute common bounding box of mesh1 and mesh2
+smesh.BoundingBox([mesh1, mesh2])
+
+# etc...
diff --git a/doc/salome/examples/modifying_meshes_ex01.py b/doc/salome/examples/modifying_meshes_ex01.py
new file mode 100644 (file)
index 0000000..ee183d7
--- /dev/null
@@ -0,0 +1,11 @@
+# Add Node
+
+import smesh
+
+mesh = smesh.Mesh()
+
+# add node
+new_id = mesh.AddNode(50, 10, 0)
+print ""
+if new_id == 0: print "KO node addition."
+else:           print "New Node has been added with ID ", new_id
diff --git a/doc/salome/examples/modifying_meshes_ex02.py b/doc/salome/examples/modifying_meshes_ex02.py
new file mode 100644 (file)
index 0000000..c99bf2a
--- /dev/null
@@ -0,0 +1,15 @@
+# Add 0D Element
+
+import smesh
+
+mesh = smesh.Mesh()
+
+# add node
+node_id = mesh.AddNode(50, 10, 0)
+
+# add 0D Element
+new_id = mesh.Add0DElement(node_id)
+
+print ""
+if new_id == 0: print "KO node addition."
+else:           print "New 0D Element has been added with ID ", new_id
diff --git a/doc/salome/examples/modifying_meshes_ex03.py b/doc/salome/examples/modifying_meshes_ex03.py
new file mode 100644 (file)
index 0000000..19b423e
--- /dev/null
@@ -0,0 +1,42 @@
+# Add 0D Element on Element Nodes
+
+import smesh, SMESH, geompy
+
+# create a geometry
+box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
+face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
+
+# make 3D mesh
+mesh = smesh.Mesh( box )
+mesh.AutomaticHexahedralization(0)
+
+# create 0D elements on all nodes of the mesh
+res = mesh.Add0DElementsToAllNodes( mesh )
+
+# find 0D elements on all nodes of the mesh, all found nodes are added to a new group
+groupName = "0Dmesh"
+res = mesh.Add0DElementsToAllNodes( mesh, groupName )
+mesh.RemoveGroupWithContents( res ) # remove all found 0D elements
+
+# create 0D elements on all nodes of a sub-mesh, with group creation
+groupName = "0Dsubmesh"
+submesh = mesh.GetSubMesh( face, "faceSM")
+res = mesh.Add0DElementsToAllNodes( submesh, groupName )
+
+# create 0D elements on all nodes of a group
+group = mesh.Group( face, "faceGroup" )
+res = mesh.Add0DElementsToAllNodes( group )
+
+# remove all 0D elements
+mesh.RemoveElements( mesh.GetIdsFromFilter( smesh.GetFilter( SMESH.ELEM0D,
+                                                             SMESH.FT_ElemGeomType,
+                                                             "=",SMESH.Geom_POINT )))
+
+# create 0D elements on all nodes of some elements
+res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() )
+
+mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D ))
+
+# create 0D elements on some nodes
+nodes = range(1,10)
+res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE ))
diff --git a/doc/salome/examples/modifying_meshes_ex04.py b/doc/salome/examples/modifying_meshes_ex04.py
new file mode 100644 (file)
index 0000000..5aad0f5
--- /dev/null
@@ -0,0 +1,15 @@
+# Add Edge
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add node
+n1 = mesh.AddNode(50, 10, 0)
+if n1 == 0: print "KO node addition." 
+
+# add edge
+e1 = mesh.AddEdge([n1, 38])
+if e1 == 0: print "KO edge addition."
+else:       print "New Edge has been added with ID ", e1
diff --git a/doc/salome/examples/modifying_meshes_ex05.py b/doc/salome/examples/modifying_meshes_ex05.py
new file mode 100644 (file)
index 0000000..bd1e143
--- /dev/null
@@ -0,0 +1,15 @@
+# Add Triangle
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add node
+n1 = mesh.AddNode(50, 10, 0)
+if n1 == 0: print "KO node addition."
+
+# add triangle
+t1 = mesh.AddFace([n1, 38, 39])
+if t1 == 0: print "KO triangle addition."
+else:       print "New Triangle has been added with ID ", t1
diff --git a/doc/salome/examples/modifying_meshes_ex06.py b/doc/salome/examples/modifying_meshes_ex06.py
new file mode 100644 (file)
index 0000000..b05c880
--- /dev/null
@@ -0,0 +1,18 @@
+# Add Quadrangle
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add node
+n1 = mesh.AddNode(50, 10, 0)
+if n1 == 0: print "KO node addition."
+
+n2 = mesh.AddNode(40, 20, 0)
+if n2 == 0: print "KO node addition."
+
+# add quadrangle
+q1 = mesh.AddFace([n2, n1, 38, 39])
+if q1 == 0: print "KO quadrangle addition."
+else:       print "New Quadrangle has been added with ID ", q1
diff --git a/doc/salome/examples/modifying_meshes_ex07.py b/doc/salome/examples/modifying_meshes_ex07.py
new file mode 100644 (file)
index 0000000..5dfa8da
--- /dev/null
@@ -0,0 +1,15 @@
+# Add Tetrahedron
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add node
+n1 = mesh.AddNode(50, 10, 0)
+if n1 == 0: print "KO node addition."
+
+# add tetrahedron
+t1 = mesh.AddVolume([n1, 38, 39, 246])
+if t1 == 0: print "KO tetrahedron addition."
+else:       print "New Tetrahedron has been added with ID ", t1
diff --git a/doc/salome/examples/modifying_meshes_ex08.py b/doc/salome/examples/modifying_meshes_ex08.py
new file mode 100644 (file)
index 0000000..4cfa89e
--- /dev/null
@@ -0,0 +1,19 @@
+# Add Hexahedron
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+print ""
+
+# add nodes
+nId1 = mesh.AddNode(50, 10, 0)
+nId2 = mesh.AddNode(47, 12, 0)
+nId3 = mesh.AddNode(50, 10, 10)
+nId4 = mesh.AddNode(47, 12, 10)
+
+if nId1 == 0 or nId2 == 0 or nId3 == 0 or nId4 == 0: print "KO node addition."
+
+# add hexahedron
+vId = mesh.AddVolume([nId2, nId1, 38, 39, nId4, nId3, 245, 246])
+if vId == 0: print "KO Hexahedron addition."
+else:        print "New Hexahedron has been added with ID ", vId
diff --git a/doc/salome/examples/modifying_meshes_ex09.py b/doc/salome/examples/modifying_meshes_ex09.py
new file mode 100644 (file)
index 0000000..2fd9111
--- /dev/null
@@ -0,0 +1,32 @@
+# Add Polygon
+
+import math
+import salome
+
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# a method to build a polygonal mesh element with <nb_vert> angles:
+def MakePolygon (a_mesh, x0, y0, z0, radius, nb_vert):
+    al = 2.0 * math.pi / nb_vert
+    node_ids = []
+
+    # Create nodes for a polygon
+    for ii in range(nb_vert):
+        nid = mesh.AddNode(x0 + radius * math.cos(ii*al),
+                           y0 + radius * math.sin(ii*al),
+                                                     z0)
+        node_ids.append(nid)
+        pass
+
+    # Create a polygon
+    return mesh.AddPolygonalFace(node_ids)
+
+# Create three polygons
+f1 = MakePolygon(mesh, 0, 0,  0, 30, 13)
+f2 = MakePolygon(mesh, 0, 0, 10, 21,  9)
+f3 = MakePolygon(mesh, 0, 0, 20, 13,  6)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex10.py b/doc/salome/examples/modifying_meshes_ex10.py
new file mode 100644 (file)
index 0000000..7f36728
--- /dev/null
@@ -0,0 +1,56 @@
+# Add Polyhedron
+
+import salome
+import math
+
+# create an empty mesh structure
+mesh = smesh.Mesh()  
+
+# Create nodes for 12-hedron with pentagonal faces
+al = 2 * math.pi / 5.0
+cosal = math.cos(al)
+aa = 13
+rr = aa / (2.0 * math.sin(al/2.0))
+dr = 2.0 * rr * cosal
+r1 = rr + dr
+dh = rr * math.sqrt(2.0 * (1.0 - cosal * (1.0 + 2.0 * cosal)))
+hh = 2.0 * dh - dr * (rr*(cosal - 1) + (rr + dr)*(math.cos(al/2) - 1)) / dh
+
+dd = [] # top
+cc = [] # below top
+bb = [] # above bottom
+aa = [] # bottom
+
+for i in range(5):
+    cos_bot = math.cos(i*al)
+    sin_bot = math.sin(i*al)
+
+    cos_top = math.cos(i*al + al/2.0)
+    sin_top = math.sin(i*al + al/2.0)
+
+    nd = mesh.AddNode(rr * cos_top, rr * sin_top, hh     ) # top
+    nc = mesh.AddNode(r1 * cos_top, r1 * sin_top, hh - dh) # below top
+    nb = mesh.AddNode(r1 * cos_bot, r1 * sin_bot,      dh) # above bottom
+    na = mesh.AddNode(rr * cos_bot, rr * sin_bot,       0) # bottom
+    dd.append(nd) # top
+    cc.append(nc) # below top
+    bb.append(nb) # above bottom
+    aa.append(na) # bottom
+    pass
+
+# Create a polyhedral volume (12-hedron with pentagonal faces)
+MeshEditor.AddPolyhedralVolume([dd[0], dd[1], dd[2], dd[3], dd[4],  # top
+                                dd[0], cc[0], bb[1], cc[1], dd[1],  # -
+                                dd[1], cc[1], bb[2], cc[2], dd[2],  # -
+                                dd[2], cc[2], bb[3], cc[3], dd[3],  # - below top
+                                dd[3], cc[3], bb[4], cc[4], dd[4],  # -
+                                dd[4], cc[4], bb[0], cc[0], dd[0],  # -
+                                aa[4], bb[4], cc[4], bb[0], aa[0],  # .
+                                aa[3], bb[3], cc[3], bb[4], aa[4],  # .
+                                aa[2], bb[2], cc[2], bb[3], aa[3],  # . above bottom
+                                aa[1], bb[1], cc[1], bb[2], aa[2],  # .
+                                aa[0], bb[0], cc[0], bb[1], aa[1],  # .
+                                aa[0], aa[1], aa[2], aa[3], aa[4]], # bottom
+                               [5,5,5,5,5,5,5,5,5,5,5,5])
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex11.py b/doc/salome/examples/modifying_meshes_ex11.py
new file mode 100644 (file)
index 0000000..6ba78c3
--- /dev/null
@@ -0,0 +1,10 @@
+# Removing Nodes
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+# remove nodes #246 and #255
+res = mesh.RemoveNodes([246, 255])
+if res == 1: print "Nodes removing is OK!"
+else:        print "KO nodes removing."
diff --git a/doc/salome/examples/modifying_meshes_ex12.py b/doc/salome/examples/modifying_meshes_ex12.py
new file mode 100644 (file)
index 0000000..5437b38
--- /dev/null
@@ -0,0 +1,10 @@
+# Removing Elements
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+# remove three elements: #850, #859 and #814
+res = mesh.RemoveElements([850, 859, 814])
+if res == 1: print "Elements removing is OK!"
+else:        print "KO Elements removing."
diff --git a/doc/salome/examples/modifying_meshes_ex13.py b/doc/salome/examples/modifying_meshes_ex13.py
new file mode 100644 (file)
index 0000000..4189b85
--- /dev/null
@@ -0,0 +1,13 @@
+# Removing Orphan Nodes
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+# add orphan nodes
+mesh.AddNode(0,0,0)
+mesh.AddNode(1,1,1)
+# remove just created orphan nodes
+res = mesh.RemoveOrphanNodes()
+if res == 1: print "Removed %d nodes!" % res
+else:        print "KO nodes removing."
diff --git a/doc/salome/examples/modifying_meshes_ex14.py b/doc/salome/examples/modifying_meshes_ex14.py
new file mode 100644 (file)
index 0000000..7bb10fd
--- /dev/null
@@ -0,0 +1,9 @@
+# Renumbering Nodes and Elements
+
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+mesh.RenumberNodes()
+
+mesh.RenumberElements()
diff --git a/doc/salome/examples/modifying_meshes_ex15.py b/doc/salome/examples/modifying_meshes_ex15.py
new file mode 100644 (file)
index 0000000..49676d0
--- /dev/null
@@ -0,0 +1,43 @@
+# Moving Nodes
+
+from geompy import *
+from smesh import *
+
+box = MakeBoxDXDYDZ(200, 200, 200)
+
+mesh = Mesh( box )
+mesh.Segment().AutomaticLength(0.1)
+mesh.Quadrangle()
+mesh.Compute()
+
+# find node at (0,0,0)
+node000 = None
+for vId in SubShapeAllIDs( box, ShapeType["VERTEX"]):
+    if node000: break
+    nodeIds = mesh.GetSubMeshNodesId( vId, True )
+    for node in nodeIds:
+        xyz = mesh.GetNodeXYZ( node )
+        if xyz[0] == 0 and xyz[1] == 0 and xyz[2] == 0 :
+            node000 = node
+            pass
+        pass
+    pass
+
+if not node000:
+    raise "node000 not found"
+
+# find node000 using the tested function 
+n = mesh.FindNodeClosestTo( -1,-1,-1 )
+if not n == node000:
+    raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 )
+
+# move node000 to a new location
+x,y,z = -10, -10, -10
+n = mesh.MoveNode( n,x,y,z )
+if not n:
+    raise "MoveNode() returns " + n
+
+# check the coordinates of the node000
+xyz = mesh.GetNodeXYZ( node000 )
+if not ( xyz[0] == x and xyz[1] == y and xyz[2] == z) :
+    raise "Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] )
diff --git a/doc/salome/examples/modifying_meshes_ex16.py b/doc/salome/examples/modifying_meshes_ex16.py
new file mode 100644 (file)
index 0000000..6567dff
--- /dev/null
@@ -0,0 +1,44 @@
+# Diagonal Inversion
+
+import salome
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# create the following mesh:
+# .----.----.----.
+# |   /|   /|   /|
+# |  / |  / |  / |
+# | /  | /  | /  |
+# |/   |/   |/   |
+# .----.----.----.
+
+bb = [0, 0, 0, 0]
+tt = [0, 0, 0, 0]
+ff = [0, 0, 0, 0, 0, 0]
+
+bb[0] = mesh.AddNode( 0., 0., 0.)
+bb[1] = mesh.AddNode(10., 0., 0.)
+bb[2] = mesh.AddNode(20., 0., 0.)
+bb[3] = mesh.AddNode(30., 0., 0.)
+
+tt[0] = mesh.AddNode( 0., 15., 0.)
+tt[1] = mesh.AddNode(10., 15., 0.)
+tt[2] = mesh.AddNode(20., 15., 0.)
+tt[3] = mesh.AddNode(30., 15., 0.)
+
+ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
+ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
+ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
+ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
+ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
+ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]])
+
+# inverse the diagonal bb[1] - tt[2]
+print "\nDiagonal inversion ... ",
+res = mesh.InverseDiag(bb[1], tt[2])
+if not res: print "failed!"
+else:       print "done."
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex17.py b/doc/salome/examples/modifying_meshes_ex17.py
new file mode 100644 (file)
index 0000000..732953a
--- /dev/null
@@ -0,0 +1,44 @@
+# Uniting two Triangles
+
+import salome
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# create the following mesh:
+# .----.----.----.
+# |   /|   /|   /|
+# |  / |  / |  / |
+# | /  | /  | /  |
+# |/   |/   |/   |
+# .----.----.----.
+
+bb = [0, 0, 0, 0]
+tt = [0, 0, 0, 0]
+ff = [0, 0, 0, 0, 0, 0]
+
+bb[0] = mesh.AddNode( 0., 0., 0.)
+bb[1] = mesh.AddNode(10., 0., 0.)
+bb[2] = mesh.AddNode(20., 0., 0.)
+bb[3] = mesh.AddNode(30., 0., 0.)
+
+tt[0] = mesh.AddNode( 0., 15., 0.)
+tt[1] = mesh.AddNode(10., 15., 0.)
+tt[2] = mesh.AddNode(20., 15., 0.)
+tt[3] = mesh.AddNode(30., 15., 0.)
+
+ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
+ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
+ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
+ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
+ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
+ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]]) 
+
+# delete the diagonal bb[1] - tt[2]
+print "\nUnite two triangles ... ",
+res = mesh.DeleteDiag(bb[1], tt[2])
+if not res: print "failed!"
+else:       print "done."
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex18.py b/doc/salome/examples/modifying_meshes_ex18.py
new file mode 100644 (file)
index 0000000..9f73930
--- /dev/null
@@ -0,0 +1,44 @@
+# Uniting a Set of Triangles
+
+import salome
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# create the following mesh:
+# .----.----.----.
+# |   /|   /|   /|
+# |  / |  / |  / |
+# | /  | /  | /  |
+# |/   |/   |/   |
+# .----.----.----.
+
+bb = [0, 0, 0, 0]
+tt = [0, 0, 0, 0]
+ff = [0, 0, 0, 0, 0, 0]
+
+bb[0] = mesh.AddNode( 0., 0., 0.)
+bb[1] = mesh.AddNode(10., 0., 0.)
+bb[2] = mesh.AddNode(20., 0., 0.)
+bb[3] = mesh.AddNode(30., 0., 0.)
+
+tt[0] = mesh.AddNode( 0., 15., 0.)
+tt[1] = mesh.AddNode(10., 15., 0.)
+tt[2] = mesh.AddNode(20., 15., 0.)
+tt[3] = mesh.AddNode(30., 15., 0.)
+
+ff[0] = mesh.AddFace([bb[0], bb[1], tt[1]])
+ff[1] = mesh.AddFace([bb[0], tt[1], tt[0]])
+ff[2] = mesh.AddFace([bb[1], bb[2], tt[2]])
+ff[3] = mesh.AddFace([bb[1], tt[2], tt[1]])
+ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]])
+ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]])
+
+# unite a set of triangles
+print "\nUnite a set of triangles ... ",
+res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], smesh.FT_MinimumAngle, 60.)
+if not res: print "failed!"
+else:       print "done."
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex19.py b/doc/salome/examples/modifying_meshes_ex19.py
new file mode 100644 (file)
index 0000000..c3eaf49
--- /dev/null
@@ -0,0 +1,35 @@
+# Orientation
+
+import salome
+import smesh
+
+# create an empty mesh structure
+mesh = smesh.Mesh() 
+
+# build five quadrangles:
+dx = 10
+dy = 20
+
+n1  = mesh.AddNode(0.0 * dx, 0, 0)
+n2  = mesh.AddNode(1.0 * dx, 0, 0)
+n3  = mesh.AddNode(2.0 * dx, 0, 0)
+n4  = mesh.AddNode(3.0 * dx, 0, 0)
+n5  = mesh.AddNode(4.0 * dx, 0, 0)
+n6  = mesh.AddNode(5.0 * dx, 0, 0)
+n7  = mesh.AddNode(0.0 * dx, dy, 0)
+n8  = mesh.AddNode(1.0 * dx, dy, 0)
+n9  = mesh.AddNode(2.0 * dx, dy, 0)
+n10 = mesh.AddNode(3.0 * dx, dy, 0)
+n11 = mesh.AddNode(4.0 * dx, dy, 0)
+n12 = mesh.AddNode(5.0 * dx, dy, 0)
+
+f1 = mesh.AddFace([n1, n2, n8 , n7 ])
+f2 = mesh.AddFace([n2, n3, n9 , n8 ])
+f3 = mesh.AddFace([n3, n4, n10, n9 ])
+f4 = mesh.AddFace([n4, n5, n11, n10])
+f5 = mesh.AddFace([n5, n6, n12, n11]) 
+
+# Change the orientation of the second and the fourth faces.
+mesh.Reorient([2, 4])
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex20.py b/doc/salome/examples/modifying_meshes_ex20.py
new file mode 100644 (file)
index 0000000..aa52da7
--- /dev/null
@@ -0,0 +1,9 @@
+# Cutting Quadrangles
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh  = SMESH_mechanic.mesh
+
+# cut two quadrangles: 405 and 406
+mesh.QuadToTri([405, 406], smesh.FT_MinimumAngle)
diff --git a/doc/salome/examples/modifying_meshes_ex21.py b/doc/salome/examples/modifying_meshes_ex21.py
new file mode 100644 (file)
index 0000000..ece705c
--- /dev/null
@@ -0,0 +1,27 @@
+# Smoothing
+
+import salome
+import geompy
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh = SMESH_mechanic.mesh
+
+# select the top face
+faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, geompy.ShapeType["FACE"])
+face = faces[3]
+geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole")
+
+# create a group of faces to be smoothed
+GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", smesh.FACE)
+
+# perform smoothing
+
+# boolean SmoothObject(Object, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method)
+res = mesh.SmoothObject(GroupSmooth, [], 20, 2., smesh.CENTROIDAL_SMOOTH)
+print "\nSmoothing ... ",
+if not res: print "failed!"
+else:       print "done."
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/modifying_meshes_ex22.py b/doc/salome/examples/modifying_meshes_ex22.py
new file mode 100644 (file)
index 0000000..e9dcb3c
--- /dev/null
@@ -0,0 +1,26 @@
+# Extrusion
+
+import salome
+import geompy
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh = SMESH_mechanic.mesh 
+
+# select the top face
+faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, geompy.ShapeType["FACE"])
+face = faces[7]
+geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face circular top")
+
+# create a vector for extrusion
+point = smesh.PointStruct(0., 0., 5.)
+vector = smesh.DirStruct(point)
+
+# create a group to be extruded
+GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", smesh.FACE)
+
+# perform extrusion of the group
+mesh.ExtrusionSweepObject(GroupTri, vector, 5)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex23.py b/doc/salome/examples/modifying_meshes_ex23.py
new file mode 100644 (file)
index 0000000..a789b76
--- /dev/null
@@ -0,0 +1,126 @@
+# Extrusion along a Path
+
+import math
+import salome
+
+# Geometry
+import geompy
+
+# 1. Create points
+points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]]
+
+iv = 1
+vertices = []
+for point in points:
+    vert = geompy.MakeVertex(point[0], point[1], 0)
+    geompy.addToStudy(vert, "Vertex_" + `iv`)
+    vertices.append(vert)
+    iv += 1
+    pass
+
+# 2. Create edges and wires
+Edge_straight = geompy.MakeEdge(vertices[0], vertices[4])
+Edge_bezierrr = geompy.MakeBezier(vertices)
+Wire_polyline = geompy.MakePolyline(vertices)
+Edge_Circle   = geompy.MakeCircleThreePnt(vertices[0], vertices[1], vertices[2])
+
+geompy.addToStudy(Edge_straight, "Edge_straight")
+geompy.addToStudy(Edge_bezierrr, "Edge_bezierrr")
+geompy.addToStudy(Wire_polyline, "Wire_polyline")
+geompy.addToStudy(Edge_Circle  , "Edge_Circle")
+
+# 3. Explode wire on edges, as they will be used for mesh extrusion
+Wire_polyline_edges = geompy.SubShapeAll(Wire_polyline, geompy.ShapeType["EDGE"])
+for ii in range(len(Wire_polyline_edges)):
+    geompy.addToStudyInFather(Wire_polyline, Wire_polyline_edges[ii], "Edge_" + `ii + 1`)
+    pass
+
+# Mesh
+import smesh
+
+# Mesh the given shape with the given 1d hypothesis
+def Mesh1D(shape1d, nbSeg, name):
+  mesh1d_tool = smesh.Mesh(shape1d, name)
+  algo = mesh1d_tool.Segment()
+  hyp  = algo.NumberOfSegments(nbSeg)
+  isDone = mesh1d_tool.Compute()
+  if not isDone: print 'Mesh ', name, ': computation failed'
+  return mesh1d_tool
+
+# Create a mesh with six nodes, seven edges and two quadrangle faces
+def MakeQuadMesh2(mesh_name):
+  quad_1 = smesh.Mesh(name = mesh_name)
+  
+  # six nodes
+  n1 = quad_1.AddNode(0, 20, 10)
+  n2 = quad_1.AddNode(0, 40, 10)
+  n3 = quad_1.AddNode(0, 40, 30)
+  n4 = quad_1.AddNode(0, 20, 30)
+  n5 = quad_1.AddNode(0,  0, 30)
+  n6 = quad_1.AddNode(0,  0, 10)
+
+  # seven edges
+  quad_1.AddEdge([n1, n2]) # 1
+  quad_1.AddEdge([n2, n3]) # 2
+  quad_1.AddEdge([n3, n4]) # 3
+  quad_1.AddEdge([n4, n1]) # 4
+  quad_1.AddEdge([n4, n5]) # 5
+  quad_1.AddEdge([n5, n6]) # 6
+  quad_1.AddEdge([n6, n1]) # 7
+
+  # two quadrangle faces
+  quad_1.AddFace([n1, n2, n3, n4]) # 8
+  quad_1.AddFace([n1, n4, n5, n6]) # 9
+  return [quad_1, [1,2,3,4,5,6,7], [8,9]]
+
+# Path meshes
+Edge_straight_mesh = Mesh1D(Edge_straight, 7, "Edge_straight")
+Edge_bezierrr_mesh = Mesh1D(Edge_bezierrr, 7, "Edge_bezierrr")
+Wire_polyline_mesh = Mesh1D(Wire_polyline, 3, "Wire_polyline")
+Edge_Circle_mesh   = Mesh1D(Edge_Circle  , 8, "Edge_Circle")
+
+# Initial meshes (to be extruded)
+[quad_1, ee_1, ff_1] = MakeQuadMesh2("quad_1")
+[quad_2, ee_2, ff_2] = MakeQuadMesh2("quad_2")
+[quad_3, ee_3, ff_3] = MakeQuadMesh2("quad_3")
+[quad_4, ee_4, ff_4] = MakeQuadMesh2("quad_4")
+[quad_5, ee_5, ff_5] = MakeQuadMesh2("quad_5")
+[quad_6, ee_6, ff_6] = MakeQuadMesh2("quad_6")
+[quad_7, ee_7, ff_7] = MakeQuadMesh2("quad_7")
+
+# ExtrusionAlongPath
+# IDsOfElements, PathMesh, PathShape, NodeStart,
+# HasAngles, Angles, HasRefPoint, RefPoint
+refPoint = smesh.PointStruct(0, 0, 0)
+a10 = 10.0*math.pi/180.0
+a45 = 45.0*math.pi/180.0
+
+# 1. Extrusion of two mesh edges along a straight path
+error = quad_1.ExtrusionAlongPath([1,2], Edge_straight_mesh, Edge_straight, 1,
+                                  0, [], 0, refPoint)
+
+# 2. Extrusion of one mesh edge along a curved path
+error = quad_2.ExtrusionAlongPath([2], Edge_bezierrr_mesh, Edge_bezierrr, 1,
+                                  0, [], 0, refPoint)
+
+# 3. Extrusion of one mesh edge along a curved path with usage of angles
+error = quad_3.ExtrusionAlongPath([2], Edge_bezierrr_mesh, Edge_bezierrr, 1,
+                                  1, [a45, a45, a45, 0, -a45, -a45, -a45], 0, refPoint)
+
+# 4. Extrusion of one mesh edge along the path, which is a part of a meshed wire
+error = quad_4.ExtrusionAlongPath([4], Wire_polyline_mesh, Wire_polyline_edges[0], 1,
+                                  1, [a10, a10, a10], 0, refPoint)
+
+# 5. Extrusion of two mesh faces along the path, which is a part of a meshed wire
+error = quad_5.ExtrusionAlongPath(ff_5 , Wire_polyline_mesh, Wire_polyline_edges[2], 4,
+                                  0, [], 0, refPoint)
+
+# 6. Extrusion of two mesh faces along a closed path
+error = quad_6.ExtrusionAlongPath(ff_6 , Edge_Circle_mesh, Edge_Circle, 1,
+                                  0, [], 0, refPoint)
+
+# 7. Extrusion of two mesh faces along a closed path with usage of angles
+error = quad_7.ExtrusionAlongPath(ff_7, Edge_Circle_mesh, Edge_Circle, 1,
+                                  1, [a45, -a45, a45, -a45, a45, -a45, a45, -a45], 0, refPoint)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/modifying_meshes_ex24.py b/doc/salome/examples/modifying_meshes_ex24.py
new file mode 100644 (file)
index 0000000..d07a7ca
--- /dev/null
@@ -0,0 +1,21 @@
+# Revolution
+
+import math
+import SMESH
+
+import SMESH_mechanic
+
+mesh  = SMESH_mechanic.mesh
+smesh = SMESH_mechanic.smesh
+
+# create a group of faces to be revolved
+FacesRotate = [492, 493, 502, 503]
+GroupRotate = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces (rotate)")
+GroupRotate.Add(FacesRotate)
+
+# define revolution angle and axis
+angle45 = 45 * math.pi / 180
+axisXYZ = SMESH.AxisStruct(-38.3128, -73.3658, -23.321, -13.3402, -13.3265, 6.66632)
+
+# perform revolution of an object
+mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5) 
diff --git a/doc/salome/examples/modifying_meshes_ex25.py b/doc/salome/examples/modifying_meshes_ex25.py
new file mode 100644 (file)
index 0000000..e8801e0
--- /dev/null
@@ -0,0 +1,130 @@
+# Pattern Mapping
+
+import geompy
+import smesh
+
+# define the geometry
+Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.)
+geompy.addToStudy(Box_1, "Box_1")
+
+faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
+Face_1 = faces[0]
+Face_2 = faces[1]
+
+geompy.addToStudyInFather(Box_1, Face_1, "Face_1")
+geompy.addToStudyInFather(Box_1, Face_2, "Face_2")
+
+# build a quadrangle mesh 3x3 on Face_1
+Mesh_1 = smesh.Mesh(Face_1)
+algo1D = Mesh_1.Segment()
+algo1D.NumberOfSegments(3)
+Mesh_1.Quadrangle()
+
+isDone = Mesh_1.Compute()
+if not isDone: print 'Mesh Mesh_1 : computation failed'
+
+# build a triangle mesh on Face_2
+Mesh_2 = smesh.Mesh(Face_2)
+
+algo1D = Mesh_2.Segment()
+algo1D.NumberOfSegments(1)
+algo2D = Mesh_2.Triangle()
+algo2D.MaxElementArea(240)
+
+isDone = Mesh_2.Compute()
+if not isDone: print 'Mesh Mesh_2 : computation failed'
+
+# create a 2d pattern
+pattern = smesh.GetPattern()
+
+isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), Face_2, 0)
+if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode()
+
+# apply the pattern to a face of the first mesh
+facesToSplit = Mesh_1.GetElementsByType(smesh.SMESH.FACE)
+print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit))
+pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0)
+isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0)
+if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode()  
+
+# create quadrangle mesh
+Mesh_3 = smesh.Mesh(Box_1)
+Mesh_3.Segment().NumberOfSegments(1)
+Mesh_3.Quadrangle()
+Mesh_3.Hexahedron()
+isDone = Mesh_3.Compute()
+if not isDone: print 'Mesh Mesh_3 : computation failed'
+
+# create a 3d pattern (hexahedrons)
+pattern_hexa = smesh.GetPattern()
+
+smp_hexa = """!!! Nb of points:
+15
+      0        0        0   !- 0
+      1        0        0   !- 1
+      0        1        0   !- 2
+      1        1        0   !- 3
+      0        0        1   !- 4
+      1        0        1   !- 5
+      0        1        1   !- 6
+      1        1        1   !- 7
+    0.5        0      0.5   !- 8
+    0.5        0        1   !- 9
+    0.5      0.5      0.5   !- 10
+    0.5      0.5        1   !- 11
+      1        0      0.5   !- 12
+      1      0.5      0.5   !- 13
+      1      0.5        1   !- 14
+  !!! Indices of points of 4 elements:
+  8 12 5 9 10 13 14 11
+  0 8 9 4 2 10 11 6
+  2 10 11 6 3 13 14 7
+  0 1 12 8 2 3 13 10"""
+
+pattern_hexa.LoadFromFile(smp_hexa)
+
+# apply the pattern to a mesh
+volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME)
+print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit))
+pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3)
+isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True)
+if (isDone != 1): print 'MakeMesh :', pattern_hexa.GetErrorCode()  
+
+# create one more quadrangle mesh
+Mesh_4 = smesh.Mesh(Box_1)
+Mesh_4.Segment().NumberOfSegments(1)
+Mesh_4.Quadrangle()
+Mesh_4.Hexahedron()
+isDone = Mesh_4.Compute()
+if not isDone: print 'Mesh Mesh_4 : computation failed'
+
+# create another 3d pattern (pyramids)
+pattern_pyra = smesh.GetPattern()
+
+smp_pyra = """!!! Nb of points:
+9
+        0        0        0   !- 0
+        1        0        0   !- 1
+        0        1        0   !- 2
+        1        1        0   !- 3
+        0        0        1   !- 4
+        1        0        1   !- 5
+        0        1        1   !- 6
+        1        1        1   !- 7
+      0.5      0.5      0.5   !- 8
+  !!! Indices of points of 6 elements:
+  0 1 5 4 8
+  7 5 1 3 8
+  3 2 6 7 8
+  2 0 4 6 8
+  0 2 3 1 8
+  4 5 7 6 8"""
+
+pattern_pyra.LoadFromFile(smp_pyra)
+
+# apply the pattern to a face mesh
+volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME)
+print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit))
+pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0)
+isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True)
+if (isDone != 1): print 'MakeMesh :', pattern_pyra.GetErrorCode()  
diff --git a/doc/salome/examples/modifying_meshes_ex26.py b/doc/salome/examples/modifying_meshes_ex26.py
new file mode 100644 (file)
index 0000000..aa8cb43
--- /dev/null
@@ -0,0 +1,45 @@
+# Convert mesh to/from quadratic
+
+import geompy
+import smesh
+
+# create sphere of radius 100
+
+Sphere = geompy.MakeSphereR( 100 )
+geompy.addToStudy( Sphere, "Sphere" )
+
+# create simple trihedral mesh
+
+Mesh = smesh.Mesh(Sphere)
+Regular_1D = Mesh.Segment()
+Nb_Segments = Regular_1D.NumberOfSegments(5)
+MEFISTO_2D = Mesh.Triangle()
+Tetrahedron = Mesh.Tetrahedron()
+
+# compute mesh
+
+isDone = Mesh.Compute()
+
+# convert to quadratic
+# theForce3d = 1; this results in the medium node lying at the
+# middle of the line segments connecting start and end node of a mesh
+# element
+
+Mesh.ConvertToQuadratic( theForce3d=1 )
+
+# revert back to the non-quadratic mesh
+
+Mesh.ConvertFromQuadratic()
+
+# convert to quadratic
+# theForce3d = 0; this results in the medium node lying at the
+# geometrical edge from which the mesh element is built
+
+Mesh.ConvertToQuadratic( theForce3d=0 )
+
+# to convert not the whole mesh but a sub-mesh, provide it as 
+# an additional argument to the functions:
+# Mesh.ConvertToQuadratic( 0, subMesh )
+# Mesh.ConvertFromQuadratic( subMesh )
+#
+# Note that the mesh becomes non-conformal at conversion of sub-mesh.
diff --git a/doc/salome/examples/notebook_smesh.py b/doc/salome/examples/notebook_smesh.py
new file mode 100644 (file)
index 0000000..9cccc7b
--- /dev/null
@@ -0,0 +1,39 @@
+# Using SALOME NoteBook
+
+import geompy
+import smesh
+import salome_notebook
+
+# set variables
+notebook = salome_notebook.notebook
+notebook.set("Length", 100)
+notebook.set("Width", 200)
+notebook.set("Offset", 50)
+
+notebook.set("NbSegments", 7)
+notebook.set("MaxElementArea", 800)
+notebook.set("MaxElementVolume", 900)
+
+# create a box
+box = geompy.MakeBoxDXDYDZ("Length", "Width", 300)
+idbox = geompy.addToStudy(box, "Box")
+
+# create a mesh
+tetra = smesh.Mesh(box, "MeshBox")
+
+algo1D = tetra.Segment()
+algo1D.NumberOfSegments("NbSegments")
+
+algo2D = tetra.Triangle()
+algo2D.MaxElementArea("MaxElementArea")
+
+algo3D = tetra.Tetrahedron()
+algo3D.MaxElementVolume("MaxElementVolume")
+
+# compute the mesh
+ret = tetra.Compute()
+
+# translate the mesh
+point = smesh.PointStruct("Offset", 0., 0.)
+vector = smesh.DirStruct(point) 
+tetra.TranslateObject(tetra, vector, 0)
diff --git a/doc/salome/examples/prism_3d_algo.py b/doc/salome/examples/prism_3d_algo.py
new file mode 100644 (file)
index 0000000..df18d0f
--- /dev/null
@@ -0,0 +1,73 @@
+# Use 3D extrusion meshing algorithm
+
+import salome, smesh, SMESH, geompy
+
+salome.salome_init()
+smesh.SetCurrentStudy( salome.myStudy )
+
+OX = geompy.MakeVectorDXDYDZ(1,0,0)
+OY = geompy.MakeVectorDXDYDZ(0,1,0)
+OZ = geompy.MakeVectorDXDYDZ(0,0,1)
+
+#  Y ^       Make geometry of a "pipe" with the following base (cross section).
+#    |       Big central quadrangles will be meshed with triangles, walls
+#                         of the pipe will be meshed with quadrilaterals
+#   +--+--+--+--+--+--+
+#   |  |  |  |  |  |  |
+#   +--+--+--+--+--+--+
+#   |  |     |     |  |
+#   +--+     |     +--+
+#   |  |     |     |  |
+#   +--+-----+-----+--+
+#   |  |     |     |  |
+#   +--+     |     +--+
+#   |  |     |     |  |
+#   +--+--+--+--+--+--+
+#   |  |  |  |  |  |  |  -->
+#   +--+--+--+--+--+--+   X
+
+quadBig   = geompy.MakeFaceHW( 20,20, 1 )
+quadBig   = geompy.MakeTranslation( quadBig, 15,15,0 )
+quadSmall = geompy.MakeFaceHW( 10,10, 1 )
+smallQuads1 = geompy.MakeMultiTranslation1D( quadSmall, OX, 10, 3 )
+smallQuads2 = geompy.MakeMultiTranslation1D( quadSmall, OY, 10, 3 )
+smallQuads2 = geompy.SubShapeAllSortedCentres( smallQuads2, geompy.ShapeType["FACE"])[1:]
+
+base = geompy.MakeCompound( smallQuads2 + [smallQuads1, quadBig])
+axis = geompy.MakeLine( geompy.MakeVertex( 25,25,0), OZ )
+base = geompy.MultiRotate1DNbTimes( base, axis, 4)
+base = geompy.MakePartition( [base], theName="base")
+path = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 100:R 0:C -90 180:T 0 -150",[0,0,0, 0,-1,0, 1,0,0])
+
+# Make the pipe, each quadrangle of the base turns into a prism with composite wall faces
+pipe   = geompy.MakePipe( base, path )
+prisms = geompy.MakePartition( [pipe], theName="prisms")
+
+
+# get base faces of the prism to define sub-mesh on them
+smallQuad = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 0,0,0 ), "smallQuad")
+bigQuad   = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 15,15,0 ), "bigQuad")
+
+
+mesh = smesh.Mesh( prisms )
+
+# assign Global hypotheses
+
+# 1D algorithm and hypothesis for vertical division
+mesh.Segment().NumberOfSegments(15)
+
+# Extrusion 3D algo
+mesh.Prism()
+
+# assign Local hypotheses
+
+# 1D and 2D algos and hyps to mesh smallQuad with quadrilaterals
+mesh.Segment(smallQuad).LocalLength( 3 )
+mesh.Quadrangle(smallQuad)
+
+# 1D and 2D algos and hyps to mesh bigQuad with triangles
+mesh.Segment(bigQuad).LocalLength( 3 )
+mesh.Triangle(bigQuad)
+
+# compute the mesh
+mesh.Compute()
diff --git a/doc/salome/examples/quality_controls_ex01.py b/doc/salome/examples/quality_controls_ex01.py
new file mode 100644 (file)
index 0000000..ed4dc24
--- /dev/null
@@ -0,0 +1,41 @@
+# Free Borders
+
+import salome
+import geompy
+
+import smesh
+
+# create open shell: a box without one plane
+box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+FaceList.remove(FaceList[5])
+box = geompy.MakeShell(FaceList)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_free_borders")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute() 
+
+# criterion : free borders
+aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) 
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+# print the result
+print "Criterion: Free borders Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateGroup(SMESH.EDGE, "Free borders")
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex02.py b/doc/salome/examples/quality_controls_ex02.py
new file mode 100644 (file)
index 0000000..7b1f55e
--- /dev/null
@@ -0,0 +1,44 @@
+# Borders at Multiconnection
+
+import salome
+import geompy
+
+import smesh
+import SMESH
+
+# create open shell: a box without one plane
+box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+FaceList.remove(FaceList[5])
+box = geompy.MakeShell(FaceList)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute() 
+
+# Criterion : Borders at multi-connection
+nb_conn = 2
+
+aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn)
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+# print the result
+print "Criterion: Borders at multi-connections Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateGroup(SMESH.EDGE, "Borders at multi-connections")
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex03.py b/doc/salome/examples/quality_controls_ex03.py
new file mode 100644 (file)
index 0000000..8cb4098
--- /dev/null
@@ -0,0 +1,43 @@
+# Length 1D
+
+import salome
+import geompy
+
+import smesh
+
+# create open shell: a box without one plane
+box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+FaceList.remove(FaceList[5])
+box = geompy.MakeShell(FaceList)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_Length_1D")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute() 
+
+# Criterion : Length > 3.
+length_margin = 3.
+
+aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin)
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Edges length > ", length_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex04.py b/doc/salome/examples/quality_controls_ex04.py
new file mode 100644 (file)
index 0000000..d26eb4d
--- /dev/null
@@ -0,0 +1,39 @@
+# Free Edges
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+aFilterMgr = smesh.CreateFilterManager()
+
+# Remove some elements to obtain free edges
+# Criterion : AREA > 95.
+area_margin = 95.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+mesh.RemoveElements(anIds)
+
+# Criterion : Free Edges
+aBorders = mesh.GetFreeBorders() 
+
+# create groups
+aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges")
+aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges")
+
+# fill groups with elements, corresponding to the criterion
+print ""
+print "Criterion: Free edges Nb = ", len(aBorders)
+for i in range(len(aBorders)):
+  aBorder = aBorders[i]
+  print "Face # ", aBorder.myElemId, " : Edge between nodes (",
+  print aBorder.myPnt1, ", ", aBorder.myPnt2, ")"
+
+  aGroupF.Add([aBorder.myElemId])
+  aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2])
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex05.py b/doc/salome/examples/quality_controls_ex05.py
new file mode 100644 (file)
index 0000000..90c7c04
--- /dev/null
@@ -0,0 +1,48 @@
+# Free Nodes
+
+import salome
+import geompy
+
+import smesh
+
+# create box
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_free_nodes")
+algo = mesh.Segment()
+algo.NumberOfSegments(10)
+algo = mesh.Triangle(smesh.MEFISTO)
+algo.MaxElementArea(150.)
+mesh.Compute() 
+
+# Remove some elements to obtain free nodes
+# Criterion : AREA < 80.
+area_margin = 80.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+mesh.RemoveElements(anIds)
+
+# criterion : free nodes
+aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) 
+anNodeIds = mesh.GetIdsFromFilter(aFilter)
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes")
+aGroup.Add(anNodeIds)
+
+# print the result
+print "Criterion: Free nodes Nb = ", len(anNodeIds)
+j = 1
+for i in range(len(anNodeIds)):
+  if j > 20: j = 1; print ""
+  print anNodeIds[i],
+  j = j + 1
+  pass
+print ""
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex06.py b/doc/salome/examples/quality_controls_ex06.py
new file mode 100644 (file)
index 0000000..2fe67ab
--- /dev/null
@@ -0,0 +1,73 @@
+# Free Faces
+
+import salome
+import geompy
+
+####### GEOM part ########
+
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Box_1_vertex_6 = geompy.GetSubShape(Box_1, [6])
+Box_1 = geompy.GetMainShape(Box_1_vertex_6)
+Box_1_vertex_16 = geompy.GetSubShape(Box_1, [16])
+Box_1 = geompy.GetMainShape(Box_1_vertex_16)
+Box_1_vertex_11 = geompy.GetSubShape(Box_1, [11])
+Box_1 = geompy.GetMainShape(Box_1_vertex_11)
+Plane_1 = geompy.MakePlaneThreePnt(Box_1_vertex_6, Box_1_vertex_16, Box_1_vertex_11, 2000)
+Partition_1 = geompy.MakePartition([Box_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+
+Box_1_vertex_19 = geompy.GetSubShape(Box_1, [19])
+Box_1_vertex_21 = geompy.GetSubShape(Box_1, [21])
+Plane_2 = geompy.MakePlaneThreePnt(Box_1_vertex_16, Box_1_vertex_19, Box_1_vertex_21, 2000)
+
+geompy.addToStudy( Box_1, "Box_1" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_6, "Box_1:vertex_6" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_16, "Box_1:vertex_16" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_11, "Box_1:vertex_11" )
+geompy.addToStudy( Plane_1, "Plane_1" )
+geompy.addToStudy( Partition_1, "Partition_1" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_19, "Box_1:vertex_19" )
+geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" )
+geompy.addToStudy( Plane_2, "Plane_2" )
+
+###### SMESH part ######
+import smesh
+
+import StdMeshers
+
+Mesh_1 = smesh.Mesh(Partition_1)
+Regular_1D = Mesh_1.Segment()
+Max_Size_1 = Regular_1D.MaxSize(34.641)
+MEFISTO_2D = Mesh_1.Triangle()
+Tetrahedronn = Mesh_1.Tetrahedron()
+isDone = Mesh_1.Compute()
+
+# create a group of free faces
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
+aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
+
+aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
+aGroup.Add(aFaceIds)
+
+# print the result
+print "Criterion: Free faces Nb = ", len(aFaceIds)
+j = 1
+for i in range(len(aFaceIds)):
+  if j > 20: j = 1; print ""
+  print aFaceIds[i],
+  j = j + 1
+  pass
+print ""
+
+#filter faces from plane 2
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2)
+aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
+aGroup.Remove(aFaceIds)
+
+# create a group of shared faces (located on partition boundary inside box)
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1)
+aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
+
+aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
+aGroup.Add(aFaceIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex07.py b/doc/salome/examples/quality_controls_ex07.py
new file mode 100644 (file)
index 0000000..a2be029
--- /dev/null
@@ -0,0 +1,19 @@
+# Bare border faces
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+geompy.addToStudy( box, "box" )
+
+mesh = smesh.Mesh(box)
+mesh.Segment().NumberOfSegments(3)
+mesh.Quadrangle()
+mesh.Compute()
+
+# remove 2 faces
+allFaces = mesh.GetElementsByType(FACE)
+mesh.RemoveElements( allFaces[0:2])
+
+bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
+assert(bareGroup.Size() == 3)
diff --git a/doc/salome/examples/quality_controls_ex08.py b/doc/salome/examples/quality_controls_ex08.py
new file mode 100644 (file)
index 0000000..77e7e4c
--- /dev/null
@@ -0,0 +1,23 @@
+# Bare border volumes
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+box = geompy.MakeBoxDXDYDZ(100, 30, 10)
+# the smallest face of the box
+face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
+
+geompy.addToStudy( box, "box" )
+geompy.addToStudyInFather( box, face, "face" )
+
+mesh = Mesh(box)
+mesh.AutomaticHexahedralization();
+
+# remove half of mesh faces from the smallest face
+faceFaces = mesh.GetSubMeshElementsId(face)
+faceToRemove = faceFaces[: len(faceFaces)/2]
+mesh.RemoveElements( faceToRemove )
+
+# make a group of volumes missing the removed faces
+bareGroup = mesh.MakeGroup("bare volumes", VOLUME, FT_BareBorderVolume)
+assert(bareGroup.Size() == len( faceToRemove))
diff --git a/doc/salome/examples/quality_controls_ex09.py b/doc/salome/examples/quality_controls_ex09.py
new file mode 100644 (file)
index 0000000..c4ca44e
--- /dev/null
@@ -0,0 +1,17 @@
+# Over-constrained faces
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+mesh = Mesh()
+faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
+
+#make an edge
+n1 = mesh.AddNode(0,0,0)
+n2 = mesh.AddNode(10,0,0)
+edge = mesh.AddEdge([n1,n2])
+assert( not mesh.GetIdsFromFilter( faceFilter ))
+
+# make faces 
+mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5)
+assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
diff --git a/doc/salome/examples/quality_controls_ex10.py b/doc/salome/examples/quality_controls_ex10.py
new file mode 100644 (file)
index 0000000..49ef2e7
--- /dev/null
@@ -0,0 +1,15 @@
+# Over-constrained volumes
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+mesh = Mesh()
+volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
+
+# make volumes by extrusion of one face
+n1 = mesh.AddNode(0,0,0)
+n2 = mesh.AddNode(10,0,0)
+edge = mesh.AddEdge([n1,n2])
+mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 1)
+mesh.ExtrusionSweep( mesh.GetElementsByType(FACE), MakeDirStruct(0,0,5), 7)
+assert( 2 == len( mesh.GetIdsFromFilter( volumeFilter )))
diff --git a/doc/salome/examples/quality_controls_ex11.py b/doc/salome/examples/quality_controls_ex11.py
new file mode 100644 (file)
index 0000000..ca955b6
--- /dev/null
@@ -0,0 +1,44 @@
+# Length 2D
+
+import salome
+import geompy
+
+import smesh
+
+# create open shell: a box without one plane
+box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+FaceList.remove(FaceList[5])
+box = geompy.MakeShell(FaceList)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Mesh_Length_2D")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute()
+
+# Criterion : Length 2D > 5.7
+length_margin = 5.7
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+# print the result
+print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex12.py b/doc/salome/examples/quality_controls_ex12.py
new file mode 100644 (file)
index 0000000..28a0192
--- /dev/null
@@ -0,0 +1,44 @@
+# Borders at Multiconnection 2D
+
+import salome
+import geompy
+
+import smesh
+
+# create a compound of two glued boxes
+box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+box2 = geompy.MakeTranslation(box1, 0., 20., 0)
+comp = geompy.MakeCompound([box1, box2])
+box = geompy.MakeGlueFaces(comp, 0.000001)
+idbox = geompy.addToStudy(box, "box")
+
+# create a mesh
+mesh = smesh.Mesh(box, "Box compound : 2D triangle mesh")
+algo = mesh.Segment()
+algo.NumberOfSegments(5)
+algo = mesh.Triangle()
+algo.MaxElementArea(20.)
+mesh.Compute() 
+
+# Criterion : MULTI-CONNECTION 2D = 3
+nb_conn = 3
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex13.py b/doc/salome/examples/quality_controls_ex13.py
new file mode 100644 (file)
index 0000000..1673fc7
--- /dev/null
@@ -0,0 +1,30 @@
+# Area
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : AREA > 100.
+area_margin = 100.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Area > ", area_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)  
diff --git a/doc/salome/examples/quality_controls_ex14.py b/doc/salome/examples/quality_controls_ex14.py
new file mode 100644 (file)
index 0000000..379affd
--- /dev/null
@@ -0,0 +1,30 @@
+# Taper
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : Taper > 3e-20
+taper_margin = 3e-20
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex15.py b/doc/salome/examples/quality_controls_ex15.py
new file mode 100644 (file)
index 0000000..5ca56db
--- /dev/null
@@ -0,0 +1,30 @@
+# Aspect Ratio
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : ASPECT RATIO > 1.8
+ar_margin = 1.8
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex16.py b/doc/salome/examples/quality_controls_ex16.py
new file mode 100644 (file)
index 0000000..a20f38f
--- /dev/null
@@ -0,0 +1,31 @@
+# Minimum Angle
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : MINIMUM ANGLE < 35.
+min_angle = 35.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`)
+
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex17.py b/doc/salome/examples/quality_controls_ex17.py
new file mode 100644 (file)
index 0000000..fcc596c
--- /dev/null
@@ -0,0 +1,31 @@
+# Warping
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : WARP ANGLE > 1e-15
+wa_margin = 1e-15
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`)
+
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/quality_controls_ex18.py b/doc/salome/examples/quality_controls_ex18.py
new file mode 100644 (file)
index 0000000..42e4b30
--- /dev/null
@@ -0,0 +1,30 @@
+# Skew
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : Skew > 38.
+skew_margin = 38.
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter)
+
+# print the result
+print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex19.py b/doc/salome/examples/quality_controls_ex19.py
new file mode 100644 (file)
index 0000000..abe1952
--- /dev/null
@@ -0,0 +1,30 @@
+# Element Diameter 2D
+
+import SMESH_mechanic
+
+smesh  = SMESH_mechanic.smesh
+mesh   = SMESH_mechanic.mesh
+salome = SMESH_mechanic.salome
+
+# Criterion : ELEMENT DIAMETER 2D > 10
+mel_2d_margin = 10
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex20.py b/doc/salome/examples/quality_controls_ex20.py
new file mode 100644 (file)
index 0000000..9e332e0
--- /dev/null
@@ -0,0 +1,31 @@
+# Aspect Ratio 3D
+
+import SMESH_mechanic_tetra 
+
+smesh  = SMESH_mechanic_tetra.smesh
+mesh   = SMESH_mechanic_tetra.mesh
+salome = SMESH_mechanic_tetra.salome
+
+# Criterion : ASPECT RATIO 3D > 4.5
+ar_margin = 4.5
+
+aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
+
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/quality_controls_ex21.py b/doc/salome/examples/quality_controls_ex21.py
new file mode 100644 (file)
index 0000000..833ffff
--- /dev/null
@@ -0,0 +1,32 @@
+# Volume
+
+import SMESH_mechanic_tetra
+
+smesh  = SMESH_mechanic_tetra.smesh
+mesh   = SMESH_mechanic_tetra.mesh
+salome = SMESH_mechanic_tetra.salome
+
+# Criterion : VOLUME < 7.
+volume_margin = 7.
+
+aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print ""
+print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
+
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1) 
diff --git a/doc/salome/examples/quality_controls_ex22.py b/doc/salome/examples/quality_controls_ex22.py
new file mode 100644 (file)
index 0000000..5264b1a
--- /dev/null
@@ -0,0 +1,30 @@
+# Element Diameter 3D
+
+import SMESH_mechanic_tetra
+
+smesh  = SMESH_mechanic_tetra.smesh
+mesh   = SMESH_mechanic_tetra.mesh
+salome = SMESH_mechanic_tetra.salome
+
+# Criterion : ELEMENT DIAMETER 3D > 10
+mel_3d_margin = 10
+
+aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
+
+anIds = mesh.GetIdsFromFilter(aFilter) 
+
+# print the result
+print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
+j = 1
+for i in range(len(anIds)):
+  if j > 20: j = 1; print ""
+  print anIds[i],
+  j = j + 1
+  pass
+print ""
+
+# create a group
+aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
+aGroup.Add(anIds)
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/testme.py b/doc/salome/examples/testme.py
new file mode 100755 (executable)
index 0000000..b1328b5
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import unittest, sys
+
+class SalomeSession(object):
+    def __init__(self, script):
+        import runSalome
+        sys.argv  = ["runSalome.py"]
+        sys.argv += ["--terminal"]
+        sys.argv += ["--modules=GEOM,MED,SMESH"]
+        sys.argv += ["--execute=%s" % script]
+        clt, d = runSalome.main()
+        self.port = d['port']
+        return
+
+    def __del__(self):
+        port = self.port
+        import killSalomeWithPort
+        killSalomeWithPort.killMyPort(port)
+        return
+    pass
+
+class MyTest(unittest.TestCase):
+    def testFunction(self):
+        SalomeSession(sys.argv[1])
+    pass
+
+unittest.main(argv=sys.argv[:1])
diff --git a/doc/salome/examples/transforming_meshes_ex01.py b/doc/salome/examples/transforming_meshes_ex01.py
new file mode 100644 (file)
index 0000000..0ea75cc
--- /dev/null
@@ -0,0 +1,15 @@
+# Translation
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh 
+mesh = SMESH_mechanic.mesh 
+
+# define translation vector
+point = smesh.PointStruct(-150., -150., 0.)
+vector =smesh.DirStruct(point) 
+
+# translate a mesh
+doCopy = 1
+
+mesh.Translate([], vector, doCopy)
diff --git a/doc/salome/examples/transforming_meshes_ex02.py b/doc/salome/examples/transforming_meshes_ex02.py
new file mode 100644 (file)
index 0000000..f96a6bb
--- /dev/null
@@ -0,0 +1,15 @@
+# Rotation
+
+import math
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh = SMESH_mechanic.mesh 
+
+# define rotation axis and angle
+axisXYZ = smesh.AxisStruct(0., 0., 0., 5., 5., 20.)
+angle270 = 1.5 * math.pi
+
+# rotate a mesh
+mesh.Rotate([], axisXYZ, angle270, 1)  
diff --git a/doc/salome/examples/transforming_meshes_ex03.py b/doc/salome/examples/transforming_meshes_ex03.py
new file mode 100644 (file)
index 0000000..da8105a
--- /dev/null
@@ -0,0 +1,26 @@
+# Scale
+
+import geompy
+Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"])
+
+import smesh,SMESH
+import StdMeshers
+Mesh1 = smesh.Mesh(f[0])
+Regular_1D = Mesh1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(3)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = Mesh1.Quadrangle()
+isDone = Mesh1.Compute()
+
+#Perform scale opration for the whole mesh and creation of a new mesh
+newMesh = Mesh1.ScaleMakeMesh(Mesh1,SMESH.PointStruct(100,100,200),[0.5,0.3,0.7],True,"ScaledMesh")
+
+#Perform scale operation for the whole mesh and copy elements
+Mesh1.Scale(Mesh1,SMESH.PointStruct(200,100,100),[0.5,0.5,0.5],True,True)
+
+#Perform scale opration for two edges and move elements
+Mesh1.Scale([1,2],SMESH.PointStruct(-100,100,100),[0.8,1.0,0.7],False)
+
+#Perform scale opration for one face and move elements
+Mesh1.Scale([21],SMESH.PointStruct(0,200,200),[0.7,0.7,0.7],False)
diff --git a/doc/salome/examples/transforming_meshes_ex04.py b/doc/salome/examples/transforming_meshes_ex04.py
new file mode 100644 (file)
index 0000000..ea7c72f
--- /dev/null
@@ -0,0 +1,13 @@
+# Symmetry
+
+import math
+
+import SMESH_mechanic
+
+smesh = SMESH_mechanic.smesh
+mesh = SMESH_mechanic.mesh 
+
+# create a symmetrical copy of the mesh mirrored through a point
+axis = SMESH.AxisStruct(0, 0, 0, 0, 0, 0)
+
+mesh.Mirror([], axis, smesh.POINT, 1)
diff --git a/doc/salome/examples/transforming_meshes_ex05.py b/doc/salome/examples/transforming_meshes_ex05.py
new file mode 100644 (file)
index 0000000..f99d50b
--- /dev/null
@@ -0,0 +1,10 @@
+# Merging Nodes
+
+import SMESH_mechanic
+mesh = SMESH_mechanic.mesh
+
+# merge nodes
+Tolerance = 25.0
+
+GroupsOfNodes =  mesh.FindCoincidentNodes(Tolerance)
+mesh.MergeNodes(GroupsOfNodes)  
diff --git a/doc/salome/examples/transforming_meshes_ex06.py b/doc/salome/examples/transforming_meshes_ex06.py
new file mode 100644 (file)
index 0000000..fe8c91d
--- /dev/null
@@ -0,0 +1,73 @@
+# Merging Elements
+
+import salome
+import geompy
+import smesh
+
+# create a face to be meshed
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+pz = geompy.MakeVertex(0.  , 0.  , 100.)
+
+vxy = geompy.MakeVector(px, py)
+arc = geompy.MakeArc(py, pz, px)
+
+wire = geompy.MakeWire([vxy, arc])
+isPlanarFace = 1
+
+face1 = geompy.MakeFace(wire, isPlanarFace)
+id_face1 = geompy.addToStudy(face1, "Face1")
+
+# create a circle to be an extrusion path
+px1 = geompy.MakeVertex( 100.,  100.,  0.)
+py1 = geompy.MakeVertex(-100., -100.,  0.)
+pz1 = geompy.MakeVertex(   0.,    0., 50.)
+
+circle = geompy.MakeCircleThreePnt(py1, pz1, px1)
+id_circle = geompy.addToStudy(circle, "Path")
+# create a 2D mesh on the face
+trias = smesh.Mesh(face1, "Face : 2D mesh")
+
+algo1D = trias.Segment()
+algo1D.NumberOfSegments(6)
+algo2D = trias.Triangle()
+algo2D.LengthFromEdges()
+
+trias.Compute()
+
+# create a path mesh
+circlemesh = smesh.Mesh(circle, "Path mesh")
+algo = circlemesh.Segment()
+algo.NumberOfSegments(10)
+circlemesh.Compute()
+
+# extrusion of the mesh
+trias.ExtrusionAlongPath([], circlemesh, circle,
+                         1, 0, [], 0, smesh.PointStruct(0, 0, 0))
+
+# merge nodes
+print "Number of nodes before MergeNodes:", 
+trias.NbNodes()
+tolerance = 0.001
+array_of_nodes_groups = trias.FindCoincidentNodes(tolerance)
+
+trias.MergeNodes(array_of_nodes_groups)
+
+print "Number of nodes after MergeNodes:", trias.NbNodes()
+print ""
+print "Number of elements before MergeEqualElements:"
+print "Edges      : ", trias.NbEdges()
+print "Triangles  : ", trias.NbTriangles()
+print "Quadrangles: ", trias.NbQuadrangles()
+print "Volumes    : ", trias.NbVolumes()
+
+# merge elements
+trias.MergeEqualElements()
+print "Number of elements after MergeEqualElements:"
+print "Edges      : ", trias.NbEdges()
+print "Triangles  : ", trias.NbTriangles()
+print "Quadrangles: ", trias.NbQuadrangles()
+print "Volumes    : ", trias.NbVolumes()
+
+salome.sg.updateObjBrowser(1)
diff --git a/doc/salome/examples/transforming_meshes_ex07.py b/doc/salome/examples/transforming_meshes_ex07.py
new file mode 100644 (file)
index 0000000..bb42d33
--- /dev/null
@@ -0,0 +1,38 @@
+# Sew Meshes Border to Side
+
+import geompy
+import smesh
+
+# create two faces of a box
+box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.)
+facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+face1 = facesList1[2]
+
+box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
+facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+face2 = facesList2[1]
+
+edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
+edge1 = edgesList[2]
+
+aComp = geompy.MakeCompound([face1, face2])
+geompy.addToStudy(aComp, "Two faces")
+
+# create a mesh on two faces
+mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
+
+algo1D = mesh.Segment()
+algo1D.NumberOfSegments(9)
+algo2D = mesh.Quadrangle()
+
+algo_local = mesh.Segment(edge1)
+algo_local.Arithmetic1D(1, 4)
+algo_local.Propagation()
+
+mesh.Compute()
+
+# sew border to side
+# FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
+# FirstNodeIDOnSide, LastNodeIDOnSide,
+# CreatePolygons, CreatePolyedrs
+mesh.SewBorderToSide(5, 45, 6, 113, 109, 0, 0)
diff --git a/doc/salome/examples/transforming_meshes_ex08.py b/doc/salome/examples/transforming_meshes_ex08.py
new file mode 100644 (file)
index 0000000..e028735
--- /dev/null
@@ -0,0 +1,36 @@
+# Sew Conform Free Borders
+
+import geompy
+import smesh
+
+# create two faces of the box
+box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.)
+facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+face1 = facesList1[2]
+
+box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
+facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+face2 = facesList2[1]
+
+edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
+edge1 = edgesList[2]
+
+aComp = geompy.MakeCompound([face1, face2])
+geompy.addToStudy(aComp, "Two faces")
+
+# create a mesh on two faces
+mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
+
+algo1D = mesh.Segment()
+algo1D.NumberOfSegments(9)
+algo2D = mesh.Quadrangle()
+
+algo_local = mesh.Segment(edge1)
+algo_local.Arithmetic1D(1, 4)
+algo_local.Propagation()
+
+mesh.Compute()
+
+# sew conform free borders
+# FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2
+mesh.SewConformFreeBorders(5, 45, 6, 3, 24) 
diff --git a/doc/salome/examples/transforming_meshes_ex09.py b/doc/salome/examples/transforming_meshes_ex09.py
new file mode 100644 (file)
index 0000000..5f92fd1
--- /dev/null
@@ -0,0 +1,37 @@
+# Sew Free Borders
+
+import geompy
+import smesh
+
+# create two faces of the box
+box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
+facesList1 = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+face1 = facesList1[2]
+
+box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
+facesList2 = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+face2 = facesList2[1]
+
+edgesList = geompy.SubShapeAll(face2, geompy.ShapeType["EDGE"])
+edge1 = edgesList[2]
+
+aComp = geompy.MakeCompound([face1, face2])
+geompy.addToStudy(aComp, "Two faces")
+
+# create a mesh on two faces
+mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
+
+algo1D = mesh.Segment()
+algo1D.NumberOfSegments(4)
+algo2D = mesh.Quadrangle()
+
+algo_local = mesh.Segment(edge1)
+algo_local.Arithmetic1D(1, 4)
+algo_local.Propagation()
+
+mesh.Compute()
+
+# sew free borders
+# FirstNodeID1, SecondNodeID1, LastNodeID1,
+# FirstNodeID2, SecondNodeID2, LastNodeID2, CreatePolygons, CreatePolyedrs
+mesh.SewFreeBorders(6, 21, 5, 1, 12, 3, 0, 0)
diff --git a/doc/salome/examples/transforming_meshes_ex10.py b/doc/salome/examples/transforming_meshes_ex10.py
new file mode 100644 (file)
index 0000000..c54aca6
--- /dev/null
@@ -0,0 +1,31 @@
+# Sew Side Elements
+
+import geompy
+import smesh
+
+# create two boxes
+box1 = geompy.MakeBox(0.,  0., 0., 10., 10., 10.)
+box2 = geompy.MakeBox(0., 15., 0., 20., 25., 10.)
+
+EdgesList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
+
+aComp = geompy.MakeCompound([box1, box2])
+geompy.addToStudy(aComp, "Two boxes")
+
+# create a mesh on two boxes
+mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
+
+algo1D = mesh.Segment()
+algo1D.NumberOfSegments(2)
+algo2D = mesh.Quadrangle()
+
+algo_local = mesh.Segment(EdgesList[8])
+algo_local.NumberOfSegments(4)
+algo_local.Propagation()
+
+mesh.Compute()
+
+# sew side elements
+# IDsOfSide1Elements, IDsOfSide2Elements,
+# NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge
+mesh.SewSideElements([69, 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)
diff --git a/doc/salome/examples/transforming_meshes_ex11.py b/doc/salome/examples/transforming_meshes_ex11.py
new file mode 100644 (file)
index 0000000..55fbe8f
--- /dev/null
@@ -0,0 +1,66 @@
+# Duplicate nodes
+
+import salome
+import smesh
+import SMESH_test1
+
+mesh = SMESH_test1.mesh
+
+# Compute mesh
+mesh.Compute()
+
+# Without the duplication of border elements
+
+# Nodes to duplicate
+nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' )
+nodes1.Add( [ 289, 278, 302, 285 ] )
+
+# Group of faces to replace nodes with new ones 
+faces1 = mesh.CreateEmptyGroup( smesh.FACE, 'faces1' )
+faces1.Add( [ 519, 556, 557 ] )
+
+# Duplicate nodes
+print "\nMesh before the first nodes duplication:"
+print "Nodes      : ", mesh.NbNodes()
+print "Edges      : ", mesh.NbEdges()
+print "Triangles  : ", mesh.NbTriangles()
+
+groupOfCreatedNodes = mesh.DoubleNodeGroup(nodes1, faces1, theMakeGroup=True)
+print "New nodes:", groupOfCreatedNodes.GetIDs()
+
+print "\nMesh after the first nodes duplication:"
+print "Nodes      : ", mesh.NbNodes()
+print "Edges      : ", mesh.NbEdges()
+print "Triangles  : ", mesh.NbTriangles()
+
+# With the duplication of border elements
+
+# Edges to duplicate
+edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' )
+edges.Add( [ 29, 30, 31 ] )
+
+# Nodes not to duplicate
+nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' )
+nodes2.Add( [ 32, 5 ] )
+
+# Group of faces to replace nodes with new ones 
+faces2 = mesh.CreateEmptyGroup( smesh.FACE, 'faces2' )
+faces2.Add( [ 576, 578, 580 ] )
+
+# Duplicate nodes
+print "\nMesh before the second nodes duplication:"
+print "Nodes      : ", mesh.NbNodes()
+print "Edges      : ", mesh.NbEdges()
+print "Triangles  : ", mesh.NbTriangles()
+
+groupOfNewEdges = mesh.DoubleNodeElemGroup( edges, nodes2, faces2, theMakeGroup=True )
+print "New edges:", groupOfNewEdges.GetIDs()
+
+print "\nMesh after the second nodes duplication:"
+print "Nodes      : ", mesh.NbNodes()
+print "Edges      : ", mesh.NbEdges()
+print "Triangles  : ", mesh.NbTriangles()
+
+# Update object browser
+if salome.sg.hasDesktop():
+    salome.sg.updateObjBrowser(0)
diff --git a/doc/salome/examples/transforming_meshes_ex12.py b/doc/salome/examples/transforming_meshes_ex12.py
new file mode 100644 (file)
index 0000000..0380cc3
--- /dev/null
@@ -0,0 +1,108 @@
+# Create boundary elements
+
+from smesh import *
+SetCurrentStudy(salome.myStudy)
+
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+gFaces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])
+f1,f2 = gFaces[0],gFaces[1]
+geompy.addToStudy(box,"box")
+geompy.addToStudyInFather(box,f1,"face1")
+geompy.addToStudyInFather(box,f2,"face2")
+
+twoFaces = geompy.MakeCompound([f1,f2])
+
+## -----------
+##
+## 2D from 3D
+##
+## -----------
+dim = SMESH.BND_2DFROM3D
+
+init_mesh = Mesh(box, "box")
+init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons
+
+# remove some faces
+faces = init_mesh.GetElementsByType( SMESH.FACE )
+nb_faces = len( faces )
+rm_face = faces[ : nb_faces/2]
+init_mesh.RemoveElements( rm_face )
+
+# restore boundary in this mesh
+mesh = CopyMesh( init_mesh, "2D from 3D")
+groupName = "bnd 2D"
+nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName)
+
+# restore boundary (only) in other mesh
+meshName = "2D boundary of " + init_mesh.GetName()
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName)
+
+# restore boundary in mesh copy
+meshName = init_mesh.GetName() + " + boundary"
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName, toCopyAll=True)
+
+
+## -----------
+##
+## 1D from 2D
+##
+## -----------
+dim = SMESH.BND_1DFROM2D
+
+init_mesh = Mesh(f1, "2D mesh")
+init_mesh.AutomaticHexahedralization()
+
+# remove some edges
+edges = init_mesh.GetElementsByType( SMESH.EDGE )
+nb_edges = len( edges )
+rm_edge = edges[ : nb_edges/2]
+init_mesh.RemoveElements( rm_edge )
+
+
+# restore boundary edges in this mesh
+mesh = CopyMesh( init_mesh, "1D from 2D")
+groupName = "bnd 1D"
+nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName)
+
+# restore boundary edges (only) in other mesh
+meshName = "1D boundary of " + init_mesh.GetName()
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName)
+
+# restore boundary edges in mesh copy
+meshName = init_mesh.GetName() + " + boundary"
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName, toCopyAll=True)
+
+
+
+## ------------------
+##
+## 1D from 2D GROUPS
+##
+## ------------------
+dim = SMESH.BND_1DFROM3D
+
+init_mesh = Mesh(box, "box")
+init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons
+# remove all edges
+rm_edges = init_mesh.GetElementsByType( SMESH.EDGE )
+init_mesh.RemoveElements( rm_edges )
+
+# make groups of faces
+fGroup1 = init_mesh.Group( f1, "f1" )
+fGroup2 = init_mesh.Group( f2, "f2" )
+
+# make 1D boundary around groups in this mesh
+mesh = CopyMesh( init_mesh, "1D from 2D groups", toCopyGroups=True)
+groups = mesh.GetGroups()
+nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName,groups=groups)
+
+# make 1D boundary (only) in other mesh
+meshName =  "boundary from groups of " + init_mesh.GetName()
+groups = init_mesh.GetGroups()
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName,groups=groups)
+
+# make 1D boundary in mesh copy
+meshName = init_mesh.GetName() + " + boundary from groups"
+nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshName,
+                                                         groups=groups, toCopyAll=True)
+
diff --git a/doc/salome/examples/transforming_meshes_ex13.py b/doc/salome/examples/transforming_meshes_ex13.py
new file mode 100644 (file)
index 0000000..0126b71
--- /dev/null
@@ -0,0 +1,43 @@
+# Reorient faces by vector
+
+import smesh, geompy, SMESH
+
+# create a geometry consisting of two faces
+box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
+faces = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])
+
+shape = geompy.MakeCompound( faces[:2] )
+faces = geompy.SubShapeAll( shape, geompy.ShapeType["FACE"] )
+geompy.addToStudy( shape, "shape")
+geompy.addToStudyInFather( shape, faces[0], "faces[0]")
+geompy.addToStudyInFather( shape, faces[1], "faces[1]")
+
+# create a 2D mesh
+mesh = smesh.Mesh( shape, "test_Reorient2D")
+mesh.AutomaticHexahedralization(0.5)
+localAlgo = mesh.Segment(faces[0])
+localAlgo.NumberOfSegments( 11 )
+mesh.Compute()
+group = mesh.Group( faces[1] )
+
+vec = geompy.MakeVectorDXDYDZ( 1, 1, 1 )
+
+# Each of arguments of Reorient2D() function can be of different types:
+#
+# 2DObject    - the whole mesh
+# Direction   - a GEOM object (vector)
+# FaceOrPoint - an ID of face
+mesh.Reorient2D( mesh, vec, mesh.NbElements() )
+#
+# 2DObject    - a sub-mesh
+# Direction   - components of a vector
+# FaceOrPoint - a GEOM object (vertex)
+mesh.Reorient2D( localAlgo.GetSubMesh(), [ 1, -1, 1 ], geompy.GetFirstVertex( vec ))
+#
+# 2DObject    - a group of faces
+# Direction   - a SMESH.DirStruct structure
+# FaceOrPoint - coordinates of a point
+mesh.Reorient2D( group, smesh.MakeDirStruct( -10, 1, 10 ), [0,0,0])
+#
+# FaceOrPoint - a SMESH.PointStruct structure
+mesh.Reorient2D( localAlgo.GetSubMesh().GetIDs(), [10,1,0], SMESH.PointStruct(0,0,0))
diff --git a/doc/salome/examples/use_existing_faces.py b/doc/salome/examples/use_existing_faces.py
new file mode 100644 (file)
index 0000000..12b5a9a
--- /dev/null
@@ -0,0 +1,109 @@
+# Use existing faces algorithm
+
+import smesh, geompy
+import numpy as np
+
+# define my 2D algorithm
+def my2DMeshing( geomFace ):
+
+    # find gravity center of geomFace
+    gcXYZ = geompy.PointCoordinates( geompy.MakeCDG( geomFace ))
+
+    # define order and orientation of edges
+    sortedEdges = []
+    geomEdges = geompy.SubShapeAll( geomFace, geompy.ShapeType["EDGE"])
+    sortedEdges.append(( geomEdges.pop(0), True ))
+    while geomEdges:
+        prevEdge_rev = sortedEdges[ -1 ]
+        prevVV = geompy.SubShapeAll( prevEdge_rev[0], geompy.ShapeType["VERTEX"])
+        prevV2 = prevVV[ prevEdge_rev[1] ]
+        found = False
+        for iE in range( len( geomEdges )):
+            v1,v2 = geompy.SubShapeAll( geomEdges[ iE ], geompy.ShapeType["VERTEX"])
+            same1,same2 = [( geompy.MinDistance( prevV2, v ) < 1e-7 ) for v in [v1,v2] ]
+            if not same1 and not same2: continue
+            sortedEdges.append(( geomEdges.pop( iE ), same1 ))
+            found = True
+            break
+        assert found
+    sortedEdges.reverse()
+
+    # put nodes on edges in a right order
+    nodes = []
+    for edge, isForward in sortedEdges:
+        v1,v2 = geompy.SubShapeAll( edge, geompy.ShapeType["VERTEX"])
+        edgeNodes = mesh.GetSubMeshNodesId( v2,   all=False ) + \
+                    mesh.GetSubMeshNodesId( edge, all=False ) + \
+                    mesh.GetSubMeshNodesId( v1,   all=False )
+        if not isForward: edgeNodes.reverse()
+        nodes.extend( edgeNodes[:-1] )
+
+    # create nodes inside the geomFace
+    r1 = 0.6
+    r2 = 1 - r1
+    nodesInside = []
+    for n in nodes:
+        nXYZ = mesh.GetNodeXYZ( n )
+        newXYZ = np.add( np.multiply( r1, gcXYZ ), np.multiply( r2, nXYZ ))
+        nodesInside.append( mesh.AddNode( newXYZ[0], newXYZ[1], newXYZ[2] ))
+        mesh.SetNodeOnFace( nodesInside[-1], geomFace, 0, 0 )
+
+    # find out orientation of faces to create
+    #    geomFace normal
+    faceNorm = geompy.GetNormal( geomFace )
+    v1,v2 = [ geompy.PointCoordinates( v ) \
+              for v in geompy.SubShapeAll( faceNorm, geompy.ShapeType["VERTEX"]) ]
+    faceNormXYZ = np.subtract( v2, v1 )
+    outDirXYZ   = np.subtract( v1, [ 50, 50, 50 ] )
+    if np.dot( faceNormXYZ, outDirXYZ ) < 0: # reversed face
+        faceNormXYZ = np.multiply( -1., faceNormXYZ )
+    #   mesh face normal
+    e1 = np.subtract( mesh.GetNodeXYZ( nodes[0] ), mesh.GetNodeXYZ( nodes[1] ))
+    e2 = np.subtract( mesh.GetNodeXYZ( nodes[0] ), mesh.GetNodeXYZ( nodesInside[0] ))
+    meshNorm = np.cross( e1, e2 )
+    #   faces orientation
+    reverse = ( np.dot( faceNormXYZ, meshNorm ) < 0 )
+
+    # create mesh faces
+    iN = len( nodes )
+    while iN:
+        n1, n2, n3, n4 = nodes[iN-1], nodes[iN-2], nodesInside[iN-2], nodesInside[iN-1]
+        iN -= 1
+        if reverse:
+            f = mesh.AddFace( [n1, n2, n3, n4] )
+        else:
+            f = mesh.AddFace( [n4, n3, n2, n1] )
+        # new faces must be assigned to geometry to allow 3D algorithm finding them
+        mesh.SetMeshElementOnShape( f, geomFace )
+
+    if reverse:
+        nodesInside.reverse()
+    polygon = mesh.AddPolygonalFace( nodesInside )
+    mesh.SetMeshElementOnShape( polygon, geomFace )
+
+    return
+
+# create geometry and get faces to mesh with my2DMeshing()
+box = geompy.MakeBoxDXDYDZ( 100, 100, 100 )
+f1 = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
+f2 = geompy.GetOppositeFace( box, f1 )
+geompy.addToStudy( box, "box" )
+geompy.addToStudy( f1, "f1" )
+geompy.addToStudy( f2, "f2" )
+
+# compute 1D mesh
+mesh = smesh.Mesh( box )
+mesh.Segment().NumberOfSegments( 5 )
+mesh.Compute()
+
+# compute 2D mesh
+mesh.Quadrangle()
+mesh.UseExistingFaces(f1) # UseExistingFaces() allows using my2DMeshing()
+mesh.UseExistingFaces(f2)
+my2DMeshing( f1 )
+my2DMeshing( f2 )
+assert mesh.Compute()
+
+# compute 3D mesh
+mesh.Prism()
+assert mesh.Compute()
diff --git a/doc/salome/examples/viewing_meshes_ex01.py b/doc/salome/examples/viewing_meshes_ex01.py
new file mode 100644 (file)
index 0000000..b2fa7df
--- /dev/null
@@ -0,0 +1,76 @@
+# Viewing Mesh Infos
+
+import geompy
+import smesh
+import SMESH
+
+# create a box
+box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
+geompy.addToStudy(box, "box")
+[Face_1,Face_2,Face_3,Face_4,Face_5,Face_5] = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+
+# create a mesh
+tetra = smesh.Mesh(box, "MeshBox")
+
+algo1D = tetra.Segment()
+algo1D.NumberOfSegments(3)
+
+algo2D = tetra.Triangle()
+algo2D.MaxElementArea(10.)
+
+algo3D = tetra.Tetrahedron()
+algo3D.MaxElementVolume(900.)
+
+# Creation of SubMesh
+Regular_1D_1_1 = tetra.Segment(geom=Face_1)
+Nb_Segments_1 = Regular_1D_1_1.NumberOfSegments(5)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = tetra.Quadrangle(geom=Face_1)
+isDone = tetra.Compute()
+submesh = Regular_1D_1_1.GetSubMesh()
+
+# compute the mesh
+tetra.Compute()
+
+# Creation of group
+group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' )
+nbAdd = group.Add( [ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 ] )
+
+# Print information about the mesh
+print "Information about mesh:" 
+print "Number of nodes       : ", tetra.NbNodes()
+print "Number of edges       : ", tetra.NbEdges()
+print "Number of faces       : ", tetra.NbFaces()
+print "          triangles   : ", tetra.NbTriangles()
+print "          quadrangles : ", tetra.NbQuadrangles()
+print "          polygons    : ", tetra.NbPolygons()
+print "Number of volumes     : ", tetra.NbVolumes()
+print "          tetrahedrons: ", tetra.NbTetras()
+print "          hexahedrons : ", tetra.NbHexas()
+print "          prisms      : ", tetra.NbPrisms()
+print "          pyramids    : ", tetra.NbPyramids()
+print "          polyhedrons : ", tetra.NbPolyhedrons() 
+
+# Get Information About Mesh by GetMeshInfo
+print "\nInformation about mesh by GetMeshInfo:"
+info = smesh.GetMeshInfo(tetra)
+keys = info.keys(); keys.sort()
+for i in keys:
+  print "  %s   :  %d" % ( i, info[i] )
+  pass
+
+# Get Information About Group by GetMeshInfo
+print "\nInformation about group by GetMeshInfo:"
+info = smesh.GetMeshInfo(group)
+keys = info.keys(); keys.sort()
+for i in keys:
+  print "  %s  :  %d" % ( i, info[i] )
+  pass
+
+# Get Information About SubMesh by GetMeshInfo
+print "\nInformation about Submesh by GetMeshInfo:"
+info = smesh.GetMeshInfo(submesh)
+keys = info.keys(); keys.sort()
+for i in keys:
+  print "  %s  :  %d" % ( i, info[i] )
+  pass
diff --git a/doc/salome/examples/viewing_meshes_ex02.py b/doc/salome/examples/viewing_meshes_ex02.py
new file mode 100644 (file)
index 0000000..de345e8
--- /dev/null
@@ -0,0 +1,45 @@
+# Find Element by Point
+
+import geompy
+import smesh
+import SMESH
+
+# Create a geometry to mesh
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+
+# Create a mesh
+mesh = Mesh(box,"Mesh")
+mesh.AutomaticHexahedralization()
+mesh.Compute()
+
+# Create a point
+x,y,z = 0, 0, 1
+
+# Find all elements (except 0D ones) located at the point
+all_elems_except_0D = mesh.FindElementsByPoint(x,y,z)
+assert( len(all_elems_except_0D) == 4)
+
+# Find nodes at the point
+nodes = mesh.FindElementsByPoint(x,y,z, SMESH.NODE )
+assert( len(nodes) == 0)
+assert( len( mesh.FindElementsByPoint(x,y,0, SMESH.NODE)) == 1)
+
+# Find an edge at the point
+edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE )
+assert( len(edges) == 1)
+
+# Find faces at the point
+edges = mesh.FindElementsByPoint(x,y,z, SMESH.FACE )
+assert( len(edges) == 2)
+
+# Find a volume at the point
+vols = mesh.FindElementsByPoint(x,y,z, SMESH.VOLUME )
+assert( len(vols) == 1)
+
+# Find 0D elements at the point
+elems0d = mesh.FindElementsByPoint(x,y,z, SMESH.ELEM0D )
+assert( len(elems0d) == 0)
+
+# Find edges within a group
+group1D = mesh.MakeGroupByIds("1D", SMESH.EDGE, [1,2] )
+edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE, group1D )
index bceb23d558bfcce3546ecb40f5791aaadf5786f7..a6a5fc1f1e4a46de9129e8597832b1f22b949b99 100755 (executable)
@@ -42,7 +42,7 @@ INPUT             = @srcdir@/input @top_srcdir@/src/Tools/padder/doc/input
 FILE_PATTERNS     = *.doc
 EXCLUDE           = 
 IMAGE_PATH        = @srcdir@/images @top_srcdir@/src/Tools/padder/doc/images
-EXAMPLE_PATH      = @top_srcdir@/src/SMESH_SWIG
+EXAMPLE_PATH      = @top_srcdir@/src/SMESH_SWIG @top_srcdir@/doc/salome/examples
 
 #---------------------------------------------------------------------------
 #HTML related options
index 9f26c9af88f70617eaee9ac2522efc44905e36f0..c9ac74a06414ad4abc493fdb87dff660332798d0 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/addinfo_group.png and b/doc/salome/gui/SMESH/images/addinfo_group.png differ
index 91fbc38ad8864e5a64aa974194220c6c094f6cd6..42d88c6384c6d023501c4d7a81d01a84f9f2d2b6 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/addinfo_mesh.png and b/doc/salome/gui/SMESH/images/addinfo_mesh.png differ
index 4811c9902d3052cd6896c47741feabf980dd6d73..f41ba29049495b47e81035e392562814c8363c3b 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/addinfo_submesh.png and b/doc/salome/gui/SMESH/images/addinfo_submesh.png differ
index ddd305f587eea02b9848081d71b84d483cc3c9f4..3471144a1b068ab6de1db00ad7b3def1722ece3b 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/advanced_mesh_infos.png and b/doc/salome/gui/SMESH/images/advanced_mesh_infos.png differ
index 3cd439b76df0733f11f26e61b02a9d9a971e318d..3e1888ff2b8fc83798dc08683e5806637233107f 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/eleminfo1.png and b/doc/salome/gui/SMESH/images/eleminfo1.png differ
index 54fe12df8603d679a5549f3e4e7f1b5f1fb434c5..ea73500bd0e4293e6c4479af4f643ddc5fef4447 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/eleminfo2.png and b/doc/salome/gui/SMESH/images/eleminfo2.png differ
index d30add41694f180a71e86ade80aaaa97a38877e6..d39efb580c5210d6c9bf532850c8168b05fb15c3 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/pref21.png and b/doc/salome/gui/SMESH/images/pref21.png differ
diff --git a/doc/salome/gui/SMESH/images/prism_needs_hyps.png b/doc/salome/gui/SMESH/images/prism_needs_hyps.png
new file mode 100644 (file)
index 0000000..8c56780
Binary files /dev/null and b/doc/salome/gui/SMESH/images/prism_needs_hyps.png differ
diff --git a/doc/salome/gui/SMESH/images/prism_ok_ko.png b/doc/salome/gui/SMESH/images/prism_ok_ko.png
new file mode 100644 (file)
index 0000000..0394985
Binary files /dev/null and b/doc/salome/gui/SMESH/images/prism_ok_ko.png differ
diff --git a/doc/salome/gui/SMESH/images/prism_stack.png b/doc/salome/gui/SMESH/images/prism_stack.png
new file mode 100644 (file)
index 0000000..bba6334
Binary files /dev/null and b/doc/salome/gui/SMESH/images/prism_stack.png differ
diff --git a/doc/salome/gui/SMESH/images/prism_tui_sample.png b/doc/salome/gui/SMESH/images/prism_tui_sample.png
new file mode 100644 (file)
index 0000000..0df7e48
Binary files /dev/null and b/doc/salome/gui/SMESH/images/prism_tui_sample.png differ
index 59ca53065b9a06a53ae289a6b6e469f67f20bc99..564689ad96ef81e321572bb7e4a84e2d156e4f28 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/scalar_bar_dlg.png and b/doc/salome/gui/SMESH/images/scalar_bar_dlg.png differ
index 5690ff36c3c88a5473aff669c4d9941a9294b9e5..4453a7b8dcf8b29c5c054280ce75b9415606d340 100644 (file)
@@ -2,13 +2,13 @@
 
 \page about_hypo_page About Hypotheses
 
-\n \b Hypotheses represent boundary conditions which will be taken into
-account at calculations of meshes or submeshes basing on geometrical
+\b Hypotheses represent boundary conditions which will be taken into
+account at calculations of meshes or sub-meshes basing on geometrical
 objects. These hypotheses allow you to manage the level of detail of
 the resulting meshes or submeshes: when applying different hypotheses
 with different parameters you can preset the quantity of meshing
 elements which will compose your mesh. So, it will be possible to
-generate a rough or a more refined mesh or submesh.
+generate a coarse or a more refined mesh or sub-mesh.
 
 In \b MESH there are the following Basic Hypotheses (to introduce
 them, you operate numerical values):
index dc68cff59c883975fd4346dd52875ce32d26b764..97d14a3ec8892b9b1983fbdb31d5183c4572bab8 100644 (file)
@@ -11,10 +11,9 @@ Meshes are stored in DAT, MED, UNV, STL, CGNS, GMF and SAUVE formats and can be
 
 It is possible to \subpage constructing_meshes_page "construct meshes" 
 on the basis of geometrical shapes produced in the GEOM module.
-It is also possible to \subpage constructing_submeshes_page "construct
-mesh on a part of the geometrical object", for example, a face, with
-different meshing parameters than the whole mesh.
-
+It is also possible to 
+\subpage constructing_submeshes_page "construct mesh on a part of the geometrical object", 
+for example, a face, with different meshing parameters than the whole mesh.
 
 Several created meshes can be \subpage building_compounds_page "combined into another mesh".
 
index ff225d080245f29702cec29551278983e0a36396..82ee9d824d06771d6cf2f28ab8ee038cce41b263 100644 (file)
@@ -36,7 +36,7 @@ quadrangular elements.</li>
 <li>Hexahedron meshing algorithm (i,j,k) - 6-sided Volumes are split into
 hexahedral (cubic) elements.</li>
 <li>\subpage cartesian_algo_page</li>
-internal parts of Volumes are split into hexahedral elements forming a
+internal parts of Volumes are split into hexahedral elements forming a
 Cartesian grid; polyhedra and other types of elements are generated
 where the geometrical boundary intersects Cartesian cells.</li>
 </ul>
@@ -47,7 +47,7 @@ where the geometrical boundary intersects Cartesian cells.</li>
 </ul>
 
 Some of 3D meshing algorithms also can generate 3D meshes from 2D meshes, working without
-geometrical objects. Such algorithms are
+geometrical objects. Such algorithms is
 <ul>
 <li>Hexahedron meshing algorithm (i,j,k),</li>
 <!-- <li>GHS3D meshing algorithm (commercial)</li> -->
index 060adae0319fa2d878dd446c71b4d81b5899c63a..917fd5f65e434515d46350c874b401e55705569d 100644 (file)
@@ -4,8 +4,8 @@
 
 Sub-mesh is a mesh on a geometrical sub-object created with algorithms
 and/or hypotheses other than the algorithms and hypotheses assigned to
-the parent mesh on the parent object.
-<br><br>
+the parent mesh on the parent geometrical object.
+
 If a geometrical sub-object belongs to several geometrical objects
 having different meshes or sub-meshes, it will be meshed with the
 hypotheses of a sub-mesh of a lower dimension.<br>
index cb061b314fabd3de22c4f883875429f563aea733..4813eee5cae4badc998966fc2ca7b2c7f0dc6d55 100644 (file)
@@ -64,7 +64,7 @@ The following dialog common for line and planar elements will appear:
   <li>Specify the number of steps.</li>
   <li>If you activate <b>Generate Groups</b> check-box, the created
     elements contained in groups will be included into new groups named
-    by pattern "<old group name>_extruded"</li>
+    by pattern "<old group name>_extruded" and "<old group name>_top".</li>
 </ul>
 
 <li>Click \b Apply or <b> Apply and Close</b>  button to confirm the operation.</li>
index 06a02d2cc1d90d5d356fe5badf49f6016df7b5a7..5c526af674870b08de16873ed71f0021c68af351 100644 (file)
@@ -10,8 +10,8 @@ group in the <b>Object Browser</b> and invoke <b>Mesh Information</b>
 item from the \b Mesh menu or click <em>"Mesh Information"</em> button
 in the toolbar. 
 
-\image html image49.png
-<center><em>"Mesh Information" button</em></center>
+<center>\image html image49.png
+<em>"Mesh Information" button</em></center>
 
 The <b>Mesh Information</b> dialog box provides three tab pages:
 - <b>\ref advanced_mesh_infos_anchor "Base Info"</b> - to show base
@@ -27,28 +27,50 @@ for the selected mesh, sub-mesh or group object.
 The <b>Base Info</b> tab page of the dialog box provides general
 information on the selected object - mesh, sub-mesh or mesh group:
 name, type, total number of nodes and elements separately for each
-type: 0D elements, edges, faces and volumes.
+type: 0D elements, edges, faces, volumes, balls.
 
-\image html advanced_mesh_infos.png
-<center><em>"Base Info" page</em></center>
+<center>\image html advanced_mesh_infos.png
+<em>"Base Info" page</em></center>
 
 \anchor mesh_element_info_anchor
 <h2>Mesh Element Information</h2> 
 
-The <b>Element Info</b> tab page of the dialog box gives basic
-information about the type, coordinates and connectivity of the
-selected mesh node or element.
+The <b>Element Info</b> tab page of the dialog box gives detail
+information about selected mesh node(s) or element(s), namely:
 
-\image html eleminfo1.png
-<center><em>"Element Info" page, node information</em></center>
+- For node:
+  - Node ID
+  - Coordinates (X, Y, Z)
+  - Connectivity information (connected elements)
+  - Position on a shape (for meshes built on geometry)
+  - Groups information (names of groups the node belongs to)
+
+<center>\image html eleminfo1.png
+<em>"Element Info" page, node information</em></center>
 <br>
-\image html eleminfo2.png 
-<center><em>"Element Info" page, element information</em></center>
+
+- For element:
+  - Element ID
+  - Type (triangle, quadrangle, etc...)
+  - Gravity center (X, Y, Z coordinates)
+  - Connectivity information (connected nodes)
+  - Quality controls (area, aspect ration, volume, etc)
+  - Position on a shape (for meshes built on geometry)
+  - Groups information (names of groups the element belongs to)
+
+<center>\image html eleminfo2.png 
+<em>"Element Info" page, element information</em></center>
 
 The use can either input the ID of a node or element he wants to
-analyze directly in the dialog box or select the node or element in
+analyze directly in the dialog box or select the node(s) or element(s) in
 the 3D viewer.
 
+\note The information about the groups, the node or element belongs
+to, can be shown in short or detail form. By default, for performance
+reasons, this information is show in short form (group names
+only). Detail information on groups can be switched on via the user
+preferences, see \ref mesh_preferences_page.
+
 \anchor mesh_addition_info_anchor
 <h2>Additional Information</h2> 
 
@@ -64,8 +86,8 @@ For a mesh object, the following information is shown:
 - Groups
 - Sub-meshes
 
-\image html addinfo_mesh.png
-<center><em>"Additional Info" page, mesh information</em></center>
+<center>\image html addinfo_mesh.png
+<em>"Additional Info" page, mesh information</em></center>
 <br>
 
 For a sub-mesh object, the following information is shown:
@@ -73,8 +95,8 @@ For a sub-mesh object, the following information is shown:
 - Parent mesh
 - Shape
 
-\image html addinfo_submesh.png
-<center><em>"Additional Info" page, sub-mesh information</em></center>
+<center>\image html addinfo_submesh.png
+<em>"Additional Info" page, sub-mesh information</em></center>
 <br>
 
 For a group object, the following information is shown:
@@ -86,8 +108,8 @@ For a group object, the following information is shown:
 - Color
 - Number of underlying nodes (for non-nodal groups)
 
-\image html addinfo_group.png
-<center><em>"Additional Info" page, group information</em></center>
+<center>\image html addinfo_group.png
+<em>"Additional Info" page, group information</em></center>
 <br>
 
 \note For the performance reasons, the number of underlying nodes is
@@ -97,6 +119,9 @@ automatically calculated if the size of the group does not exceed
 the "Automatic nodes compute limit" set via the  "Mesh information"
 preferences (zero value means no limit).
 
+The button \b "Dump" allows printing the information displayed in the
+dialog box to the txt file.
+
 In case you get <b>Mesh Information</b> via a TUI script, the information is
 displayed in the Python Console. 
 <b>See the</b> \ref tui_viewing_mesh_infos "TUI Example".
index d2a6eb41fad65a18e0a72404da2ba8a6e3ec52fc..a9d7f87de6acef340cbe282118481461cef1c095 100644 (file)
@@ -73,7 +73,19 @@ mesh groups for which the number of underlying nodes is calculated
 automatically. If the group size exceeds the value set in the preferences,
 the user will have to press \em Compute button explicitly. Zero value
 means "no limit". By default the value is set to 100 000 mesh elements.
-</li></ul>
+</li>
+<li><b>Show details on groups in element information tab</b> - when
+this option is switched off (default), only names of groups, the node
+or element belongs to, are shown in the \ref mesh_element_info_anchor "Info Tab"
+tab of "Mesh Information" dialog box. If this option is
+switched on, the detail information on groups is shown.</li>
+<li><b>Dump base information</b> - Dump base mesh information to the
+file, see \ref mesh_infos_page.</li>
+<li><b>Dump element information</b> - Dump element information to the
+file, see \ref mesh_infos_page.</li>
+<li><b>Dump additional information</b> - Dump additional mesh
+information to the file, see \ref mesh_infos_page.</li>
+</ul>
 <li><b>Automatic Parameters</b></li>
 <ul>
 <li><b>Ratio Bounding Box Diagonal / Max Size</b> - this parameter is
index 5589ba3a761c8199ea4716deab69ce9cacb9ad88..d689028698952d49a49db35524f77840a9889b72 100644 (file)
@@ -2,23 +2,73 @@
 
 \page prism_3d_algo_page 3D extrusion meshing algorithm
 
-3D extrusion algorithm can be used for meshing prisms, i.e. <b>3D Shapes</b>
+3D extrusion algorithm can be used for meshing prisms, i.e. 3D shapes
 defined by two opposing faces having the same number of vertices and
-edges and meshed using, for example,  the \ref projection_algos_page
-"2D Projection" algorithm. These two faces should be connected by
-quadrangle "side" faces.
+edges. These two faces should be connected by quadrangle "side" faces.
 
-The opposing faces can be meshed with either quadrangles or triangles,
-while the side faces should be meshed with quadrangles only.
+The prism is allowed to have sides composed of several faces. (A prism
+side is a row of faces (or one face) connecting corresponding edges of
+the top and base faces). But there is a limitation that a prism 
+side is allowed to be split only vertically as indicated in the
+picture below. 
 
-\image html image157.gif "Prism with 3D extrusion meshing".
+\image html prism_ok_ko.png
+In this picture, the left prism is suitable for meshing with 3D
+extrusion algorithm; it has six sides two of which are split
+vertically. And the right prism can't be meshed with this
+algorithm because one of the prism sides is split horizontally (a
+splitting edge is highlighted).
 
-As you can see, the <b>3D extrusion</b> algorithm permits to build and to
-have in the same 3D mesh such elements as hexahedrons, prisms and
-polyhedrons.
+The algorithm can propagate 2D mesh not only between horizontal
+(i.e. base and top) faces of one prism but also between faces of prisms
+organized in a stack and between stacks sharing prism sides.
 
-\note This algorithm works correctly only if the opposing faces have
-the same (or similar) meshing topography. Otherwise, 3D extrusion
-algorithm can fail to build mesh volumes.
+\image html prism_stack.png
+In this picture, four neighboring prism stacks, each comprising two prisms,
+are shown. The shown sub-mesh is used by the algorithm to mesh
+all the eight prisms in the stacks.
+
+To use <em>3D extrusion</em> algorithm you need to assign algorithms
+and hypotheses of lower dimension as follows.
+(A sample picture below shows algorithms and hypotheses used to
+mesh a cylinder with prismatic volumes).
+
+\image html prism_needs_hyps.png
+
+\b Global algorithms and hypotheses to be chosen at 
+\ref create_mesh_anchor "Creation of a mesh object" are:
+<ul>
+<li> 1D algorithm and hypothesis that will be applied for meshing
+  (logically) vertical edges of the prism (these edges connect the top and
+  base faces of prism). In the sample picture above these are
+  "Regular_1D" algorithm and "Nb. Segments_1" hypothesis.</li>
+</ul>
+
+\b Local algorithms and hypotheses to be chosen at 
+\ref constructing_submeshes_page "Constructing sub-meshes" are:
+<ul>
+  <li> 1D and 2D algorithms and hypotheses that will be applied for
+    meshing the top and base prism faces. These faces can be meshed
+    with any type of 2D elements: quadrangles, triangles, polygons or
+    their mix. It's enough to define a sub-mesh on either top or base
+    face. In the sample picture above, "BLSURF" algorithm meshes
+    "Face_1" base surface with triangles. (1D algorithm is not
+    assigned as "BLSURF" does not require divided edges to create 2D mesh.)
+  </li>
+  <li> Optionally you can define an 1D sub-mesh on some vertical edges
+    of stacked prisms, which will override the global 1D hypothesis mentioned
+    above. In the picture above the picture of Object Browser, the
+    vertical division is not equidistant on all the length because of
+    a "Number Of Segments" hypothesis with Scale Factor=3 assigned to
+    the highlighted edge. 
+</li></ul>
+
+\image html image157.gif 
+
+Prism with 3D extrusion meshing. "Vertical" division is different on
+neighbor edges due to local 1D hypotheses assigned.
+
+\sa a sample TUI Script of
+\ref tui_prism_3d_algo "Use 3D extrusion meshing algorithm".
 
 */
index dcbae8db4056b95ac68be47f352b383f4e82feb9..4cd8b81faf12e0adbabbae19d29b3bc7013148b0 100644 (file)
@@ -16,44 +16,51 @@ The following dialog box will appear:
 
 \image html projection_1d.png
 
-In this menu you can define the \b Name of the algorithm, the already
-meshed source \b Edge and the \b Mesh  (It can be omitted only when 
-projecting a submesh on another one from the same global Mesh). 
-It could also be necessary to define the orientation of edges, 
-which is done by indicating the <b>Source Vertex</b> being the first point 
-of the Source Edge and the <b>Target Vertex</b> being the first point of 
-the created \b Edge. 
+In this dialog you can define
+<ul>
+  <li> the \b Name of the algorithm,</li>
+  <li> the already meshed <b> Source Edge</b> and </li>
+  <li> the <b>Source Mesh </b> (It can be omitted only when projecting
+    a sub-mesh on another one of the same Mesh).</li>
+  <li> It could also be necessary to define the orientation of edges, 
+    which is done by indicating the <b>Source Vertex</b> being the
+    first point of the <b>Source Edge </b>and the <b>Target Vertex</b> being
+    the first point of the edge being meshed.</li>
+</ul>
 <br>
 For a group of edges, <b>Source</b> and <b>Target</b> vertices should be
-shared by one edge of the group. If <b>Source</b> and <b>Target</b>
-vertices are specified, the elements of the group must be adjacent.
+shared by only one edge of the group. If <b>Source</b> and <b>Target</b>
+vertices are specified, the edges in the group must be connected.
 The source and target groups must contain equal number of edges
 and they must form topologically equal structures.
 
 \n <b>Projection 2D</b> algorithm allows to define the mesh of a face
-(or group of faces) by the
-projection of another already meshed face (or group of faces). This
-algorithm works only
-if all edges of the target face have been meshed as 1D Projections of
-the edges of the source face.
+(or group of faces) by the projection of another already meshed face
+(or group of faces). This algorithm works only if all edges of the
+target face have been discretized into the same number of
+segments as corresponding edges of the source face.
 
 To apply this algorithm select the face to be meshed (indicated in the
 field \b Geometry of <b>Create mesh</b> dialog box), <b>Projection
-2D</b> in the list
-of 2D algorithms and click the <em>"Add Hypothesis"</em> button. The
-following dialog box will appear:
+2D</b> in the list of 2D algorithms and click the <em> "Add
+Hypothesis"</em> button. The following dialog box will appear:
 
 \image html projection_2d.png
 
-In this menu you can define the \b Name of the algorithm, the already
-meshed source \b Face and the \b Mesh (It can be omitted only when 
-projecting a submesh on another one from the same global Mesh). 
-It could also be necessary to define the orientation of mesh on the
-face, which is done by indicating two <b>Source Vertices</b>, which
-belong to the same edge of the source face, and two <b>Target
-Vertices</b>, which belong to the same edge of the created \b Face.
-For groups of face, they must contain equal number of faces
-and they must form topologically equal structures.
+In this dialog you can define 
+<ul>
+  <li> the \b Name of the algorithm, </li>
+  <li> the already meshed <b> Source Face </b> and </li>
+  <li> the <b> Source Mesh </b> (It can be omitted only when 
+    projecting a submesh on another one of the same Mesh). </li>
+  <li> It could also be necessary to define the orientation of mesh on
+    the face, which is done by indicating two <b>Source Vertices</b>,
+    which belong to the same edge of the <b>Source Face</b>, and
+    two <b>Target Vertices</b>, which belong to the same edge of the
+    face being meshed.</li>
+</ul>
+For groups of face, the groups must contain equal number of faces and
+they must form topologically equal structures. 
 
 \n <b>Projection 1D-2D</b> algorithm differs from <b>Projection 2D</b>
 algorithm in one aspect: it generates mesh segments on edges of
index 146a7fa7881db76f0667e83b215b1107d2e5d215..7ef8da51d88744b831307b1d08a14975dddfb83e 100755 (executable)
@@ -7,8 +7,12 @@ In this dialog you can specify the properties of the scalar bar
 \image html scalar_bar_dlg.png
 
 <ul>
-<li><b>Scalar Range</b> in this menu you can specify 
-<b>Min value</b> and <b>Max value</b> of the <b>Scalar Bar</b> </li>
+<li><b>Scalar Range</b> - in this menu you can specify 
+<b>Min value</b> and <b>Max value</b> of the <b>Scalar Bar</b>, and
+also you can turn on/off <b>Logarithmic</b> scaling of the scalar bar.</li>
+
+\note <b>Logarithmic scale</b> is not applicable in case of
+negative and zero values in the range. In such cases it is disabled.
 
 <li><b>Font</b> - in this menu you can set type, face and color for
 the font of <b>Title</b> and <b>Labels</b> of the <b>Scalar
@@ -29,7 +33,7 @@ location (<b>X</b> and <b>Y</b>) and size (<b>Width</b> and
 side)</li>
 <li><b>Y</b>: ordinate of the origin (from the bottom)</li>
 </ul>
-<li><b>Distribution</b> in this menu you can Show/Hide distribution histogram of the values of the <b>Scalar Bar</b> and specify histogram properties</li>
+<li><b>Distribution</b> in this menu you can Show/Hide distribution histogram of the values of the <b>Scalar Bar</b> and specify histogram properties</li>
 <ul>
 <li><b>Multicolor</b> the histogram is colored as <b>Scalar Bar</b></li>
 <li><b>Monocolor</b> the histogram is colored as selected with <b>Distribution color</b> selector</li>
index b2b48795433139e409648bd3b7b45957bb352437..699e5c981ee9fe8046286bfafd5f5073b2316f8f 100644 (file)
@@ -36,80 +36,8 @@ An example below demonstrates usage of the Python API for 3d mesh generation.
 
 \anchor example_3d_mesh
 <h2>Example of 3d mesh generation:</h2>
-
-\code
-from geompy import * 
-import smesh 
-
-###
-# Geometry: an assembly of a box, a cylinder and a truncated cone
-# meshed with tetrahedral 
-###
-
-# Define values
-name = "ex21_lamp" 
-cote = 60 
-section = 20 
-size = 200 
-radius_1 = 80 
-radius_2 = 40 
-height = 100 
-
-# Build a box
-box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote) 
-
-# Build a cylinder
-pt1 = MakeVertex(0, 0, cote/3) 
-di1 = MakeVectorDXDYDZ(0, 0, 1) 
-cyl = MakeCylinder(pt1, di1, section, size) 
-
-# Build a truncated cone
-pt2 = MakeVertex(0, 0, size) 
-cone = MakeCone(pt2, di1, radius_1, radius_2, height) 
-
-# Fuse
-box_cyl = MakeFuse(box, cyl) 
-piece = MakeFuse(box_cyl, cone) 
-
-# Add to the study
-addToStudy(piece, name) 
-
-# Create a group of faces
-group = CreateGroup(piece, ShapeType["FACE"]) 
-group_name = name + "_grp" 
-addToStudy(group, group_name) 
-group.SetName(group_name) 
-
-# Add faces to the group
-faces = SubShapeAllIDs(piece, ShapeType["FACE"]) 
-UnionIDs(group, faces) 
-
-###
-# Create a mesh
-###
-
-# Define a mesh on a geometry
-tetra = smesh.Mesh(piece, name) 
-
-# Define 1D hypothesis
-algo1d = tetra.Segment() 
-algo1d.LocalLength(10) 
-
-# Define 2D hypothesis
-algo2d = tetra.Triangle() 
-algo2d.LengthFromEdges() 
-
-# Define 3D hypothesis
-algo3d = tetra.Tetrahedron()
-algo3d.MaxElementVolume(100) 
-
-# Compute the mesh
-tetra.Compute() 
-
-# Create a groupe of faces
-tetra.Group(group)
-
-\endcode
+\include 3dmesh.py
+<a href="../../examples/SMESH/3dmesh.py">Download this script</a>
 
 Examples of Python scripts for Mesh operations are available by
 the following links:
@@ -128,5 +56,6 @@ the following links:
 - \subpage tui_measurements_page
 - \subpage tui_generate_flat_elements_page
 - \subpage tui_work_on_objects_from_gui
+- \subpage tui_prism_3d_algo
 
 */
index 3eb7f0fe2f16756effd5dcdb397534fe95c4c3b4..4cc1ec654f4103892bc67e3a6e74df69ac39fa84 100644 (file)
@@ -1,49 +1,7 @@
 /*!
 
 \page tui_cartesian_algo Usage of Body Fitting algorithm
-
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-# create a sphere
-sphere = geompy.MakeSphereR( 50 )
-geompy.addToStudy( sphere, "sphere" )
-
-# create a mesh and assign a "Body Fitting" algo
-mesh = Mesh( sphere )
-cartAlgo = mesh.BodyFitted()
-
-# define a cartesian grid using Coordinates
-coords = range(-100,100,10)
-cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000)
-
-# compute the mesh
-mesh.Compute()
-print "nb hexahedra",mesh.NbHexas()
-print "nb tetrahedra",mesh.NbTetras()
-print "nb polyhedra",mesh.NbPolyhedrons()
-print
-
-# define the grid by setting constant spacing
-cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
-
-mesh.Compute()
-print "nb hexahedra",mesh.NbHexas()
-print "nb tetrahedra",mesh.NbTetras()
-print "nb polyhedra",mesh.NbPolyhedrons()
-
-
-# define the grid by setting different spacing in 2 sub-ranges of geometry
-spaceFuns = ["5","10+10*t"]
-cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 )
-
-mesh.Compute()
-print "nb hexahedra",mesh.NbHexas()
-print "nb tetrahedra",mesh.NbTetras()
-print "nb polyhedra",mesh.NbPolyhedrons()
-print
-
-\endcode
+\include cartesian_algo.py
+<a href="../../examples/SMESH/cartesian_algo.py">Download this script</a>
 
 */
index 24161d483df084fb02a673ffa9d7d38b647bad91..bdeeb8a7a9957243e1f5d20dc26e9853b66c9fc6 100644 (file)
 
 <br>
 <h2>Construction of a Mesh</h2>
-
-\code
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-tetra = smesh.Mesh(box, "MeshBox")
-
-algo1D = tetra.Segment()
-algo1D.NumberOfSegments(7)
-
-algo2D = tetra.Triangle()
-algo2D.MaxElementArea(800.)
-
-algo3D = tetra.Tetrahedron()
-algo3D.MaxElementVolume(900.)
-
-# compute the mesh
-ret = tetra.Compute()
-if ret == 0:
-    print "problem when computing the mesh"
-else:
-    print "mesh computed"
-    pass
-\endcode
+\include creating_meshes_ex01.py
+<a href="../../examples/SMESH/creating_meshes_ex01.py">Download this script</a>
 
 <br>
 \anchor tui_construction_submesh
 <h2>Construction of a Submesh</h2>
-
-\code
-from geompy import *
-import smesh
-
-# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
-
-# select one edge of the box for definition of a local hypothesis
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
-
-# create a hexahedral mesh on the box
-quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
-
-# create a regular 1D algorithm for the faces
-algo1D = quadra.Segment()
-
-# define "NumberOfSegments" hypothesis to cut
-# all the edges in a fixed number of segments
-algo1D.NumberOfSegments(4)
-
-# create a quadrangle 2D algorithm for the faces
-quadra.Quadrangle()
-
-# construct a submesh on the edge with a local hypothesis
-algo_local = quadra.Segment(EdgeX)
-
-# define "Arithmetic1D" hypothesis to cut the edge in several segments with increasing arithmetic length
-algo_local.Arithmetic1D(1, 4)
-
-# define "Propagation" hypothesis that propagates all other hypotheses
-# on all edges of the opposite side in case of quadrangular faces
-algo_local.Propagation()
-
-# compute the mesh
-quadra.Compute()
-
-\endcode
+\include creating_meshes_ex02.py
+<a href="../../examples/SMESH/creating_meshes_ex02.py">Download this script</a>
 
 <br>
 <h2>Change priority of submeshes in Mesh</h2>
-
-\code
-import salome
-import geompy
-import smesh
-import SMESH
-
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-[Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
-
-# create Mesh object on Box shape
-Mesh_1 = smesh.Mesh(Box_1)
-
-# assign mesh algorithms
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
-Nb_Segments_1.SetDistrType( 0 )
-MEFISTO_2D = Mesh_1.Triangle()
-Max_Element_Area_1 = MEFISTO_2D.MaxElementArea(1200)
-Tetrahedron = Mesh_1.Tetrahedron()
-Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000)
-
-# create submesh and assign algorithms on Face_1
-Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
-Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
-Nb_Segments_2.SetDistrType( 0 )
-MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
-Length_From_Edges_2D = MEFISTO_2D_1.LengthFromEdges()
-SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
-
-# create submesh and assign algorithms on Face_2
-Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
-Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
-Nb_Segments_3.SetDistrType( 0 )
-MEFISTO_2D_2 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_2)
-Length_From_Edges_2D_1 = MEFISTO_2D_2.LengthFromEdges()
-SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
-
-# create submesh and assign algorithms on Face_3
-Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
-Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
-Nb_Segments_4.SetDistrType( 0 )
-MEFISTO_2D_3 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_3)
-Length_From_Edges_2D_2 = MEFISTO_2D_3.LengthFromEdges()
-SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
-
-# check exisiting submesh priority order
-[ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder()
-# set new submesh order
-isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ])
-# compute mesh
-isDone = Mesh_1.Compute()
-
-# clear mesh result and compute with other submesh order
-Mesh_1.Clear()
-isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ])
-isDone = Mesh_1.Compute()
-
-\endcode
+\include creating_meshes_ex03.py
+<a href="../../examples/SMESH/creating_meshes_ex03.py">Download this script</a>
 
 <br>
 \anchor tui_editing_mesh
 <h2>Editing of a mesh</h2>
-
-\code
-import geompy
-import smesh
-
-def PrintMeshInfo(theMesh):
-    aMesh = theMesh.GetMesh()
-    print "Information about mesh:"
-    print "Number of nodes       : ", aMesh.NbNodes()
-    print "Number of edges       : ", aMesh.NbEdges()
-    print "Number of faces       : ", aMesh.NbFaces()
-    print "Number of volumes     : ", aMesh.NbVolumes()
-    pass
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
-geompy.addToStudy(box, "box")
-
-# select one edge of the box for definition of a local hypothesis
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
-edge = subShapeList[0]
-name = geompy.SubShapeName(edge, box)
-geompy.addToStudyInFather(box, edge, name)
-
-# create a mesh
-tria = smesh.Mesh(box, "Mesh 2D")
-algo1D = tria.Segment()
-hyp1 = algo1D.NumberOfSegments(3)
-algo2D = tria.Triangle()
-hyp2 = algo2D.MaxElementArea(10.)
-
-# create a sub-mesh
-algo_local = tria.Segment(edge)
-hyp3 = algo_local.Arithmetic1D(1, 6)
-hyp4 = algo_local.Propagation()
-
-# compute the mesh
-tria.Compute()
-PrintMeshInfo(tria)
-
-# remove a local hypothesis
-mesh = tria.GetMesh()
-mesh.RemoveHypothesis(edge, hyp4)
-
-# compute the mesh
-tria.Compute()
-PrintMeshInfo(tria)
-
-# change the value of the 2D hypothesis
-hyp2.SetMaxElementArea(2.)
-
-# compute the mesh
-tria.Compute()
-PrintMeshInfo(tria)
-\endcode
+\include creating_meshes_ex04.py
+<a href="../../examples/SMESH/creating_meshes_ex04.py">Download this script</a>
 
 <br>
 \anchor tui_export_mesh
 <h2>Export of a Mesh</h2>
-
-\code
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# create a mesh
-tetra = smesh.Mesh(box, "MeshBox")
-
-algo1D = tetra.Segment()
-algo1D.NumberOfSegments(7)
-
-algo2D = tetra.Triangle()
-algo2D.MaxElementArea(800.)
-
-algo3D = tetra.Tetrahedron()
-algo3D.MaxElementVolume(900.)
-
-# compute the mesh
-tetra.Compute()
-
-# export the mesh in a MED file
-tetra.ExportMED("/tmp/meshMED.med", 0)
-
-# export a group in a MED file
-face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
-group = tetra.GroupOnGeom( face, "face group" ) # group of 2D elements on the <face>
-tetra.ExportMED("/tmp/groupMED.med", meshPart=group)
-\endcode
+\include creating_meshes_ex05.py
+<a href="../../examples/SMESH/creating_meshes_ex05.py">Download this script</a>
 
 <br>
 <h2>How to mesh a cylinder with hexahedrons?</h2>
 Here you can see an example of python script, creating a hexahedral
 mesh on a cylinder. And a picture below the source code of the script,
 demonstrating the resulting mesh.
-\include ex24_cylinder.py
+\include creating_meshes_ex06.py
+<a href="../../examples/SMESH/creating_meshes_ex06.py">Download this script</a>
 
 \image html mesh_cylinder_hexa.png
 
 <br>
 \anchor tui_building_compound
 <h2>Building a compound of meshes</h2>
-\dontinclude SMESH_BuildCompound.py
-\skipline import geompy
-\until #end
+\include creating_meshes_ex07.py
+<a href="../../examples/SMESH/creating_meshes_ex07.py">Download this script</a>
 
 <br>
 \anchor tui_copy_mesh
 <h2>Mesh Copying</h2>
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-# make geometry of a box
-box = geompy.MakeBoxDXDYDZ(100,100,100)
-face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
-
-# generate 3D mesh
-mesh = Mesh(box)
-localAlgo = mesh.Triangle(face)
-mesh.AutomaticHexahedralization()
-
-# objects to copy
-fGroup = mesh.GroupOnGeom( face, "2D on face")
-nGroup = mesh.GroupOnGeom( face, "nodes on face", NODE)
-subMesh = localAlgo.GetSubMesh()
-
-# make a new mesh by copying different parts of the mesh
-
-# 1. copy the whole mesh
-newMesh = CopyMesh( mesh, "whole mesh copy")
-
-# 2. copy a group of 2D elements along with groups
-newMesh = CopyMesh( fGroup,  "face group copy with groups",toCopyGroups=True)
-
-# 3. copy a group of nodes with preseving their ids
-newMesh = CopyMesh( nGroup, "node group copy", toKeepIDs=True)
-
-# 4. copy some faces
-faceIds = fGroup.GetIDs()[-10:]
-newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy")
-
-# 5. copy some nodes
-nodeIds = nGroup.GetIDs()[-10:]
-newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy")
-
-# 6. copy a sub-mesh
-newMesh = CopyMesh( subMesh, "submesh copy" )
-\endcode
+\include creating_meshes_ex08.py
+<a href="../../examples/SMESH/creating_meshes_ex08.py">Download this script</a>
 
 */
index d9e2b31f9cc56400922037e515cb0fbe7d7743de..3f3124db3df216755c23b75fafa5ed511dd2cfe4 100644 (file)
@@ -44,738 +44,102 @@ This page provides example codes of \ref tui_defining_meshing_algos
 <br>
 \anchor tui_1d_arithmetic
 <h3>Arithmetic 1D</h3>
-
-\code
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
-geompy.addToStudy(box, "Box")
-
-# create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# create a Regular 1D algorithm for edges
-algo1D = hexa.Segment()
-
-# optionally reverse node distribution on certain edges
-allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"])
-reversedEdges = [ allEdges[0], allEdges[4] ]
-
-# define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length 
-algo1D.Arithmetic1D(1, 4, reversedEdges)
-
-# create a quadrangle 2D algorithm for faces
-hexa.Quadrangle()
-
-# create a hexahedron 3D algorithm for solids
-hexa.Hexahedron()
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex01.py
+<a href="../../examples/SMESH/defining_hypotheses_ex01.py">Download this script</a>
 
 <br>
 \anchor tui_deflection_1d
 <h3>Deflection 1D and Number of Segments</h3>
-
-\code
-import geompy
-import smesh
-
-# create a face from arc and straight segment
-px = geompy.MakeVertex(100., 0.  , 0.  )
-py = geompy.MakeVertex(0.  , 100., 0.  )
-pz = geompy.MakeVertex(0.  , 0.  , 100.)
-
-exy = geompy.MakeEdge(px, py)
-arc = geompy.MakeArc(py, pz, px)
-
-wire = geompy.MakeWire([exy, arc])
-
-isPlanarFace = 1
-face1 = geompy.MakeFace(wire, isPlanarFace)
-geompy.addToStudy(face1,"Face1")
-
-# get edges from the face
-e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
-geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
-
-# create hexahedral mesh
-hexa = smesh.Mesh(face1, "Face : triangle mesh")
-
-# define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
-algo1D = hexa.Segment()
-algo1D.NumberOfSegments(6)
-
-# define "MaxElementArea" hypothesis
-algo2D = hexa.Triangle()
-algo2D.MaxElementArea(70.0)
-
-# define a local "Deflection1D" hypothesis on the arc
-algo_local = hexa.Segment(e_arc)
-algo_local.Deflection1D(1.0)
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex02.py
+<a href="../../examples/SMESH/defining_hypotheses_ex02.py">Download this script</a>
 
 <br>
 \anchor tui_start_and_end_length
 <h3>Start and End Length</h3>
-
-\code
-from geompy import *
-import smesh
-
-# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
-
-# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
-
-# create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# set algorithms
-algo1D = hexa.Segment()
-hexa.Quadrangle()
-hexa.Hexahedron()
-
-# define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
-algo1D.NumberOfSegments(4)
-
-# create a local hypothesis
-algo_local = hexa.Segment(EdgeX)
-
-# define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
-algo_local.StartEndLength(1, 6)
-
-# define "Propagation" hypothesis that propagates all other hypothesis
-# on all edges on the opposite side in case of quadrangular faces
-algo_local.Propagation()
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex03.py
+<a href="../../examples/SMESH/defining_hypotheses_ex03.py">Download this script</a>
 
 <br>
 \anchor tui_average_length
 <h3>Local Length</h3>
-
-\code
-from geompy import *
-import smesh
-
-# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
-
-# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
-
-# create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# set algorithms
-algo1D = hexa.Segment()
-hexa.Quadrangle()
-hexa.Hexahedron()
-
-# define "NumberOfSegments" hypothesis to cut all edges in a fixed number of segments
-algo1D.NumberOfSegments(4)
-
-# create a sub-mesh
-algo_local = hexa.Segment(EdgeX)
-
-# define "LocalLength" hypothesis to cut an edge in several segments with the same length
-algo_local.LocalLength(2.)
-
-# define "Propagation" hypothesis that propagates all other hypothesis
-# on all edges on the opposite side in case of quadrangular faces
-algo_local.Propagation()
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex04.py
+<a href="../../examples/SMESH/defining_hypotheses_ex04.py">Download this script</a>
 
 <br><h2>Defining 2D and 3D hypotheses</h2>
 
 <br>
 \anchor tui_max_element_area
 <h3>Maximum Element Area</h3>
-
-\code
-import geompy
-import smesh
-import salome 
-
-# create a face
-px   = geompy.MakeVertex(100., 0.  , 0.  )
-py   = geompy.MakeVertex(0.  , 100., 0.  )
-pz   = geompy.MakeVertex(0.  , 0.  , 100.)
-
-vxy = geompy.MakeVector(px, py)
-arc = geompy.MakeArc(py, pz, px)
-wire = geompy.MakeWire([vxy, arc])
-
-isPlanarFace = 1
-face = geompy.MakeFace(wire, isPlanarFace)
-
-# add the face in the study
-id_face = geompy.addToStudy(face, "Face to be meshed")
-
-# create a mesh
-tria_mesh = smesh.Mesh(face, "Face : triangulation")
-
-# define 1D meshing:
-algo = tria_mesh.Segment()
-algo.NumberOfSegments(20)
-
-# define 2D meshing:
-
-# assign triangulation algorithm
-algo = tria_mesh.Triangle()
-
-# apply "Max Element Area" hypothesis to each triangle
-algo.MaxElementArea(100)
-
-# compute the mesh
-tria_mesh.Compute()
-\endcode
+\include defining_hypotheses_ex05.py
+<a href="../../examples/SMESH/defining_hypotheses_ex05.py">Download this script</a>
 
 <br>
 \anchor tui_max_element_volume
 <h3>Maximum Element Volume</h3>
-
-\code
-import geompy
-import smesh
-
-# create a cylinder
-cyl = geompy.MakeCylinderRH(30., 50.)
-geompy.addToStudy(cyl, "cyl")
-
-# create a mesh on the cylinder
-tetra = smesh.Mesh(cyl, "Cylinder : tetrahedrical mesh")
-
-# assign algorithms
-algo1D = tetra.Segment()
-algo2D = tetra.Triangle()
-algo3D = tetra.Tetrahedron()
-
-# assign 1D and 2D hypotheses
-algo1D.NumberOfSegments(7)
-algo2D.MaxElementArea(150.)
-
-# assign Max Element Volume hypothesis
-algo3D.MaxElementVolume(200.)
-
-# compute the mesh
-ret = tetra.Compute()
-if ret == 0:
-    print "probleme when computing the mesh"
-else:
-    print "Computation succeded"
-\endcode
+\include defining_hypotheses_ex06.py
+<a href="../../examples/SMESH/defining_hypotheses_ex06.py">Download this script</a>
 
 <br>
 \anchor tui_length_from_edges
 <h3>Length from Edges</h3>
-
-\code
-import geompy
-import smesh
-
-# create sketchers
-sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
-sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
-
-# create a face from two wires
-isPlanarFace = 1
-face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
-geompy.addToStudy(face1, "Face1")
-
-# create a mesh
-tria = smesh.Mesh(face1, "Face : triangle 2D mesh")
-
-# Define 1D meshing
-algo1D = tria.Segment()
-algo1D.NumberOfSegments(2)
-
-# create and assign the algorithm for 2D meshing with triangles
-algo2D = tria.Triangle()
-
-# create and assign "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
-algo2D.LengthFromEdges()
-
-# compute the mesh
-tria.Compute()
-\endcode
+\include defining_hypotheses_ex07.py
+<a href="../../examples/SMESH/defining_hypotheses_ex07.py">Download this script</a>
 
 <br><h2>Defining Additional Hypotheses</h2>
 
 <br>
 \anchor tui_propagation
 <h3>Propagation</h3>
-
-\code
-from geompy import *
-import smesh
-
-# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
-
-# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
-
-# create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# set global algorithms and hypotheses
-algo1D = hexa.Segment()
-hexa.Quadrangle()
-hexa.Hexahedron()
-algo1D.NumberOfSegments(4)
-
-# create a sub-mesh with local 1D hypothesis and propagation
-algo_local = hexa.Segment(EdgeX)
-
-# define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
-algo_local.Arithmetic1D(1, 4)
-
-# define "Propagation" hypothesis that propagates all other 1D hypotheses
-# from all edges on the opposite side of a face in case of quadrangular faces
-algo_local.Propagation()
-
-# compute the mesh
-hexa.Compute()
-\endcode
+\include defining_hypotheses_ex08.py
+<a href="../../examples/SMESH/defining_hypotheses_ex08.py">Download this script</a>
 
 <br>
 \anchor tui_defining_meshing_algos
 <h2>Defining Meshing Algorithms</h2>
-
-\code
-import geompy
-import smesh
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
-geompy.addToStudy(box, "Box")
-
-# 1. Create a hexahedral mesh on the box
-hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
-
-# create a Regular 1D algorithm for edges
-algo1D = hexa.Segment()
-
-# create a quadrangle 2D algorithm for faces
-algo2D = hexa.Quadrangle()
-
-# create a hexahedron 3D algorithm for solids
-algo3D = hexa.Hexahedron()
-
-# define hypotheses
-algo1D.Arithmetic1D(1, 4)
-
-# compute the mesh
-hexa.Compute()
-
-# 2. Create a tetrahedral mesh on the box
-tetra = smesh.Mesh(box, "Box : tetrahedrical mesh")
-
-# create a Regular 1D algorithm for edges
-algo1D = tetra.Segment()
-
-# create a Mefisto 2D algorithm for faces
-algo2D = tetra.Triangle()
-
-# create a 3D algorithm for solids
-algo3D = tetra.Tetrahedron()
-
-# define hypotheses
-algo1D.Arithmetic1D(1, 4)
-algo2D.LengthFromEdges()
-
-# compute the mesh
-tetra.Compute()
-
-\endcode
+\include defining_hypotheses_ex09.py
+<a href="../../examples/SMESH/defining_hypotheses_ex09.py">Download this script</a>
 
 <br>
 \anchor tui_projection
 <h3>Projection Algorithms</h3>
-
-\code
-# Project prisms from one meshed box to another mesh on the same box
-
-from smesh import *
-
-# Prepare geometry
-
-# Create a parallelepiped
-box = geompy.MakeBoxDXDYDZ(200, 100, 70)
-geompy.addToStudy( box, "box" )
-
-# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
-faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-# 2 adjacent faces of the box
-f1 = faces[2]
-f2 = faces[0]
-# face opposite to f2
-f2opp = faces[1]
-
-# Get vertices used to specify how to associate sides of faces at projection
-[v1F1, v2F1] = geompy.SubShapeAll(f1, geompy.ShapeType["VERTEX"])[:2]
-[v1F2, v2F2] = geompy.SubShapeAll(f2, geompy.ShapeType["VERTEX"])[:2]
-geompy.addToStudyInFather( box, v1F1, "v1F1" )
-geompy.addToStudyInFather( box, v2F1, "v2F1" )
-geompy.addToStudyInFather( box, v1F2, "v1F2" )
-geompy.addToStudyInFather( box, v2F2, "v2F2" )
-
-# Make group of 3 edges of f1 and f2
-edgesF1 = geompy.CreateGroup(f1, geompy.ShapeType["EDGE"])
-geompy.UnionList( edgesF1, geompy.SubShapeAll(f1, geompy.ShapeType["EDGE"])[:3])
-edgesF2 = geompy.CreateGroup(f2, geompy.ShapeType["EDGE"])
-geompy.UnionList( edgesF2, geompy.SubShapeAll(f2, geompy.ShapeType["EDGE"])[:3])
-geompy.addToStudyInFather( box, edgesF1, "edgesF1" )
-geompy.addToStudyInFather( box, edgesF2, "edgesF2" )
-
-
-# Make the source mesh with prisms
-src_mesh = Mesh(box, "Source mesh")
-src_mesh.Segment().NumberOfSegments(9,10)
-src_mesh.Quadrangle()
-src_mesh.Hexahedron()
-src_mesh.Triangle(f1) # triangular sumbesh 
-src_mesh.Compute()
-
-
-# Mesh the box using projection algoritms
-
-# Define the same global 1D and 2D hypotheses
-tgt_mesh = Mesh(box, "Target mesh")
-tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True)
-tgt_mesh.Quadrangle()
-
-# Define Projection 1D algorithm to project 1d mesh elements from group edgesF2 to edgesF1
-# It is actually not needed, just a demonstration
-proj1D = tgt_mesh.Projection1D( edgesF1 )
-# each vertex must be at the end of a connected group of edges (or a sole edge)
-proj1D.SourceEdge( edgesF2, src_mesh, v2F1, v2F2 )
-
-# Define 2D hypotheses to project triangles from f1 face of the source mesh to
-# f2 face in the target mesh. Vertices specify how to associate sides of faces
-proj2D = tgt_mesh.Projection2D( f2 )
-proj2D.SourceFace( f1, src_mesh, v1F1, v1F2, v2F1, v2F2 )
-
-# 2D hypotheses to project triangles from f2 of target mesh to the face opposite to f2.
-# Association of face sides is default
-proj2D = tgt_mesh.Projection2D( f2opp )
-proj2D.SourceFace( f2 )
-
-# 3D hypotheses to project prisms from the source to the target mesh
-proj3D = tgt_mesh.Projection3D()
-proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 )
-tgt_mesh.Compute()
-
-# Move the source mesh to visualy compare the two meshes
-src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
-
-\endcode
+\include defining_hypotheses_ex10.py
+<a href="../../examples/SMESH/defining_hypotheses_ex10.py">Download this script</a>
 
 <h3>Projection 1D2D</h3>
-
-\code
-# Project triangles from one meshed face to another mesh on the same box
-
-from smesh import *
-
-# Prepare geometry
-
-# Create a box
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-
-# Get geom faces to mesh with triangles in the 1ts and 2nd meshes
-faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-# 2 adjacent faces of the box
-Face_1 = faces[2]
-Face_2 = faces[0]
-
-geompy.addToStudy( box, 'box' )
-geompy.addToStudyInFather( box, Face_1, 'Face_1' )
-geompy.addToStudyInFather( box, Face_2, 'Face_2' )
-
-# Make the source mesh with Netgem2D
-src_mesh = Mesh(Face_1, "Source mesh")
-src_mesh.Segment().NumberOfSegments(15)
-src_mesh.Triangle()
-src_mesh.Compute()
-
-# Mesh the target mesh using the algoritm Projection1D2D
-tgt_mesh = smesh.Mesh(Face_2, "Target mesh")
-tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh)
-tgt_mesh.Compute()
-\endcode
+\include defining_hypotheses_ex11.py
+<a href="../../examples/SMESH/defining_hypotheses_ex11.py">Download this script</a>
 
 <br>
 
 \anchor tui_fixed_points
 
 <h2>1D Mesh with Fixed Points example</h2>
-
-\code
-import salome
-import geompy
-import smesh
-import StdMeshers
-
-# Create face and explode it on edges
-face = geompy.MakeFaceHW(100, 100, 1)
-edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"])
-geompy.addToStudy( face, "Face" )
-
-# get the first edge from exploded result
-edge1 = geompy.GetSubShapeID(face, edges[0])
-
-# Define Mesh on previously created face
-Mesh_1 = smesh.Mesh(face)
-
-# Create Fixed Point 1D hypothesis and define parameters.
-# Note: values greater than 1.0 and less than 0.0 are not taken into account;
-# duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0
-# add added automatically.
-# The number of segments should correspond to the number of points (NbSeg = NbPnt-1);
-# extra values of segments splitting parameter are not taken into account,
-# while missing values are considered to be equal to 1.
-Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D')
-Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
-Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
-Fixed_points_1D_1.SetReversedEdges( [edge1] )
-
-# Add hypothesis to mesh and define 2D parameters
-Mesh_1.AddHypothesis(Fixed_points_1D_1)
-Regular_1D = Mesh_1.Segment()
-Quadrangle_2D = Mesh_1.Quadrangle()
-# Compute mesh
-Mesh_1.Compute()
-\endcode
+\include defining_hypotheses_ex12.py
+<a href="../../examples/SMESH/defining_hypotheses_ex12.py">Download this script</a>
 
 \anchor tui_radial_quadrangle
 <h2> Radial Quadrangle 1D2D example </h2>
-\code
-from smesh import *
-
-SetCurrentStudy(salome.myStudy)
-
-# Create face from the wire and add to study
-Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
-geompy.addToStudy(Face,"Face")
-edges = geompy.SubShapeAllSorted(Face, geompy.ShapeType["EDGE"])
-circle, radius1, radius2 = edges
-geompy.addToStudyInFather(Face, radius1,"radius1")
-geompy.addToStudyInFather(Face, radius2,"radius2")
-geompy.addToStudyInFather(Face, circle,"circle")
-
-
-# Define geometry for mesh, and Radial Quadrange algorithm
-mesh = smesh.Mesh(Face)
-radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD)
-
-# The Radial Quadrange algorithm can work without any hypothesis
-# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
-mesh.Compute()
-
-# The Radial Quadrange uses global or local 1d hypotheses if it does
-# not have its own hypotheses.
-# Define global hypotheses to discretize radial edges and a local one for circular edge
-global_Nb_Segments = mesh.Segment().NumberOfSegments(5)
-local_Nb_Segments  = mesh.Segment(circle).NumberOfSegments(10)
-mesh.Compute()
-
-# Define own parameters of Radial Quadrange algorithm
-radial_Quad_algo.NumberOfLayers( 4 )
-mesh.Compute()
-\endcode
+\include defining_hypotheses_ex13.py
+<a href="../../examples/SMESH/defining_hypotheses_ex13.py">Download this script</a>
 
 \anchor tui_quadrangle_parameters
 <h2>Quadrangle Parameters example 1 (meshing a face with 3 edges) </h2>
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-# Get 1/4 part from the disk face.
-Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
-Disk_1 = geompy.MakeDiskR(100, 1)
-Common_1 = geompy.MakeCommon(Disk_1, Box_1)
-geompy.addToStudy( Disk_1, "Disk_1" )
-geompy.addToStudy( Box_1, "Box_1" )
-geompy.addToStudy( Common_1, "Common_1" )
-
-# Set the Geometry for meshing
-Mesh_1 = smesh.Mesh(Common_1)
-
-
-# Define 1D hypothesis and compute the mesh
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
-Nb_Segments_1.SetDistrType( 0 )
-
-# Create Quadrangle parameters and define the Base Vertex.
-Quadrangle_2D = Mesh_1.Quadrangle().TriangleVertex( 8 )
-
-Mesh_1.Compute()
-\endcode
+\include defining_hypotheses_ex14.py
+<a href="../../examples/SMESH/defining_hypotheses_ex14.py">Download this script</a>
 
 <h2>Quadrangle Parameters example 2 (using different types) </h2>
-\code
-import geompy
-import smesh
-import StdMeshers
-
-# Make quadrangle face and explode it on edges.
-Vertex_1 = geompy.MakeVertex(0, 0, 0)
-Vertex_2 = geompy.MakeVertex(40, 0, 0)
-Vertex_3 = geompy.MakeVertex(40, 30, 0)
-Vertex_4 = geompy.MakeVertex(0, 30, 0)
-Quadrangle_Face_1 = geompy.MakeQuad4Vertices(Vertex_1, Vertex_4, Vertex_3, Vertex_2)
-[Edge_1,Edge_2,Edge_3,Edge_4] = geompy.SubShapeAllSorted(Quadrangle_Face_1, geompy.ShapeType["EDGE"])
-geompy.addToStudy( Vertex_1, "Vertex_1" )
-geompy.addToStudy( Vertex_2, "Vertex_2" )
-geompy.addToStudy( Vertex_3, "Vertex_3" )
-geompy.addToStudy( Vertex_4, "Vertex_4" )
-geompy.addToStudy( Quadrangle_Face_1, "Quadrangle Face_1" )
-geompy.addToStudyInFather( Quadrangle_Face_1, Edge_2, "Edge_2" )
-
-# Set the Geometry for meshing
-Mesh_1 = smesh.Mesh(Quadrangle_Face_1)
-
-# Create Quadrangle parameters and
-# define the Type as Quadrangle Preference
-Quadrangle_Parameters_1 = smesh.CreateHypothesis('QuadrangleParams')
-Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_QUADRANGLE_PREF )
-
-# Define other hypotheses and algorithms
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(4)
-Nb_Segments_1.SetDistrType( 0 )
-status = Mesh_1.AddHypothesis(Quadrangle_Parameters_1)
-Quadrangle_2D = Mesh_1.Quadrangle()
-
-# Define submesh on one edge to provide different number of segments
-Regular_1D_1 = Mesh_1.Segment(geom=Edge_2)
-Nb_Segments_2 = Regular_1D_1.NumberOfSegments(10)
-Nb_Segments_2.SetDistrType( 0 )
-SubMesh_1 = Regular_1D_1.GetSubMesh()
-
-# Compute mesh (with Quadrangle Preference type)
-isDone = Mesh_1.Compute()
-
-# Change type to Reduced and compute again
-Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_REDUCED )
-isDone = Mesh_1.Compute()
-\endcode
+\include defining_hypotheses_ex15.py
+<a href="../../examples/SMESH/defining_hypotheses_ex15.py">Download this script</a>
 
 \anchor tui_import
 <h2>"Use Existing Elements" example </h2>
-\code
-
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-# Make a patritioned box
-
-box = geompy.MakeBoxDXDYDZ(100,100,100)
-
-N = geompy.MakeVectorDXDYDZ( 1,0,0 )
-O = geompy.MakeVertex( 50,0,0 )
-plane = geompy.MakePlane( O, N, 200 ) # plane YOZ
-
-shape2boxes = geompy.MakeHalfPartition( box, plane )
-boxes = geompy.SubShapeAllSorted(shape2boxes, geompy.ShapeType["SOLID"])
-
-geompy.addToStudy( boxes[0], "boxes[0]")
-geompy.addToStudy( boxes[1], "boxes[1]")
-midFace0 = geompy.SubShapeAllSorted(boxes[0], geompy.ShapeType["FACE"])[5]
-geompy.addToStudyInFather( boxes[0], midFace0, "middle Face")
-midFace1 = geompy.SubShapeAllSorted(boxes[1], geompy.ShapeType["FACE"])[0]
-geompy.addToStudyInFather( boxes[1], midFace1, "middle Face")
-
-# Mesh one of boxes with quadrangles. It is a source mesh
-
-srcMesh = Mesh(boxes[0], "source mesh") # box coloser to CS origin
-nSeg1 = srcMesh.Segment().NumberOfSegments(4)
-srcMesh.Quadrangle()
-srcMesh.Compute()
-srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", FACE )
-
-# Import faces from midFace0 to the target mesh
-
-tgtMesh = Mesh(boxes[1], "target mesh")
-importAlgo = tgtMesh.UseExisting2DElements(midFace1)
-import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
-tgtMesh.Segment().NumberOfSegments(3)
-tgtMesh.Quadrangle()
-tgtMesh.Compute()
-
-# Import the whole source mesh with groups
-import2hyp.SetCopySourceMesh(True,True)
-tgtMesh.Compute()
-\endcode
+\include defining_hypotheses_ex16.py
+<a href="../../examples/SMESH/defining_hypotheses_ex16.py">Download this script</a>
 
 \anchor tui_viscous_layers
 <h2>Viscous layers construction</h2>
 
-\code
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-
-X = geompy.MakeVectorDXDYDZ( 1,0,0 )
-O = geompy.MakeVertex( 100,50,50 )
-plane = geompy.MakePlane( O, X, 200 ) # plane YZ
-
-box = geompy.MakeBoxDXDYDZ(200,100,100)
-
-shape = geompy.MakeHalfPartition( box, plane )
-
-faces = geompy.SubShapeAllSorted(shape, geompy.ShapeType["FACE"])
-face1 = faces[1]
-ignoreFaces = [ faces[0], faces[-1]]
-
-geompy.addToStudy( shape, "shape" )
-geompy.addToStudyInFather( shape, face1, "face1")
-
-
-mesh = Mesh(shape, "CFD")
-
-mesh.Segment().NumberOfSegments( 4 )
-
-mesh.Triangle()
-mesh.Quadrangle(face1)
-mesh.Compute()
-algo3D = mesh.Tetrahedron()
-
-thickness = 20
-numberOfLayers = 10
-stretchFactor = 1.5
-layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFaces)
-
-mesh.Compute()
-
-mesh.MakeGroup("Tetras",VOLUME,FT_ElemGeomType,"=",Geom_TETRA)
-mesh.MakeGroup("Pyras",VOLUME,FT_ElemGeomType,"=",Geom_PYRAMID)
-mesh.MakeGroup("Prims",VOLUME,FT_ElemGeomType,"=",Geom_PENTA)
-
-\endcode
+\include defining_hypotheses_ex17.py
+<a href="../../examples/SMESH/defining_hypotheses_ex17.py">Download this script</a>
 
 */
index 0eb41dd285ab53febe4c9b5e64c4dbac2e34d826..2540f52b87f44e11d477fd814aea66e7d8317aca 100755 (executable)
@@ -27,14 +27,8 @@ Filter 2D mesh elements (faces) according to the aspect ratio value:
 - functor type should be \a smesh.FT_AspectRatio
 - threshold is floating point value (aspect ratio)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with aspect ratio > 6.5
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with aspect ratio > 6.5:", len(ids)
-\endcode
+\include filters_ex01.py
+<a href="../../examples/SMESH/filters_ex01.py">Download this script</a>
 
 \sa \ref tui_aspect_ratio
 
@@ -45,16 +39,8 @@ Filter 3D mesh elements (volumes) according to the aspect ratio value:
 - functor type is \a smesh.FT_AspectRatio3D
 - threshold is floating point value (aspect ratio)
 
-\code
-# create mesh with volumes
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# get volumes with aspect ratio < 2.0
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_LessThan, 2.0)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of volumes with aspect ratio < 2.0:", len(ids)
-\endcode
+\include filters_ex02.py
+<a href="../../examples/SMESH/filters_ex02.py">Download this script</a>
 
 \sa \ref tui_aspect_ratio_3d
 
@@ -65,17 +51,8 @@ Filter 2D mesh elements (faces) according to the warping angle value:
 - functor type is \a smesh.FT_Warping
 - threshold is floating point value (warping angle)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
-criterion = smesh.GetCriterion(smesh.FACE, smesh.FT_Warping, smesh.FT_EqualTo, 2.0e-13)
-criterion.Tolerance = 5.0e-14
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion])
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids)
-\endcode
+\include filters_ex03.py
+<a href="../../examples/SMESH/filters_ex03.py">Download this script</a>
 
 \sa \ref tui_warping
 
@@ -86,14 +63,8 @@ Filter 2D mesh elements (faces) according to the minimum angle value:
 - functor type is \a smesh.FT_MinimumAngle
 - threshold is floating point value (minimum angle)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with minimum angle > 75
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 75)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with minimum angle > 75:", len(ids)
-\endcode
+\include filters_ex04.py
+<a href="../../examples/SMESH/filters_ex04.py">Download this script</a>
 
 \sa \ref tui_minimum_angle
 
@@ -104,14 +75,8 @@ Filter 2D mesh elements (faces) according to the taper value:
 - functor type is \a smesh.FT_Taper
 - threshold is floating point value (taper)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with taper < 1.e-15
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_LessThan, 1.e-15)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with taper < 1.e-15:", len(ids)
-\endcode
+\include filters_ex05.py
+<a href="../../examples/SMESH/filters_ex05.py">Download this script</a>
 
 \sa \ref tui_taper
 
@@ -122,14 +87,8 @@ Filter 2D mesh elements (faces) according to the skew value:
 - functor type is \a smesh.FT_Skew
 - threshold is floating point value (skew)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with skew > 50
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 50)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with skew > 50:", len(ids)
-\endcode
+\include filters_ex06.py
+<a href="../../examples/SMESH/filters_ex06.py">Download this script</a>
 
 \sa \ref tui_skew
 
@@ -140,18 +99,8 @@ Filter 2D mesh elements (faces) according to the area value:
 - functor type is \a smesh.FT_Area
 - threshold is floating point value (area)
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get faces with area > 60 and < 90
-criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 60,\
-                                smesh.FT_Undefined, smesh.FT_LogicalAND)
-criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 90)
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion1,criterion2])
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with area in range (60,90):", len(ids)
-\endcode
+\include filters_ex07.py
+<a href="../../examples/SMESH/filters_ex07.py">Download this script</a>
 
 \sa \ref tui_area
 
@@ -162,16 +111,8 @@ Filter 3D mesh elements (volumes) according to the volume value:
 - functor type is \a smesh.FT_Volume3D
 - threshold is floating point value (volume)
 
-\code
-# create mesh with volumes
-from SMESH_mechanic import *
-mesh.Tetrahedron()
-mesh.Compute()
-# get volumes faces with volume > 100
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_MoreThan, 100)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of volumes with volume > 100:", len(ids)
-\endcode
+\include filters_ex08.py
+<a href="../../examples/SMESH/filters_ex08.py">Download this script</a>
 
 \sa \ref tui_volume
 
@@ -182,20 +123,8 @@ Filter 1D mesh elements (edges) which represent free borders of a mesh:
 - functor type is \a smesh.FT_FreeBorders
 - threshold value is not required
 
-\code
-# create mesh
-import geompy, smesh, StdMeshers
-face = geompy.MakeFaceHW(100, 100, 1)
-geompy.addToStudy( face, "quadrangle" )
-mesh = smesh.Mesh(face)
-mesh.Segment().NumberOfSegments(10)
-mesh.Triangle().MaxElementArea(25)
-mesh.Compute()
-# get all free borders
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of edges on free borders:", len(ids)
-\endcode
+\include filters_ex09.py
+<a href="../../examples/SMESH/filters_ex09.py">Download this script</a>
 
 \sa \ref tui_free_borders
 
@@ -207,20 +136,8 @@ element of mesh only:
 - functor type is \a smesh.FT_FreeEdges
 - threshold value is not required
 
-\code
-# create mesh
-import geompy, smesh, StdMeshers
-face = geompy.MakeFaceHW(100, 100, 1)
-geompy.addToStudy( face, "quadrangle" )
-mesh = smesh.Mesh(face)
-mesh.Segment().NumberOfSegments(10)
-mesh.Triangle().MaxElementArea(25)
-mesh.Compute()
-# get all faces with free edges
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeEdges)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces with free edges:", len(ids)
-\endcode
+\include filters_ex10.py
+<a href="../../examples/SMESH/filters_ex10.py">Download this script</a>
 
 \sa \ref tui_free_edges
 
@@ -231,16 +148,8 @@ Filter free nodes:
 - functor type is \a smesh.FT_FreeNodes
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# add node
-mesh.AddNode(0,0,0)
-# get all free nodes
-filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of free nodes:", len(ids)
-\endcode
+\include filters_ex11.py
+<a href="../../examples/SMESH/filters_ex11.py">Download this script</a>
 
 \sa \ref tui_free_nodes
 
@@ -251,14 +160,8 @@ Filter free faces:
 - functor type is \a smesh.FT_FreeFaces
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# get all free faces
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of free faces:", len(ids)
-\endcode
+\include filters_ex12.py
+<a href="../../examples/SMESH/filters_ex12.py">Download this script</a>
 
 \sa \ref tui_free_faces
 
@@ -269,16 +172,8 @@ Filter faces with bare borders:
 - functor type is \a smesh.FT_BareBorderFace
 - threshold value is not required
 
-\code
-# create mesh
-from SMESH_mechanic import *
-# remove some faces to have faces with bare borders
-mesh.RemoveElements( mesh.GetElementsByType(FACE)[0:5] )
-# get all faces bare borders
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace)
-ids = mesh.GetIdsFromFilter(filter)
-print "Faces with bare borders:", ids
-\endcode
+\include filters_ex13.py
+<a href="../../examples/SMESH/filters_ex13.py">Download this script</a>
 
 \sa \ref tui_bare_border_faces
 
@@ -290,15 +185,8 @@ Filter faces with bare borders:
 - threshold value is the face ID
 - tolerance is in degrees
 
-\code
-# create mesh
-from SMESH_mechanic import *
-faceID = mesh.GetElementsByType(FACE)[0]
-# get all faces co-planar to the first face with tolerance 5 degrees
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_CoplanarFaces,faceID,Tolerance=5.0)
-ids = mesh.GetIdsFromFilter(filter)
-print "Number of faces coplanar with the first one:", len(ids)
-\endcode
+\include filters_ex14.py
+<a href="../../examples/SMESH/filters_ex14.py">Download this script</a>
 
 \section filter_over_constrained_faces Over-constrained faces