From 54182913fbb9df65a3f4cc96f55db3618835ecd8 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 4 Apr 2013 07:08:19 +0000 Subject: [PATCH] Merge from BR_plugins_pbyacs 03/04/2013 --- adm_local/unix/config_files/check_SMESH.m4 | 2 +- doc/salome/examples/3dmesh.py | 37 +- doc/salome/examples/cartesian_algo.py | 16 +- doc/salome/examples/creating_meshes_ex01.py | 11 +- doc/salome/examples/creating_meshes_ex02.py | 21 +- doc/salome/examples/creating_meshes_ex03.py | 17 +- doc/salome/examples/creating_meshes_ex04.py | 11 +- doc/salome/examples/creating_meshes_ex05.py | 11 +- doc/salome/examples/creating_meshes_ex06.py | 69 ++-- doc/salome/examples/creating_meshes_ex07.py | 14 +- doc/salome/examples/creating_meshes_ex08.py | 27 +- .../examples/defining_hypotheses_ex01.py | 11 +- .../examples/defining_hypotheses_ex02.py | 11 +- .../examples/defining_hypotheses_ex03.py | 21 +- .../examples/defining_hypotheses_ex04.py | 21 +- .../examples/defining_hypotheses_ex05.py | 12 +- .../examples/defining_hypotheses_ex06.py | 11 +- .../examples/defining_hypotheses_ex07.py | 11 +- .../examples/defining_hypotheses_ex08.py | 21 +- .../examples/defining_hypotheses_ex09.py | 11 +- .../examples/defining_hypotheses_ex10.py | 16 +- .../examples/defining_hypotheses_ex11.py | 12 +- .../examples/defining_hypotheses_ex12.py | 10 +- .../examples/defining_hypotheses_ex13.py | 12 +- .../examples/defining_hypotheses_ex14.py | 11 +- .../examples/defining_hypotheses_ex15.py | 11 +- .../examples/defining_hypotheses_ex16.py | 17 +- .../examples/defining_hypotheses_ex17.py | 19 +- doc/salome/examples/filters_ex01.py | 2 +- doc/salome/examples/filters_ex02.py | 2 +- doc/salome/examples/filters_ex03.py | 2 +- doc/salome/examples/filters_ex04.py | 2 +- doc/salome/examples/filters_ex05.py | 2 +- doc/salome/examples/filters_ex06.py | 2 +- doc/salome/examples/filters_ex07.py | 6 +- doc/salome/examples/filters_ex08.py | 2 +- doc/salome/examples/filters_ex09.py | 14 +- doc/salome/examples/filters_ex10.py | 14 +- doc/salome/examples/filters_ex11.py | 2 +- doc/salome/examples/filters_ex12.py | 2 +- doc/salome/examples/filters_ex13.py | 4 +- doc/salome/examples/filters_ex14.py | 4 +- doc/salome/examples/filters_ex15.py | 2 +- doc/salome/examples/filters_ex16.py | 23 +- doc/salome/examples/filters_ex17.py | 19 +- doc/salome/examples/filters_ex18.py | 2 +- doc/salome/examples/filters_ex19.py | 2 +- doc/salome/examples/filters_ex20.py | 2 +- doc/salome/examples/filters_ex21.py | 2 +- doc/salome/examples/filters_ex22.py | 2 +- doc/salome/examples/filters_ex23.py | 2 +- doc/salome/examples/filters_ex24.py | 2 +- doc/salome/examples/filters_ex25.py | 2 +- doc/salome/examples/filters_ex26.py | 2 +- doc/salome/examples/filters_ex27.py | 2 +- doc/salome/examples/filters_ex28.py | 3 +- doc/salome/examples/filters_ex29.py | 2 +- doc/salome/examples/filters_ex30.py | 2 +- doc/salome/examples/filters_ex31.py | 6 +- doc/salome/examples/filters_ex32.py | 2 +- doc/salome/examples/filters_ex33.py | 4 +- doc/salome/examples/filters_ex34.py | 6 +- doc/salome/examples/filters_ex35.py | 8 +- doc/salome/examples/filters_ex36.py | 6 +- doc/salome/examples/generate_flat_elements.py | 24 +- doc/salome/examples/grouping_elements_ex01.py | 7 +- doc/salome/examples/grouping_elements_ex02.py | 11 +- doc/salome/examples/grouping_elements_ex03.py | 28 +- doc/salome/examples/grouping_elements_ex04.py | 7 +- doc/salome/examples/grouping_elements_ex05.py | 13 +- doc/salome/examples/grouping_elements_ex06.py | 9 +- doc/salome/examples/grouping_elements_ex07.py | 9 +- doc/salome/examples/grouping_elements_ex08.py | 13 +- doc/salome/examples/measurements_ex01.py | 12 +- doc/salome/examples/measurements_ex02.py | 13 +- doc/salome/examples/modifying_meshes_ex01.py | 13 +- doc/salome/examples/modifying_meshes_ex02.py | 13 +- doc/salome/examples/modifying_meshes_ex03.py | 13 +- doc/salome/examples/modifying_meshes_ex09.py | 11 +- doc/salome/examples/modifying_meshes_ex10.py | 12 +- doc/salome/examples/modifying_meshes_ex15.py | 20 +- doc/salome/examples/modifying_meshes_ex16.py | 12 +- doc/salome/examples/modifying_meshes_ex17.py | 12 +- doc/salome/examples/modifying_meshes_ex18.py | 14 +- doc/salome/examples/modifying_meshes_ex19.py | 12 +- doc/salome/examples/modifying_meshes_ex20.py | 3 +- doc/salome/examples/modifying_meshes_ex21.py | 14 +- doc/salome/examples/modifying_meshes_ex22.py | 18 +- doc/salome/examples/modifying_meshes_ex23.py | 13 +- doc/salome/examples/modifying_meshes_ex25.py | 18 +- doc/salome/examples/modifying_meshes_ex26.py | 12 +- doc/salome/examples/notebook_smesh.py | 16 +- doc/salome/examples/quality_controls_ex01.py | 14 +- doc/salome/examples/quality_controls_ex02.py | 15 +- doc/salome/examples/quality_controls_ex03.py | 14 +- doc/salome/examples/quality_controls_ex04.py | 7 +- doc/salome/examples/quality_controls_ex05.py | 18 +- doc/salome/examples/quality_controls_ex06.py | 23 +- doc/salome/examples/quality_controls_ex07.py | 18 +- doc/salome/examples/quality_controls_ex08.py | 18 +- doc/salome/examples/quality_controls_ex09.py | 20 +- doc/salome/examples/quality_controls_ex10.py | 22 +- doc/salome/examples/quality_controls_ex11.py | 14 +- doc/salome/examples/quality_controls_ex12.py | 14 +- doc/salome/examples/quality_controls_ex13.py | 5 +- doc/salome/examples/quality_controls_ex14.py | 5 +- doc/salome/examples/quality_controls_ex15.py | 5 +- doc/salome/examples/quality_controls_ex16.py | 5 +- doc/salome/examples/quality_controls_ex17.py | 5 +- doc/salome/examples/quality_controls_ex18.py | 5 +- doc/salome/examples/quality_controls_ex19.py | 5 +- doc/salome/examples/quality_controls_ex20.py | 5 +- doc/salome/examples/quality_controls_ex21.py | 5 +- doc/salome/examples/quality_controls_ex22.py | 5 +- .../examples/transforming_meshes_ex01.py | 5 +- .../examples/transforming_meshes_ex02.py | 3 +- .../examples/transforming_meshes_ex03.py | 13 +- .../examples/transforming_meshes_ex04.py | 3 +- .../examples/transforming_meshes_ex06.py | 13 +- .../examples/transforming_meshes_ex07.py | 12 +- .../examples/transforming_meshes_ex08.py | 14 +- .../examples/transforming_meshes_ex09.py | 12 +- .../examples/transforming_meshes_ex10.py | 11 +- .../examples/transforming_meshes_ex11.py | 21 +- .../examples/transforming_meshes_ex12.py | 26 +- .../examples/transforming_meshes_ex13.py | 13 +- doc/salome/examples/use_existing_faces.py | 13 +- doc/salome/examples/viewing_meshes_ex01.py | 13 +- doc/salome/examples/viewing_meshes_ex02.py | 13 +- doc/salome/gui/SMESH/Makefile.am | 11 +- doc/salome/gui/SMESH/doxyfile_py.in | 5 +- .../gui/SMESH/input/smeshpy_interface.doc | 10 +- doc/salome/gui/SMESH/input/tui_filters.doc | 144 +++---- resources/StdMeshers.xml | 12 +- src/OBJECT/SMESH_Object.h | 1 - src/OBJECT/SMESH_ObjectDef.h | 1 - src/SMESH_I/SMESH_2smeshpy.cxx | 6 +- src/SMESH_I/SMESH_2smeshpy.hxx | 4 +- src/SMESH_I/SMESH_DumpPython.cxx | 17 +- src/SMESH_I/SMESH_PythonDump.hxx | 2 +- src/SMESH_SWIG/Makefile.am | 13 +- src/SMESH_SWIG/PAL_MESH_041_mesh.py | 11 +- src/SMESH_SWIG/PAL_MESH_043_2D.py | 11 +- src/SMESH_SWIG/PAL_MESH_043_3D.py | 12 +- src/SMESH_SWIG/SMESH_AdvancedEditor.py | 29 +- src/SMESH_SWIG/SMESH_BelongToGeom.py | 9 +- src/SMESH_SWIG/SMESH_BuildCompound.py | 15 +- src/SMESH_SWIG/SMESH_GroupFromGeom.py | 4 +- src/SMESH_SWIG/SMESH_GroupFromGeom2.py | 6 +- src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py | 11 +- src/SMESH_SWIG/SMESH_Nut.py | 17 +- src/SMESH_SWIG/SMESH_Partition1_tetra.py | 15 +- src/SMESH_SWIG/SMESH_Sphere.py | 68 +-- src/SMESH_SWIG/SMESH_blocks.py | 13 +- src/SMESH_SWIG/SMESH_box.py | 17 +- src/SMESH_SWIG/SMESH_box2_tetra.py | 13 +- src/SMESH_SWIG/SMESH_box3_tetra.py | 12 +- src/SMESH_SWIG/SMESH_box_tetra.py | 12 +- src/SMESH_SWIG/SMESH_controls.py | 25 +- src/SMESH_SWIG/SMESH_demo_hexa2_upd.py | 10 +- src/SMESH_SWIG/SMESH_fixation.py | 6 +- src/SMESH_SWIG/SMESH_fixation_hexa.py | 5 +- src/SMESH_SWIG/SMESH_fixation_netgen.py | 9 +- src/SMESH_SWIG/SMESH_fixation_tetra.py | 8 +- src/SMESH_SWIG/SMESH_flight_skin.py | 10 +- src/SMESH_SWIG/SMESH_freebord.py | 12 +- src/SMESH_SWIG/SMESH_hexaedre.py | 12 +- src/SMESH_SWIG/SMESH_mechanic.py | 10 +- src/SMESH_SWIG/SMESH_mechanic_editor.py | 34 +- src/SMESH_SWIG/SMESH_mechanic_netgen.py | 16 +- src/SMESH_SWIG/SMESH_mechanic_tetra.py | 15 +- src/SMESH_SWIG/SMESH_reg.py | 10 +- src/SMESH_SWIG/SMESH_test.py | 12 +- src/SMESH_SWIG/SMESH_test0.py | 11 +- src/SMESH_SWIG/SMESH_test1.py | 12 +- src/SMESH_SWIG/SMESH_test1_AndDisplay.py | 11 +- src/SMESH_SWIG/SMESH_test3.py | 10 +- src/SMESH_SWIG/SMESH_test4.py | 20 +- src/SMESH_SWIG/SMESH_test5.py | 13 +- .../{StdMeshersDC.py => StdMeshersBuilder.py} | 102 ++--- src/SMESH_SWIG/__init__.py | 25 ++ src/SMESH_SWIG/ex01_cube2build.py | 386 +++++++++--------- src/SMESH_SWIG/ex02_cube2primitive.py | 48 ++- src/SMESH_SWIG/ex03_cube2partition.py | 44 +- src/SMESH_SWIG/ex04_cube5tetraHexa.py | 34 +- src/SMESH_SWIG/ex05_hole1build.py | 76 ++-- src/SMESH_SWIG/ex06_hole1boolean.py | 68 +-- src/SMESH_SWIG/ex07_hole1partition.py | 34 +- src/SMESH_SWIG/ex08_hole2build.py | 80 ++-- src/SMESH_SWIG/ex09_grid4build.py | 88 ++-- src/SMESH_SWIG/ex10_grid4geometry.py | 36 +- src/SMESH_SWIG/ex11_grid3partition.py | 44 +- src/SMESH_SWIG/ex12_grid17partition.py | 56 +-- src/SMESH_SWIG/ex13_hole1partial.py | 138 ++++--- src/SMESH_SWIG/ex14_cyl1holed.py | 40 +- src/SMESH_SWIG/ex15_cyl2geometry.py | 96 ++--- src/SMESH_SWIG/ex16_cyl2complementary.py | 52 +-- src/SMESH_SWIG/ex17_dome1.py | 38 +- src/SMESH_SWIG/ex18_dome2.py | 50 +-- src/SMESH_SWIG/ex19_sphereINcube.py | 95 ++--- src/SMESH_SWIG/ex21_lamp.py | 40 +- src/SMESH_SWIG/ex24_cylinder.py | 65 +-- src/SMESH_SWIG/ex29_refine.py | 17 +- src/SMESH_SWIG/ex30_groupsOp.py | 23 +- src/SMESH_SWIG/ex30_tepal.py | 15 +- src/SMESH_SWIG/ex31_dimGroup.py | 27 +- src/SMESH_SWIG/smesh.py | 53 ++- .../{smeshDC.py => smeshBuilder.py} | 305 +++++++++----- src/SMESH_SWIG/smesh_algorithm.py | 38 +- 209 files changed, 2727 insertions(+), 1699 deletions(-) rename src/SMESH_SWIG/{StdMeshersDC.py => StdMeshersBuilder.py} (95%) create mode 100644 src/SMESH_SWIG/__init__.py rename src/SMESH_SWIG/{smeshDC.py => smeshBuilder.py} (95%) diff --git a/adm_local/unix/config_files/check_SMESH.m4 b/adm_local/unix/config_files/check_SMESH.m4 index b8290a22e..387759198 100644 --- a/adm_local/unix/config_files/check_SMESH.m4 +++ b/adm_local/unix/config_files/check_SMESH.m4 @@ -64,7 +64,7 @@ fi #CCRTif test -f ${SMESH_DIR}/bin/salome/libSMESH_Swig.py ; then #if test -f ${SMESH_DIR}/bin/salome/MED_Test ; then -if test -f ${SMESH_DIR}/bin/salome/smesh.py ; then +if test -f ${SMESH_DIR}/bin/salome/SMESH_test.py ; then SMesh_ok=yes AC_MSG_RESULT(Using SMesh module distribution in ${SMESH_DIR}) diff --git a/doc/salome/examples/3dmesh.py b/doc/salome/examples/3dmesh.py index bd6d3b4cc..67a707533 100644 --- a/doc/salome/examples/3dmesh.py +++ b/doc/salome/examples/3dmesh.py @@ -1,7 +1,14 @@ # 3d mesh generation -from geompy import * -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) ### # Geometry: an assembly of a box, a cylinder and a truncated cone @@ -18,33 +25,33 @@ radius_2 = 40 height = 100 # Build a box -box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote) +box = geompy.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) +pt1 = geompy.MakeVertex(0, 0, cote/3) +di1 = geompy.MakeVectorDXDYDZ(0, 0, 1) +cyl = geompy.MakeCylinder(pt1, di1, section, size) # Build a truncated cone -pt2 = MakeVertex(0, 0, size) -cone = MakeCone(pt2, di1, radius_1, radius_2, height) +pt2 = geompy.MakeVertex(0, 0, size) +cone = geompy.MakeCone(pt2, di1, radius_1, radius_2, height) # Fuse -box_cyl = MakeFuse(box, cyl) -piece = MakeFuse(box_cyl, cone) +box_cyl = geompy.MakeFuse(box, cyl) +piece = geompy.MakeFuse(box_cyl, cone) # Add to the study -addToStudy(piece, name) +geompy.addToStudy(piece, name) # Create a group of faces -group = CreateGroup(piece, ShapeType["FACE"]) +group = geompy.CreateGroup(piece, geompy.ShapeType["FACE"]) group_name = name + "_grp" -addToStudy(group, group_name) +geompy.addToStudy(group, group_name) group.SetName(group_name) # Add faces to the group -faces = SubShapeAllIDs(piece, ShapeType["FACE"]) -UnionIDs(group, faces) +faces = geompy.SubShapeAllIDs(piece, geompy.ShapeType["FACE"]) +geompy.UnionIDs(group, faces) ### # Create a mesh diff --git a/doc/salome/examples/cartesian_algo.py b/doc/salome/examples/cartesian_algo.py index b15455f28..dc0dc23cf 100644 --- a/doc/salome/examples/cartesian_algo.py +++ b/doc/salome/examples/cartesian_algo.py @@ -1,14 +1,24 @@ # Usage of Body Fitting algorithm -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create a sphere sphere = geompy.MakeSphereR( 50 ) geompy.addToStudy( sphere, "sphere" ) # create a mesh and assign a "Body Fitting" algo -mesh = Mesh( sphere ) +mesh = smesh.Mesh( sphere ) cartAlgo = mesh.BodyFitted() # define a cartesian grid using Coordinates diff --git a/doc/salome/examples/creating_meshes_ex01.py b/doc/salome/examples/creating_meshes_ex01.py index 0b93356c4..f328d0582 100644 --- a/doc/salome/examples/creating_meshes_ex01.py +++ b/doc/salome/examples/creating_meshes_ex01.py @@ -1,7 +1,14 @@ # Construction of a Mesh -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) diff --git a/doc/salome/examples/creating_meshes_ex02.py b/doc/salome/examples/creating_meshes_ex02.py index c541b4add..fe9f72f08 100644 --- a/doc/salome/examples/creating_meshes_ex02.py +++ b/doc/salome/examples/creating_meshes_ex02.py @@ -1,16 +1,23 @@ # Construction of a Submesh -from geompy import * -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box -box = MakeBoxDXDYDZ(10., 10., 10.) -addToStudy(box, "Box") +box = geompy.MakeBoxDXDYDZ(10., 10., 10.) +geompy.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]") +p5 = geompy.MakeVertex(5., 0., 0.) +EdgeX = geompy.GetEdgeNearPoint(box, p5) +geompy.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") diff --git a/doc/salome/examples/creating_meshes_ex03.py b/doc/salome/examples/creating_meshes_ex03.py index 7b219f3a6..7cf85b786 100644 --- a/doc/salome/examples/creating_meshes_ex03.py +++ b/doc/salome/examples/creating_meshes_ex03.py @@ -1,9 +1,14 @@ # Change priority of submeshes in Mesh import salome -import geompy -import smesh -import SMESH +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) 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"]) @@ -24,7 +29,7 @@ Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000) 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) +MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1) Length_From_Edges_2D = MEFISTO_2D_1.LengthFromEdges() SubMesh_1 = MEFISTO_2D_1.GetSubMesh() @@ -32,7 +37,7 @@ SubMesh_1 = MEFISTO_2D_1.GetSubMesh() 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) +MEFISTO_2D_2 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_2) Length_From_Edges_2D_1 = MEFISTO_2D_2.LengthFromEdges() SubMesh_2 = MEFISTO_2D_2.GetSubMesh() @@ -40,7 +45,7 @@ SubMesh_2 = MEFISTO_2D_2.GetSubMesh() 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) +MEFISTO_2D_3 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_3) Length_From_Edges_2D_2 = MEFISTO_2D_3.LengthFromEdges() SubMesh_3 = MEFISTO_2D_3.GetSubMesh() diff --git a/doc/salome/examples/creating_meshes_ex04.py b/doc/salome/examples/creating_meshes_ex04.py index 33106c775..f2cdfdb87 100644 --- a/doc/salome/examples/creating_meshes_ex04.py +++ b/doc/salome/examples/creating_meshes_ex04.py @@ -1,7 +1,14 @@ # Editing of a mesh -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) def PrintMeshInfo(theMesh): aMesh = theMesh.GetMesh() diff --git a/doc/salome/examples/creating_meshes_ex05.py b/doc/salome/examples/creating_meshes_ex05.py index 6ba410307..98e921a06 100644 --- a/doc/salome/examples/creating_meshes_ex05.py +++ b/doc/salome/examples/creating_meshes_ex05.py @@ -1,7 +1,14 @@ # Export of a Mesh -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) diff --git a/doc/salome/examples/creating_meshes_ex06.py b/doc/salome/examples/creating_meshes_ex06.py index 96b2a29c7..d16e067d3 100644 --- a/doc/salome/examples/creating_meshes_ex06.py +++ b/doc/salome/examples/creating_meshes_ex06.py @@ -1,12 +1,17 @@ # 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 +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +import math # Parameters # ---------- @@ -17,62 +22,62 @@ height = 200 # Build a cylinder # ---------------- -base = geo.MakeVertex(0, 0, 0) -direction = geo.MakeVectorDXDYDZ(0, 0, 1) +base = geompy.MakeVertex(0, 0, 0) +direction = geompy.MakeVectorDXDYDZ(0, 0, 1) -cylinder = geo.MakeCylinder(base, direction, radius, height) +cylinder = geompy.MakeCylinder(base, direction, radius, height) -geo.addToStudy(cylinder, "cylinder") +geompy.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) +box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height) +box_axis = geompy.MakeLine(base, direction) +box = geompy.MakeRotation(box_rot, box_axis, math.pi/4) -hole = geo.MakeCut(cylinder, box) +hole = geompy.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) +plane_a = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(1, 0, 0), plane_trim) +plane_b = geompy.MakePlane(base, geompy.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) +blocks_part = geompy.MakePartition([hole], [plane_a, plane_b], [], [], geompy.ShapeType["SOLID"]) +blocks_list = [box] + geompy.SubShapeAll(blocks_part, geompy.ShapeType["SOLID"]) +blocks_all = geompy.MakeCompound(blocks_list) +blocks = geompy.MakeGlueFaces(blocks_all, 0.0001) -geo.addToStudy(blocks, "cylinder:blocks") +geompy.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) + t = geompy.ShapeType[type] + g = geompy.CreateGroup(shape, t) - geo.addToStudy(g, name) + geompy.addToStudy(g, name) g.SetName(name) if base!=None: - l = geo.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, geo.GEOM.ST_ON) - geo.UnionIDs(g, l) + l = geompy.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, GEOM.ST_ON) + geompy.UnionIDs(g, l) return g group_a = group("baseA", blocks, "FACE", base, direction) -base_b = geo.MakeVertex(0, 0, height) +base_b = geompy.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]) +group_1_all = geompy.SubShapeAllIDs(blocks, geompy.ShapeType["SOLID"]) +geompy.UnionIDs(group_1, group_1_all) +group_1_box = geompy.GetBlockNearPoint(blocks, base) +geompy.DifferenceList(group_1, [group_1_box]) # Mesh the blocks with hexahedral # ------------------------------- @@ -80,8 +85,8 @@ geo.DifferenceList(group_1, [group_1_box]) smesh.SetCurrentStudy(salome.myStudy) def discretize(x, y, z, n, s=blocks): - p = geo.MakeVertex(x, y, z) - e = geo.GetEdgeNearPoint(s, p) + p = geompy.MakeVertex(x, y, z) + e = geompy.GetEdgeNearPoint(s, p) a = hexa.Segment(e) a.NumberOfSegments(n) a.Propagation() diff --git a/doc/salome/examples/creating_meshes_ex07.py b/doc/salome/examples/creating_meshes_ex07.py index 3140acee8..65a4f742e 100644 --- a/doc/salome/examples/creating_meshes_ex07.py +++ b/doc/salome/examples/creating_meshes_ex07.py @@ -2,8 +2,14 @@ # Note: it is a copy of 'SMESH_BuildCompound.py' from SMESH_SWIG import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) ## create a bottom box Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.) @@ -65,9 +71,9 @@ 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) +Compound1 = 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) +Compound2 = 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 index a76e8d175..18f9dad01 100644 --- a/doc/salome/examples/creating_meshes_ex08.py +++ b/doc/salome/examples/creating_meshes_ex08.py @@ -1,40 +1,47 @@ # Mesh Copying -from smesh import * -SetCurrentStudy(salome.myStudy) +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(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) +mesh = smesh.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) +nGroup = mesh.GroupOnGeom( face, "nodes on face", SMESH.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") +newMesh = smesh.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) +newMesh = smesh.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) +newMesh = smesh.CopyMesh( nGroup, "node group copy", toKeepIDs=True) # 4. copy some faces faceIds = fGroup.GetIDs()[-10:] -newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy") +newMesh = smesh.CopyMesh( mesh.GetIDSource( faceIds, SMESH.FACE ), "some faces copy") # 5. copy some nodes nodeIds = nGroup.GetIDs()[-10:] -newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy") +newMesh = smesh.CopyMesh( mesh.GetIDSource( nodeIds, SMESH.NODE), "some nodes copy") # 6. copy a sub-mesh -newMesh = CopyMesh( subMesh, "submesh copy" ) +newMesh = smesh.CopyMesh( subMesh, "submesh copy" ) diff --git a/doc/salome/examples/defining_hypotheses_ex01.py b/doc/salome/examples/defining_hypotheses_ex01.py index 6efb1cfb9..4bb75c56b 100644 --- a/doc/salome/examples/defining_hypotheses_ex01.py +++ b/doc/salome/examples/defining_hypotheses_ex01.py @@ -1,7 +1,14 @@ # Arithmetic 1D -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box box = geompy.MakeBoxDXDYDZ(10., 10., 10.) diff --git a/doc/salome/examples/defining_hypotheses_ex02.py b/doc/salome/examples/defining_hypotheses_ex02.py index b0726a1ca..3662d5632 100644 --- a/doc/salome/examples/defining_hypotheses_ex02.py +++ b/doc/salome/examples/defining_hypotheses_ex02.py @@ -1,7 +1,14 @@ # Deflection 1D and Number of Segments -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a face from arc and straight segment px = geompy.MakeVertex(100., 0. , 0. ) diff --git a/doc/salome/examples/defining_hypotheses_ex03.py b/doc/salome/examples/defining_hypotheses_ex03.py index cfb1ca86c..05a984b77 100644 --- a/doc/salome/examples/defining_hypotheses_ex03.py +++ b/doc/salome/examples/defining_hypotheses_ex03.py @@ -1,16 +1,23 @@ # Start and End Length -from geompy import * -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box -box = MakeBoxDXDYDZ(10., 10., 10.) -addToStudy(box, "Box") +box = geompy.MakeBoxDXDYDZ(10., 10., 10.) +geompy.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]") +p5 = geompy.MakeVertex(5., 0., 0.) +EdgeX = geompy.GetEdgeNearPoint(box, p5) +geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]") # create a hexahedral mesh on the box hexa = smesh.Mesh(box, "Box : hexahedrical mesh") diff --git a/doc/salome/examples/defining_hypotheses_ex04.py b/doc/salome/examples/defining_hypotheses_ex04.py index 0a17f5ca1..8ebddfc5c 100644 --- a/doc/salome/examples/defining_hypotheses_ex04.py +++ b/doc/salome/examples/defining_hypotheses_ex04.py @@ -1,16 +1,23 @@ # Local Length -from geompy import * -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box -box = MakeBoxDXDYDZ(10., 10., 10.) -addToStudy(box, "Box") +box = geompy.MakeBoxDXDYDZ(10., 10., 10.) +geompy.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]") +p5 = geompy.MakeVertex(5., 0., 0.) +EdgeX = geompy.GetEdgeNearPoint(box, p5) +geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]") # create a hexahedral mesh on the box hexa = smesh.Mesh(box, "Box : hexahedrical mesh") diff --git a/doc/salome/examples/defining_hypotheses_ex05.py b/doc/salome/examples/defining_hypotheses_ex05.py index fcf03d0d6..d2b98f1cc 100644 --- a/doc/salome/examples/defining_hypotheses_ex05.py +++ b/doc/salome/examples/defining_hypotheses_ex05.py @@ -1,8 +1,14 @@ # Maximum Element Area -import geompy -import smesh -import salome +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a face px = geompy.MakeVertex(100., 0. , 0. ) diff --git a/doc/salome/examples/defining_hypotheses_ex06.py b/doc/salome/examples/defining_hypotheses_ex06.py index 24bc4da39..d6978dfc3 100644 --- a/doc/salome/examples/defining_hypotheses_ex06.py +++ b/doc/salome/examples/defining_hypotheses_ex06.py @@ -1,7 +1,14 @@ # Maximum Element Volume -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a cylinder cyl = geompy.MakeCylinderRH(30., 50.) diff --git a/doc/salome/examples/defining_hypotheses_ex07.py b/doc/salome/examples/defining_hypotheses_ex07.py index 59d7521a2..c2dc2cfb0 100644 --- a/doc/salome/examples/defining_hypotheses_ex07.py +++ b/doc/salome/examples/defining_hypotheses_ex07.py @@ -1,7 +1,14 @@ # Length from Edges -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create sketchers sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW") diff --git a/doc/salome/examples/defining_hypotheses_ex08.py b/doc/salome/examples/defining_hypotheses_ex08.py index 438773427..34fcbc377 100644 --- a/doc/salome/examples/defining_hypotheses_ex08.py +++ b/doc/salome/examples/defining_hypotheses_ex08.py @@ -1,16 +1,23 @@ # Propagation -from geompy import * -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box -box = MakeBoxDXDYDZ(10., 10., 10.) -addToStudy(box, "Box") +box = geompy.MakeBoxDXDYDZ(10., 10., 10.) +geompy.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]") +p5 = geompy.MakeVertex(5., 0., 0.) +EdgeX = geompy.GetEdgeNearPoint(box, p5) +geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]") # create a hexahedral mesh on the box hexa = smesh.Mesh(box, "Box : hexahedrical mesh") diff --git a/doc/salome/examples/defining_hypotheses_ex09.py b/doc/salome/examples/defining_hypotheses_ex09.py index 9956e4ba5..1ad07c605 100644 --- a/doc/salome/examples/defining_hypotheses_ex09.py +++ b/doc/salome/examples/defining_hypotheses_ex09.py @@ -1,7 +1,14 @@ # Defining Meshing Algorithms -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box box = geompy.MakeBoxDXDYDZ(10., 10., 10.) diff --git a/doc/salome/examples/defining_hypotheses_ex10.py b/doc/salome/examples/defining_hypotheses_ex10.py index 644908be2..1ebd7d81c 100644 --- a/doc/salome/examples/defining_hypotheses_ex10.py +++ b/doc/salome/examples/defining_hypotheses_ex10.py @@ -2,7 +2,15 @@ # Project prisms from one meshed box to another mesh on the same box -from smesh import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Prepare geometry @@ -36,7 +44,7 @@ geompy.addToStudyInFather( box, edgesF2, "edgesF2" ) # Make the source mesh with prisms -src_mesh = Mesh(box, "Source mesh") +src_mesh = smesh.Mesh(box, "Source mesh") src_mesh.Segment().NumberOfSegments(9,10) src_mesh.Quadrangle() src_mesh.Hexahedron() @@ -47,7 +55,7 @@ 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 = smesh.Mesh(box, "Target mesh") tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True) tgt_mesh.Quadrangle() @@ -73,4 +81,4 @@ 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) +src_mesh.TranslateObject( src_mesh, smesh.MakeDirStruct( 210, 0, 0 ), Copy=False) diff --git a/doc/salome/examples/defining_hypotheses_ex11.py b/doc/salome/examples/defining_hypotheses_ex11.py index be5504778..961a56d9c 100644 --- a/doc/salome/examples/defining_hypotheses_ex11.py +++ b/doc/salome/examples/defining_hypotheses_ex11.py @@ -2,7 +2,15 @@ # Project triangles from one meshed face to another mesh on the same box -from smesh import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Prepare geometry @@ -20,7 +28,7 @@ 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 = smesh.Mesh(Face_1, "Source mesh") src_mesh.Segment().NumberOfSegments(15) src_mesh.Triangle() src_mesh.Compute() diff --git a/doc/salome/examples/defining_hypotheses_ex12.py b/doc/salome/examples/defining_hypotheses_ex12.py index dd891a73e..5b6842fb3 100644 --- a/doc/salome/examples/defining_hypotheses_ex12.py +++ b/doc/salome/examples/defining_hypotheses_ex12.py @@ -1,8 +1,14 @@ # 1D Mesh with Fixed Points example import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import StdMeshers # Create face and explode it on edges diff --git a/doc/salome/examples/defining_hypotheses_ex13.py b/doc/salome/examples/defining_hypotheses_ex13.py index 283984916..32fbef438 100644 --- a/doc/salome/examples/defining_hypotheses_ex13.py +++ b/doc/salome/examples/defining_hypotheses_ex13.py @@ -1,8 +1,14 @@ # Radial Quadrangle 1D2D example -from smesh import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -SetCurrentStudy(salome.myStudy) +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(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]) @@ -16,7 +22,7 @@ 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) +radial_Quad_algo = mesh.Quadrangle(algo=smeshBuilder.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 diff --git a/doc/salome/examples/defining_hypotheses_ex14.py b/doc/salome/examples/defining_hypotheses_ex14.py index 6c93e3d27..3f55844cf 100644 --- a/doc/salome/examples/defining_hypotheses_ex14.py +++ b/doc/salome/examples/defining_hypotheses_ex14.py @@ -1,7 +1,14 @@ # Quadrangle Parameters example 1 (meshing a face with 3 edges) -from smesh import * -SetCurrentStudy(salome.myStudy) +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Get 1/4 part from the disk face. Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100) diff --git a/doc/salome/examples/defining_hypotheses_ex15.py b/doc/salome/examples/defining_hypotheses_ex15.py index a08dfbfae..6e077d894 100644 --- a/doc/salome/examples/defining_hypotheses_ex15.py +++ b/doc/salome/examples/defining_hypotheses_ex15.py @@ -1,7 +1,14 @@ # Quadrangle Parameters example 2 (using different types) -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import StdMeshers # Make quadrangle face and explode it on edges. diff --git a/doc/salome/examples/defining_hypotheses_ex16.py b/doc/salome/examples/defining_hypotheses_ex16.py index 493034020..9125787b2 100644 --- a/doc/salome/examples/defining_hypotheses_ex16.py +++ b/doc/salome/examples/defining_hypotheses_ex16.py @@ -1,7 +1,14 @@ # "Use Existing Elements" example -from smesh import * -SetCurrentStudy(salome.myStudy) +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Make a patritioned box @@ -23,15 +30,15 @@ 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 +srcMesh = smesh.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 ) +srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE ) # Import faces from midFace0 to the target mesh -tgtMesh = Mesh(boxes[1], "target mesh") +tgtMesh = smesh.Mesh(boxes[1], "target mesh") importAlgo = tgtMesh.UseExisting2DElements(midFace1) import2hyp = importAlgo.SourceFaces( [srcFaceGroup] ) tgtMesh.Segment().NumberOfSegments(3) diff --git a/doc/salome/examples/defining_hypotheses_ex17.py b/doc/salome/examples/defining_hypotheses_ex17.py index dc3ee9bc8..d21638fcc 100644 --- a/doc/salome/examples/defining_hypotheses_ex17.py +++ b/doc/salome/examples/defining_hypotheses_ex17.py @@ -1,7 +1,14 @@ # Viscous layers construction -from smesh import * -SetCurrentStudy(salome.myStudy) +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) X = geompy.MakeVectorDXDYDZ( 1,0,0 ) O = geompy.MakeVertex( 100,50,50 ) @@ -19,7 +26,7 @@ geompy.addToStudy( shape, "shape" ) geompy.addToStudyInFather( shape, face1, "face1") -mesh = Mesh(shape, "CFD") +mesh = smesh.Mesh(shape, "CFD") mesh.Segment().NumberOfSegments( 4 ) @@ -35,6 +42,6 @@ layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFa 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) +mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA) +mesh.MakeGroup("Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PYRAMID) +mesh.MakeGroup("Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PENTA) diff --git a/doc/salome/examples/filters_ex01.py b/doc/salome/examples/filters_ex01.py index 986904774..86be38182 100644 --- a/doc/salome/examples/filters_ex01.py +++ b/doc/salome/examples/filters_ex01.py @@ -3,6 +3,6 @@ # 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) +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 index f69217398..5709ef4b0 100644 --- a/doc/salome/examples/filters_ex02.py +++ b/doc/salome/examples/filters_ex02.py @@ -5,6 +5,6 @@ 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) +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 index 5afe3a44e..c9313bceb 100644 --- a/doc/salome/examples/filters_ex03.py +++ b/doc/salome/examples/filters_ex03.py @@ -3,7 +3,7 @@ # 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 = 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]) diff --git a/doc/salome/examples/filters_ex04.py b/doc/salome/examples/filters_ex04.py index d4d31a76c..fef619c80 100644 --- a/doc/salome/examples/filters_ex04.py +++ b/doc/salome/examples/filters_ex04.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get faces with minimum angle > 75 -filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 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 index b15225194..c1c185275 100644 --- a/doc/salome/examples/filters_ex05.py +++ b/doc/salome/examples/filters_ex05.py @@ -3,6 +3,6 @@ # 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) +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 index 0f609a569..610a9a9e8 100644 --- a/doc/salome/examples/filters_ex06.py +++ b/doc/salome/examples/filters_ex06.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get faces with skew > 50 -filter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 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 index 723d8d282..6c42d5217 100644 --- a/doc/salome/examples/filters_ex07.py +++ b/doc/salome/examples/filters_ex07.py @@ -3,9 +3,9 @@ # 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) +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) diff --git a/doc/salome/examples/filters_ex08.py b/doc/salome/examples/filters_ex08.py index 2bc96b672..d87f97453 100644 --- a/doc/salome/examples/filters_ex08.py +++ b/doc/salome/examples/filters_ex08.py @@ -5,6 +5,6 @@ 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) +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 index 0d045b7b7..9efa00871 100644 --- a/doc/salome/examples/filters_ex09.py +++ b/doc/salome/examples/filters_ex09.py @@ -1,7 +1,17 @@ # Free borders # create mesh -import geompy, smesh, StdMeshers + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + face = geompy.MakeFaceHW(100, 100, 1) geompy.addToStudy( face, "quadrangle" ) mesh = smesh.Mesh(face) @@ -9,6 +19,6 @@ mesh.Segment().NumberOfSegments(10) mesh.Triangle().MaxElementArea(25) mesh.Compute() # get all free borders -filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) +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 index bbbdd9889..423b91029 100644 --- a/doc/salome/examples/filters_ex10.py +++ b/doc/salome/examples/filters_ex10.py @@ -1,7 +1,17 @@ # Free edges # create mesh -import geompy, smesh, StdMeshers + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + face = geompy.MakeFaceHW(100, 100, 1) geompy.addToStudy( face, "quadrangle" ) mesh = smesh.Mesh(face) @@ -9,6 +19,6 @@ mesh.Segment().NumberOfSegments(10) mesh.Triangle().MaxElementArea(25) mesh.Compute() # get all faces with free edges -filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeEdges) +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 index 4d754bc00..5f1bf4c68 100644 --- a/doc/salome/examples/filters_ex11.py +++ b/doc/salome/examples/filters_ex11.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * # add node mesh.AddNode(0,0,0) # get all free nodes -filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) +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 index dfb0f40ba..a1f20dcf3 100644 --- a/doc/salome/examples/filters_ex12.py +++ b/doc/salome/examples/filters_ex12.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get all free faces -filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces) +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 index e20937d1b..f56d39f84 100644 --- a/doc/salome/examples/filters_ex13.py +++ b/doc/salome/examples/filters_ex13.py @@ -3,8 +3,8 @@ # create mesh from SMESH_mechanic import * # remove some faces to have faces with bare borders -mesh.RemoveElements( mesh.GetElementsByType(smesh.FACE)[0:5] ) +mesh.RemoveElements( mesh.GetElementsByType(SMESH.FACE)[0:5] ) # get all faces bare borders -filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace) +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 index 01ea27ab9..a9021f98c 100644 --- a/doc/salome/examples/filters_ex14.py +++ b/doc/salome/examples/filters_ex14.py @@ -2,8 +2,8 @@ # create mesh from SMESH_mechanic import * -faceID = mesh.GetElementsByType(smesh.FACE)[0] +faceID = mesh.GetElementsByType(SMESH.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) +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 index 2044c6048..3f1344704 100644 --- a/doc/salome/examples/filters_ex15.py +++ b/doc/salome/examples/filters_ex15.py @@ -2,6 +2,6 @@ # create mesh from SMESH_mechanic import * # get all over-constrained faces -filter = smesh.GetFilter(smesh.FACE, smesh.FT_OverConstrainedFace) +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 index 3c7159d9f..bdca2d86a 100644 --- a/doc/salome/examples/filters_ex16.py +++ b/doc/salome/examples/filters_ex16.py @@ -1,20 +1,31 @@ # Double edges, Double faces, Double volumes -from smesh import * + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # make a mesh on a box box = geompy.MakeBoxDXDYDZ(100,100,100) -mesh = Mesh( box, "Box" ) +mesh = smesh.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.TranslateObject( mesh, smesh.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) +equalEdgesFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_EqualEdges) +equalFacesFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_EqualFaces) +equalVolumesFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_EqualVolumes) # get equal elements print "Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter )) print "Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter )) diff --git a/doc/salome/examples/filters_ex17.py b/doc/salome/examples/filters_ex17.py index b79f4a74d..c3f80d65a 100644 --- a/doc/salome/examples/filters_ex17.py +++ b/doc/salome/examples/filters_ex17.py @@ -1,16 +1,27 @@ # Double nodes -from smesh import * + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # make a mesh on a box box = geompy.MakeBoxDXDYDZ(100,100,100) -mesh = Mesh( box, "Box" ) +mesh = smesh.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 ) +mesh.TranslateObject( mesh, smesh.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) +filter = smesh.GetFilter(SMESH.NODE, SMESH.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 index 30158e28b..805f54e06 100644 --- a/doc/salome/examples/filters_ex18.py +++ b/doc/salome/examples/filters_ex18.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get border edges with number of connected faces = 5 -filter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, 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 index 41b7cc762..3ac78794f 100644 --- a/doc/salome/examples/filters_ex19.py +++ b/doc/salome/examples/filters_ex19.py @@ -3,6 +3,6 @@ # 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) +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 index 37227c49d..1bdc00b53 100644 --- a/doc/salome/examples/filters_ex20.py +++ b/doc/salome/examples/filters_ex20.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get edges with length > 14 -filter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, 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 index 0882fe294..79c88434b 100644 --- a/doc/salome/examples/filters_ex21.py +++ b/doc/salome/examples/filters_ex21.py @@ -3,6 +3,6 @@ # 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) +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 index f65421786..0271110fe 100644 --- a/doc/salome/examples/filters_ex22.py +++ b/doc/salome/examples/filters_ex22.py @@ -3,6 +3,6 @@ # 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) +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 index 848f8d92c..49569dfe8 100644 --- a/doc/salome/examples/filters_ex23.py +++ b/doc/salome/examples/filters_ex23.py @@ -5,6 +5,6 @@ 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) +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 index 036ba037e..bab47e2a7 100644 --- a/doc/salome/examples/filters_ex24.py +++ b/doc/salome/examples/filters_ex24.py @@ -7,6 +7,6 @@ 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) +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 index 7e4489848..06862c75f 100644 --- a/doc/salome/examples/filters_ex25.py +++ b/doc/salome/examples/filters_ex25.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * mesh.Tetrahedron() mesh.Compute() # get all over-constrained volumes -filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_OverConstrainedVolume) +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 index 3c5ce2965..d544466e4 100644 --- a/doc/salome/examples/filters_ex26.py +++ b/doc/salome/examples/filters_ex26.py @@ -3,6 +3,6 @@ # 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) +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 index 10067ea07..4c38bd92f 100644 --- a/doc/salome/examples/filters_ex27.py +++ b/doc/salome/examples/filters_ex27.py @@ -3,6 +3,6 @@ # 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) +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 index 032b966a5..12da64cc7 100644 --- a/doc/salome/examples/filters_ex28.py +++ b/doc/salome/examples/filters_ex28.py @@ -3,10 +3,9 @@ # 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) +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 index c256724b3..b4a454ad7 100644 --- a/doc/salome/examples/filters_ex29.py +++ b/doc/salome/examples/filters_ex29.py @@ -3,6 +3,6 @@ # 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) +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 index 19c213810..9d161a763 100644 --- a/doc/salome/examples/filters_ex30.py +++ b/doc/salome/examples/filters_ex30.py @@ -7,6 +7,6 @@ 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) +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 index 4a2acbfa8..ea9b99e0e 100644 --- a/doc/salome/examples/filters_ex31.py +++ b/doc/salome/examples/filters_ex31.py @@ -3,9 +3,9 @@ # create mesh from SMESH_mechanic import * # get nodes with identifiers [5-10] and [15-30] -criterion1 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="5-10",\ - BinaryOp=smesh.FT_LogicalOR) -criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="15-30") +criterion1 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="5-10",\ + BinaryOp=SMESH.FT_LogicalOR) +criterion2 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="15-30") filter = smesh.CreateFilterManager().CreateFilter() filter.SetCriteria([criterion1,criterion2]) ids = mesh.GetIdsFromFilter(filter) diff --git a/doc/salome/examples/filters_ex32.py b/doc/salome/examples/filters_ex32.py index 726ca153f..5ce64d625 100644 --- a/doc/salome/examples/filters_ex32.py +++ b/doc/salome/examples/filters_ex32.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * mesh.Tetrahedron() mesh.Compute() # get all badly oriented volumes -filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BadOrientedVolume) +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 index 2fbaab03e..c844e9063 100644 --- a/doc/salome/examples/filters_ex33.py +++ b/doc/salome/examples/filters_ex33.py @@ -3,8 +3,8 @@ # 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) +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) diff --git a/doc/salome/examples/filters_ex34.py b/doc/salome/examples/filters_ex34.py index 8e63056b4..980509dbe 100644 --- a/doc/salome/examples/filters_ex34.py +++ b/doc/salome/examples/filters_ex34.py @@ -3,12 +3,12 @@ # 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]) +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) +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 index 369d7323a..4a3c2bd3c 100644 --- a/doc/salome/examples/filters_ex35.py +++ b/doc/salome/examples/filters_ex35.py @@ -5,10 +5,10 @@ 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) +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) diff --git a/doc/salome/examples/filters_ex36.py b/doc/salome/examples/filters_ex36.py index 7675bc9f6..3dc8e4fc6 100644 --- a/doc/salome/examples/filters_ex36.py +++ b/doc/salome/examples/filters_ex36.py @@ -3,11 +3,11 @@ # 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) +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) +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) +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 index a23c200a4..df187188b 100644 --- a/doc/salome/examples/generate_flat_elements.py +++ b/doc/salome/examples/generate_flat_elements.py @@ -3,9 +3,17 @@ # 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 + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + # geometry @@ -21,22 +29,22 @@ 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) +[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], GEOM.ST_IN) +[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], 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) +[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, GEOM.ST_ON) +[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, 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) +MEFISTO_2D = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO) Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges() ALGO3D = Mesh_1.Tetrahedron() isDone = Mesh_1.Compute() diff --git a/doc/salome/examples/grouping_elements_ex01.py b/doc/salome/examples/grouping_elements_ex01.py index d0971d621..013332766 100644 --- a/doc/salome/examples/grouping_elements_ex01.py +++ b/doc/salome/examples/grouping_elements_ex01.py @@ -1,21 +1,22 @@ # Create a Standalone Group import SMESH_mechanic +import SMESH 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.) +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) +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 = 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 index 228248d7f..909a9b482 100644 --- a/doc/salome/examples/grouping_elements_ex02.py +++ b/doc/salome/examples/grouping_elements_ex02.py @@ -1,8 +1,15 @@ # Create a Group on Geometry + import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box box = geompy.MakeBox(0., 0., 0., 100., 100., 100.) diff --git a/doc/salome/examples/grouping_elements_ex03.py b/doc/salome/examples/grouping_elements_ex03.py index 05fb69d57..375749cb4 100644 --- a/doc/salome/examples/grouping_elements_ex03.py +++ b/doc/salome/examples/grouping_elements_ex03.py @@ -1,23 +1,33 @@ # Create a Group on Filter -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = geompy.MakeBoxDXDYDZ(10,10,10) # make a mesh with quadrangles of different area in range [1,16] -mesh = Mesh(box,"Quad mesh") +mesh = smesh.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 ) + smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, ">", 1.1, BinaryOp=SMESH.FT_LogicalAND ), + smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, "<", 15.0 ) ] -filt = GetFilterFromCriteria( critaria ) -filtGroup = mesh.GroupOnFilter( FACE, "group on filter", filt ) +filt = smesh.GetFilterFromCriteria( critaria ) +filtGroup = mesh.GroupOnFilter( SMESH.FACE, "group on filter", filt ) print "Group on filter contains %s elemens" % filtGroup.Size() # group on filter is updated if the mesh is modified @@ -27,12 +37,12 @@ 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" ) +filt2 = smesh.GetFilter( SMESH.FACE, SMESH.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" )]) +filt2.SetCriteria( [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_RangeOfIds, "1-70" )]) filtIDs3 = filtGroup.GetIDs() print "After filter modification, group on filter contains %s elemens" % filtGroup.Size() diff --git a/doc/salome/examples/grouping_elements_ex04.py b/doc/salome/examples/grouping_elements_ex04.py index 730a2ca6b..ebd59e76f 100644 --- a/doc/salome/examples/grouping_elements_ex04.py +++ b/doc/salome/examples/grouping_elements_ex04.py @@ -1,24 +1,25 @@ # Edit a Group import SMESH_mechanic +import SMESH 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.) +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 = 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.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 40.) anIds = mesh.GetIdsFromFilter(aFilter) diff --git a/doc/salome/examples/grouping_elements_ex05.py b/doc/salome/examples/grouping_elements_ex05.py index 90453fed1..9883ebda2 100644 --- a/doc/salome/examples/grouping_elements_ex05.py +++ b/doc/salome/examples/grouping_elements_ex05.py @@ -1,31 +1,32 @@ # Union of groups import SMESH_mechanic +import SMESH 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.) +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 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20") aGroup1.Add(anIds) # Criterion : AREA = 20 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 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 = mesh.CreateEmptyGroup( SMESH.FACE, "Area = 20" ) aGroup2.Add(anIds) @@ -35,14 +36,14 @@ 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.) +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 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20") aGroup4.Add(anIds) # create union group : area >= 20 and area < 20 diff --git a/doc/salome/examples/grouping_elements_ex06.py b/doc/salome/examples/grouping_elements_ex06.py index cc8146fb9..060a22d6c 100644 --- a/doc/salome/examples/grouping_elements_ex06.py +++ b/doc/salome/examples/grouping_elements_ex06.py @@ -1,31 +1,32 @@ # Intersection of groups import SMESH_mechanic +import SMESH 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.) +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 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20") aGroup1.Add(anIds) # Criterion : AREA < 60 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 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 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60") aGroup2.Add(anIds) # create an intersection of groups : 20 < area < 60 diff --git a/doc/salome/examples/grouping_elements_ex07.py b/doc/salome/examples/grouping_elements_ex07.py index 5bcccd0c7..891ed889a 100644 --- a/doc/salome/examples/grouping_elements_ex07.py +++ b/doc/salome/examples/grouping_elements_ex07.py @@ -1,30 +1,31 @@ # Cut of groups import SMESH_mechanic +import SMESH 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.) +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) +aGroupMain = mesh.MakeGroupByIds("Area > 20", SMESH.FACE, anIds) # Criterion : AREA < 60 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 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) +aGroupTool = mesh.MakeGroupByIds("Area < 60", SMESH.FACE, anIds) # create a cut of groups : area >= 60 aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60") diff --git a/doc/salome/examples/grouping_elements_ex08.py b/doc/salome/examples/grouping_elements_ex08.py index a86ec6317..fa78d72f3 100644 --- a/doc/salome/examples/grouping_elements_ex08.py +++ b/doc/salome/examples/grouping_elements_ex08.py @@ -1,35 +1,36 @@ # Creating groups of entities from existing groups of superior dimensions import SMESH_mechanic +import SMESH 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.) +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) +aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds) # Criterion : AREA < 30 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 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) +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" ) +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" ) +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 index 967754709..d8a5bd71c 100644 --- a/doc/salome/examples/measurements_ex01.py +++ b/doc/salome/examples/measurements_ex01.py @@ -1,6 +1,16 @@ # Minimum Distance -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + from SMESH_mechanic import mesh as mesh1 from SMESH_test1 import mesh as mesh2 diff --git a/doc/salome/examples/measurements_ex02.py b/doc/salome/examples/measurements_ex02.py index 3333bc0e5..b5fbf8b1f 100644 --- a/doc/salome/examples/measurements_ex02.py +++ b/doc/salome/examples/measurements_ex02.py @@ -1,6 +1,17 @@ # Bounding Box -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + from SMESH_mechanic import mesh as mesh1 from SMESH_test1 import mesh as mesh2 diff --git a/doc/salome/examples/modifying_meshes_ex01.py b/doc/salome/examples/modifying_meshes_ex01.py index ee183d708..434cc1a7e 100644 --- a/doc/salome/examples/modifying_meshes_ex01.py +++ b/doc/salome/examples/modifying_meshes_ex01.py @@ -1,6 +1,17 @@ # Add Node -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex02.py b/doc/salome/examples/modifying_meshes_ex02.py index c99bf2aff..563295c54 100644 --- a/doc/salome/examples/modifying_meshes_ex02.py +++ b/doc/salome/examples/modifying_meshes_ex02.py @@ -1,6 +1,17 @@ # Add 0D Element -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex03.py b/doc/salome/examples/modifying_meshes_ex03.py index 19b423e03..beefe20ce 100644 --- a/doc/salome/examples/modifying_meshes_ex03.py +++ b/doc/salome/examples/modifying_meshes_ex03.py @@ -1,6 +1,17 @@ # Add 0D Element on Element Nodes -import smesh, SMESH, geompy + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create a geometry box = geompy.MakeBoxDXDYDZ( 10, 10, 10 ) diff --git a/doc/salome/examples/modifying_meshes_ex09.py b/doc/salome/examples/modifying_meshes_ex09.py index 2fd91114d..476ebbbdc 100644 --- a/doc/salome/examples/modifying_meshes_ex09.py +++ b/doc/salome/examples/modifying_meshes_ex09.py @@ -1,9 +1,18 @@ # Add Polygon import math + import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook -import smesh # create an empty mesh structure mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex10.py b/doc/salome/examples/modifying_meshes_ex10.py index 1d1af1942..894fe9d4c 100644 --- a/doc/salome/examples/modifying_meshes_ex10.py +++ b/doc/salome/examples/modifying_meshes_ex10.py @@ -1,7 +1,17 @@ # Add Polyhedron + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + import math # create an empty mesh structure diff --git a/doc/salome/examples/modifying_meshes_ex15.py b/doc/salome/examples/modifying_meshes_ex15.py index 49676d0ee..ae6d5eae7 100644 --- a/doc/salome/examples/modifying_meshes_ex15.py +++ b/doc/salome/examples/modifying_meshes_ex15.py @@ -1,18 +1,28 @@ # Moving Nodes -from geompy import * -from smesh import * -box = MakeBoxDXDYDZ(200, 200, 200) +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -mesh = Mesh( box ) +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + + +box = geompy.MakeBoxDXDYDZ(200, 200, 200) + +mesh = smesh.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"]): +for vId in geompy.SubShapeAllIDs( box, geompy.ShapeType["VERTEX"]): if node000: break nodeIds = mesh.GetSubMeshNodesId( vId, True ) for node in nodeIds: diff --git a/doc/salome/examples/modifying_meshes_ex16.py b/doc/salome/examples/modifying_meshes_ex16.py index 6567dff19..076cebf6c 100644 --- a/doc/salome/examples/modifying_meshes_ex16.py +++ b/doc/salome/examples/modifying_meshes_ex16.py @@ -1,7 +1,17 @@ # Diagonal Inversion + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create an empty mesh structure mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex17.py b/doc/salome/examples/modifying_meshes_ex17.py index 732953ab2..c45fd2829 100644 --- a/doc/salome/examples/modifying_meshes_ex17.py +++ b/doc/salome/examples/modifying_meshes_ex17.py @@ -1,7 +1,17 @@ # Uniting two Triangles + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create an empty mesh structure mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex18.py b/doc/salome/examples/modifying_meshes_ex18.py index 9f7393022..60b395af9 100644 --- a/doc/salome/examples/modifying_meshes_ex18.py +++ b/doc/salome/examples/modifying_meshes_ex18.py @@ -1,7 +1,17 @@ # Uniting a Set of Triangles + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create an empty mesh structure mesh = smesh.Mesh() @@ -37,7 +47,7 @@ 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.) +res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], SMESH.FT_MinimumAngle, 60.) if not res: print "failed!" else: print "done." diff --git a/doc/salome/examples/modifying_meshes_ex19.py b/doc/salome/examples/modifying_meshes_ex19.py index c3eaf4977..7223fb099 100644 --- a/doc/salome/examples/modifying_meshes_ex19.py +++ b/doc/salome/examples/modifying_meshes_ex19.py @@ -1,7 +1,17 @@ # Orientation + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create an empty mesh structure mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex20.py b/doc/salome/examples/modifying_meshes_ex20.py index aa52da784..ffbff360a 100644 --- a/doc/salome/examples/modifying_meshes_ex20.py +++ b/doc/salome/examples/modifying_meshes_ex20.py @@ -1,9 +1,10 @@ # Cutting Quadrangles import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # cut two quadrangles: 405 and 406 -mesh.QuadToTri([405, 406], smesh.FT_MinimumAngle) +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 index ece705c7d..50355fd8b 100644 --- a/doc/salome/examples/modifying_meshes_ex21.py +++ b/doc/salome/examples/modifying_meshes_ex21.py @@ -1,11 +1,19 @@ # Smoothing + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import SMESH_mechanic -smesh = SMESH_mechanic.smesh +#smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # select the top face @@ -14,7 +22,7 @@ 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) +GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", SMESH.FACE) # perform smoothing diff --git a/doc/salome/examples/modifying_meshes_ex22.py b/doc/salome/examples/modifying_meshes_ex22.py index e9dcb3c96..e6d5fd6ed 100644 --- a/doc/salome/examples/modifying_meshes_ex22.py +++ b/doc/salome/examples/modifying_meshes_ex22.py @@ -1,11 +1,19 @@ # Extrusion + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import SMESH_mechanic -smesh = SMESH_mechanic.smesh +#smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # select the top face @@ -14,11 +22,11 @@ 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) +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) +GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", SMESH.FACE) # perform extrusion of the group mesh.ExtrusionSweepObject(GroupTri, vector, 5) diff --git a/doc/salome/examples/modifying_meshes_ex23.py b/doc/salome/examples/modifying_meshes_ex23.py index a789b76f0..bad439d99 100644 --- a/doc/salome/examples/modifying_meshes_ex23.py +++ b/doc/salome/examples/modifying_meshes_ex23.py @@ -1,10 +1,16 @@ # Extrusion along a Path import math + import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -# Geometry -import geompy +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # 1. Create points points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]] @@ -36,7 +42,6 @@ for ii in range(len(Wire_polyline_edges)): pass # Mesh -import smesh # Mesh the given shape with the given 1d hypothesis def Mesh1D(shape1d, nbSeg, name): @@ -91,7 +96,7 @@ Edge_Circle_mesh = Mesh1D(Edge_Circle , 8, "Edge_Circle") # ExtrusionAlongPath # IDsOfElements, PathMesh, PathShape, NodeStart, # HasAngles, Angles, HasRefPoint, RefPoint -refPoint = smesh.PointStruct(0, 0, 0) +refPoint = SMESH.PointStruct(0, 0, 0) a10 = 10.0*math.pi/180.0 a45 = 45.0*math.pi/180.0 diff --git a/doc/salome/examples/modifying_meshes_ex25.py b/doc/salome/examples/modifying_meshes_ex25.py index e8801e003..4072560c4 100644 --- a/doc/salome/examples/modifying_meshes_ex25.py +++ b/doc/salome/examples/modifying_meshes_ex25.py @@ -1,7 +1,15 @@ # Pattern Mapping -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # define the geometry Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.) @@ -41,7 +49,7 @@ 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) +facesToSplit = Mesh_1.GetElementsByType(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) @@ -84,7 +92,7 @@ smp_hexa = """!!! Nb of points: pattern_hexa.LoadFromFile(smp_hexa) # apply the pattern to a mesh -volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME) +volsToSplit = Mesh_3.GetElementsByType(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) @@ -123,7 +131,7 @@ smp_pyra = """!!! Nb of points: pattern_pyra.LoadFromFile(smp_pyra) # apply the pattern to a face mesh -volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME) +volsToSplit = Mesh_4.GetElementsByType(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) diff --git a/doc/salome/examples/modifying_meshes_ex26.py b/doc/salome/examples/modifying_meshes_ex26.py index aa8cb4379..4a8eba75e 100644 --- a/doc/salome/examples/modifying_meshes_ex26.py +++ b/doc/salome/examples/modifying_meshes_ex26.py @@ -1,7 +1,15 @@ # Convert mesh to/from quadratic -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create sphere of radius 100 diff --git a/doc/salome/examples/notebook_smesh.py b/doc/salome/examples/notebook_smesh.py index 9cccc7b5b..e52ef1b54 100644 --- a/doc/salome/examples/notebook_smesh.py +++ b/doc/salome/examples/notebook_smesh.py @@ -1,7 +1,15 @@ # Using SALOME NoteBook -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import salome_notebook # set variables @@ -34,6 +42,6 @@ algo3D.MaxElementVolume("MaxElementVolume") ret = tetra.Compute() # translate the mesh -point = smesh.PointStruct("Offset", 0., 0.) -vector = smesh.DirStruct(point) +point = SMESH.PointStruct("Offset", 0., 0.) +vector = SMESH.DirStruct(point) tetra.TranslateObject(tetra, vector, 0) diff --git a/doc/salome/examples/quality_controls_ex01.py b/doc/salome/examples/quality_controls_ex01.py index f411d2e61..0f73a5619 100644 --- a/doc/salome/examples/quality_controls_ex01.py +++ b/doc/salome/examples/quality_controls_ex01.py @@ -1,9 +1,15 @@ # Free Borders + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create open shell: a box without one plane box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -21,7 +27,7 @@ algo.MaxElementArea(20.) mesh.Compute() # criterion : free borders -aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) +aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders) anIds = mesh.GetIdsFromFilter(aFilter) # print the result @@ -35,7 +41,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Free borders") +aGroup = mesh.GetMesh().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 index 5373c4d6f..491c81eb4 100644 --- a/doc/salome/examples/quality_controls_ex02.py +++ b/doc/salome/examples/quality_controls_ex02.py @@ -1,10 +1,15 @@ # Borders at Multiconnection + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh -import SMESH +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create open shell: a box without one plane box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -24,7 +29,7 @@ mesh.Compute() # Criterion : Borders at multi-connection nb_conn = 2 -aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn) +aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, nb_conn) anIds = mesh.GetIdsFromFilter(aFilter) # print the result @@ -38,7 +43,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Borders at multi-connections") +aGroup = mesh.GetMesh().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 index eaa607b94..b1da190f5 100644 --- a/doc/salome/examples/quality_controls_ex03.py +++ b/doc/salome/examples/quality_controls_ex03.py @@ -1,9 +1,15 @@ # Length 1D + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create open shell: a box without one plane box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -23,7 +29,7 @@ mesh.Compute() # Criterion : Length > 3. length_margin = 3. -aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin) +aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, length_margin) anIds = mesh.GetIdsFromFilter(aFilter) # print the result @@ -37,7 +43,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Edges with length > " + `length_margin`) +aGroup = mesh.GetMesh().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 index d26eb4d82..c687d9293 100644 --- a/doc/salome/examples/quality_controls_ex04.py +++ b/doc/salome/examples/quality_controls_ex04.py @@ -1,6 +1,7 @@ # Free Edges import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh @@ -12,7 +13,7 @@ aFilterMgr = smesh.CreateFilterManager() # Criterion : AREA > 95. area_margin = 95. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -22,8 +23,8 @@ mesh.RemoveElements(anIds) aBorders = mesh.GetFreeBorders() # create groups -aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges") -aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges") +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 "" diff --git a/doc/salome/examples/quality_controls_ex05.py b/doc/salome/examples/quality_controls_ex05.py index 90c7c0451..f03456596 100644 --- a/doc/salome/examples/quality_controls_ex05.py +++ b/doc/salome/examples/quality_controls_ex05.py @@ -1,9 +1,15 @@ # Free Nodes + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create box box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) @@ -13,7 +19,7 @@ idbox = geompy.addToStudy(box, "box") mesh = smesh.Mesh(box, "Mesh_free_nodes") algo = mesh.Segment() algo.NumberOfSegments(10) -algo = mesh.Triangle(smesh.MEFISTO) +algo = mesh.Triangle(smeshBuilder.MEFISTO) algo.MaxElementArea(150.) mesh.Compute() @@ -21,18 +27,18 @@ mesh.Compute() # Criterion : AREA < 80. area_margin = 80. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin) +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) +aFilter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes) anNodeIds = mesh.GetIdsFromFilter(aFilter) # create a group -aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes") +aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "Free_nodes") aGroup.Add(anNodeIds) # print the result diff --git a/doc/salome/examples/quality_controls_ex06.py b/doc/salome/examples/quality_controls_ex06.py index 2fe67abf6..861206bb3 100644 --- a/doc/salome/examples/quality_controls_ex06.py +++ b/doc/salome/examples/quality_controls_ex06.py @@ -1,7 +1,15 @@ # Free Faces + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) ####### GEOM part ######## @@ -30,9 +38,6 @@ 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() @@ -42,10 +47,10 @@ Tetrahedronn = Mesh_1.Tetrahedron() isDone = Mesh_1.Compute() # create a group of free faces -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces ) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces ) aFaceIds = Mesh_1.GetIdsFromFilter(aFilter) -aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces") +aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Free_faces") aGroup.Add(aFaceIds) # print the result @@ -59,15 +64,15 @@ for i in range(len(aFaceIds)): print "" #filter faces from plane 2 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, 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) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_1) aFaceIds = Mesh_1.GetIdsFromFilter(aFilter) -aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces") +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 index a2be02932..5e84f2bfc 100644 --- a/doc/salome/examples/quality_controls_ex07.py +++ b/doc/salome/examples/quality_controls_ex07.py @@ -1,7 +1,17 @@ # Bare border faces -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = geompy.MakeBoxDXDYDZ(100, 100, 100) geompy.addToStudy( box, "box" ) @@ -12,8 +22,8 @@ mesh.Quadrangle() mesh.Compute() # remove 2 faces -allFaces = mesh.GetElementsByType(FACE) +allFaces = mesh.GetElementsByType(SMESH.FACE) mesh.RemoveElements( allFaces[0:2]) -bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace) +bareGroup = mesh.MakeGroup("bare faces", SMESH.FACE, SMESH.FT_BareBorderFace) assert(bareGroup.Size() == 3) diff --git a/doc/salome/examples/quality_controls_ex08.py b/doc/salome/examples/quality_controls_ex08.py index 77e7e4c94..541af64a3 100644 --- a/doc/salome/examples/quality_controls_ex08.py +++ b/doc/salome/examples/quality_controls_ex08.py @@ -1,7 +1,17 @@ # Bare border volumes -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = geompy.MakeBoxDXDYDZ(100, 30, 10) # the smallest face of the box @@ -10,7 +20,7 @@ face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0] geompy.addToStudy( box, "box" ) geompy.addToStudyInFather( box, face, "face" ) -mesh = Mesh(box) +mesh = smesh.Mesh(box) mesh.AutomaticHexahedralization(); # remove half of mesh faces from the smallest face @@ -19,5 +29,5 @@ 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) +bareGroup = mesh.MakeGroup("bare volumes", SMESH.VOLUME, SMESH.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 index c4ca44e80..aca903ae0 100644 --- a/doc/salome/examples/quality_controls_ex09.py +++ b/doc/salome/examples/quality_controls_ex09.py @@ -1,10 +1,20 @@ # Over-constrained faces -from smesh import * -SetCurrentStudy(salome.myStudy) -mesh = Mesh() -faceFilter = GetFilter(FACE,FT_OverConstrainedFace) +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + + +mesh = smesh.Mesh() +faceFilter = smesh.GetFilter(SMESH.FACE,SMESH.FT_OverConstrainedFace) #make an edge n1 = mesh.AddNode(0,0,0) @@ -13,5 +23,5 @@ edge = mesh.AddEdge([n1,n2]) assert( not mesh.GetIdsFromFilter( faceFilter )) # make faces -mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5) +mesh.ExtrusionSweep([edge], smesh.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 index 49ef2e72a..041183224 100644 --- a/doc/salome/examples/quality_controls_ex10.py +++ b/doc/salome/examples/quality_controls_ex10.py @@ -1,15 +1,25 @@ # Over-constrained volumes -from smesh import * -SetCurrentStudy(salome.myStudy) -mesh = Mesh() -volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume) +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + + +mesh = smesh.Mesh() +volumeFilter = smesh.GetFilter(SMESH.VOLUME,SMESH.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) +mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 1) +mesh.ExtrusionSweep( mesh.GetElementsByType(SMESH.FACE), smesh.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 index ca955b6ab..69352be34 100644 --- a/doc/salome/examples/quality_controls_ex11.py +++ b/doc/salome/examples/quality_controls_ex11.py @@ -1,9 +1,15 @@ # Length 2D + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create open shell: a box without one plane box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -23,7 +29,7 @@ mesh.Compute() # Criterion : Length 2D > 5.7 length_margin = 5.7 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, length_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -38,7 +44,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`) +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 index 28a0192c5..4ddcc387d 100644 --- a/doc/salome/examples/quality_controls_ex12.py +++ b/doc/salome/examples/quality_controls_ex12.py @@ -1,9 +1,15 @@ # Borders at Multiconnection 2D + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a compound of two glued boxes box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -23,7 +29,7 @@ mesh.Compute() # Criterion : MULTI-CONNECTION 2D = 3 nb_conn = 3 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, SMESH.FT_EqualTo, nb_conn) anIds = mesh.GetIdsFromFilter(aFilter) @@ -38,7 +44,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`) +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 index 1673fc737..10810c849 100644 --- a/doc/salome/examples/quality_controls_ex13.py +++ b/doc/salome/examples/quality_controls_ex13.py @@ -1,6 +1,7 @@ # Area import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh @@ -9,7 +10,7 @@ salome = SMESH_mechanic.salome # Criterion : AREA > 100. area_margin = 100. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`) +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 index 379affdbd..50f87fbf7 100644 --- a/doc/salome/examples/quality_controls_ex14.py +++ b/doc/salome/examples/quality_controls_ex14.py @@ -1,6 +1,7 @@ # Taper import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh @@ -9,7 +10,7 @@ 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) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, taper_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`) +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 index 5ca56db0b..2c8fe7c6c 100644 --- a/doc/salome/examples/quality_controls_ex15.py +++ b/doc/salome/examples/quality_controls_ex15.py @@ -1,6 +1,7 @@ # Aspect Ratio import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh @@ -9,7 +10,7 @@ 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) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, ar_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`) +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 index a20f38f7b..5d8bade8a 100644 --- a/doc/salome/examples/quality_controls_ex16.py +++ b/doc/salome/examples/quality_controls_ex16.py @@ -1,6 +1,7 @@ # Minimum Angle import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh @@ -9,7 +10,7 @@ salome = SMESH_mechanic.salome # Criterion : MINIMUM ANGLE < 35. min_angle = 35. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, min_angle) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Minimum Angle < " + `min_angle`) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex17.py b/doc/salome/examples/quality_controls_ex17.py index fcc596c75..bd87eae42 100644 --- a/doc/salome/examples/quality_controls_ex17.py +++ b/doc/salome/examples/quality_controls_ex17.py @@ -1,6 +1,7 @@ # Warping import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh @@ -9,7 +10,7 @@ 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) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, wa_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Warp > " + `wa_margin`) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex18.py b/doc/salome/examples/quality_controls_ex18.py index 42e4b30e8..972652c38 100644 --- a/doc/salome/examples/quality_controls_ex18.py +++ b/doc/salome/examples/quality_controls_ex18.py @@ -1,6 +1,7 @@ # Skew import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh @@ -9,7 +10,7 @@ salome = SMESH_mechanic.salome # Criterion : Skew > 38. skew_margin = 38. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, skew_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`) +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 index abe195200..8b7e89a15 100644 --- a/doc/salome/examples/quality_controls_ex19.py +++ b/doc/salome/examples/quality_controls_ex19.py @@ -1,6 +1,7 @@ # Element Diameter 2D import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh @@ -9,7 +10,7 @@ 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) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, mel_2d_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`) +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 index 9e332e0dc..40a7bf155 100644 --- a/doc/salome/examples/quality_controls_ex20.py +++ b/doc/salome/examples/quality_controls_ex20.py @@ -1,6 +1,7 @@ # Aspect Ratio 3D import SMESH_mechanic_tetra +import SMESH smesh = SMESH_mechanic_tetra.smesh mesh = SMESH_mechanic_tetra.mesh @@ -9,7 +10,7 @@ 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) +aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_MoreThan, ar_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Aspect Ratio 3D > " + `ar_margin`) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex21.py b/doc/salome/examples/quality_controls_ex21.py index 833ffff81..29e384357 100644 --- a/doc/salome/examples/quality_controls_ex21.py +++ b/doc/salome/examples/quality_controls_ex21.py @@ -1,6 +1,7 @@ # Volume import SMESH_mechanic_tetra +import SMESH smesh = SMESH_mechanic_tetra.smesh mesh = SMESH_mechanic_tetra.mesh @@ -9,7 +10,7 @@ salome = SMESH_mechanic_tetra.salome # Criterion : VOLUME < 7. volume_margin = 7. -aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin) +aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_LessThan, volume_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -25,7 +26,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Volume < " + `volume_margin`) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex22.py b/doc/salome/examples/quality_controls_ex22.py index 5264b1ade..7cd582366 100644 --- a/doc/salome/examples/quality_controls_ex22.py +++ b/doc/salome/examples/quality_controls_ex22.py @@ -1,6 +1,7 @@ # Element Diameter 3D import SMESH_mechanic_tetra +import SMESH smesh = SMESH_mechanic_tetra.smesh mesh = SMESH_mechanic_tetra.mesh @@ -9,7 +10,7 @@ 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) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, mel_3d_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 3D > " + `mel_3d_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/transforming_meshes_ex01.py b/doc/salome/examples/transforming_meshes_ex01.py index 0ea75cc85..dc61324ec 100644 --- a/doc/salome/examples/transforming_meshes_ex01.py +++ b/doc/salome/examples/transforming_meshes_ex01.py @@ -1,13 +1,14 @@ # Translation import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # define translation vector -point = smesh.PointStruct(-150., -150., 0.) -vector =smesh.DirStruct(point) +point = SMESH.PointStruct(-150., -150., 0.) +vector =SMESH.DirStruct(point) # translate a mesh doCopy = 1 diff --git a/doc/salome/examples/transforming_meshes_ex02.py b/doc/salome/examples/transforming_meshes_ex02.py index f96a6bb41..5b3ff287e 100644 --- a/doc/salome/examples/transforming_meshes_ex02.py +++ b/doc/salome/examples/transforming_meshes_ex02.py @@ -3,12 +3,13 @@ import math import SMESH_mechanic +import SMESH smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # define rotation axis and angle -axisXYZ = smesh.AxisStruct(0., 0., 0., 5., 5., 20.) +axisXYZ = SMESH.AxisStruct(0., 0., 0., 5., 5., 20.) angle270 = 1.5 * math.pi # rotate a mesh diff --git a/doc/salome/examples/transforming_meshes_ex03.py b/doc/salome/examples/transforming_meshes_ex03.py index da8105a67..a6f7701f8 100644 --- a/doc/salome/examples/transforming_meshes_ex03.py +++ b/doc/salome/examples/transforming_meshes_ex03.py @@ -1,11 +1,18 @@ # Scale -import geompy +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + 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) diff --git a/doc/salome/examples/transforming_meshes_ex04.py b/doc/salome/examples/transforming_meshes_ex04.py index 0bfea6188..910035521 100644 --- a/doc/salome/examples/transforming_meshes_ex04.py +++ b/doc/salome/examples/transforming_meshes_ex04.py @@ -3,11 +3,12 @@ import math import SMESH_mechanic +import SMESH 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) +axis = SMESH.AxisStruct(0, 0, 0, 0, 0, 0) mesh.Mirror([], axis, smesh.POINT, 1) diff --git a/doc/salome/examples/transforming_meshes_ex06.py b/doc/salome/examples/transforming_meshes_ex06.py index fe8c91db3..c9c8353d8 100644 --- a/doc/salome/examples/transforming_meshes_ex06.py +++ b/doc/salome/examples/transforming_meshes_ex06.py @@ -1,8 +1,15 @@ # Merging Elements + import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a face to be meshed px = geompy.MakeVertex(100., 0. , 0. ) @@ -44,7 +51,7 @@ circlemesh.Compute() # extrusion of the mesh trias.ExtrusionAlongPath([], circlemesh, circle, - 1, 0, [], 0, smesh.PointStruct(0, 0, 0)) + 1, 0, [], 0, SMESH.PointStruct(0, 0, 0)) # merge nodes print "Number of nodes before MergeNodes:", diff --git a/doc/salome/examples/transforming_meshes_ex07.py b/doc/salome/examples/transforming_meshes_ex07.py index bb42d33eb..227eb636e 100644 --- a/doc/salome/examples/transforming_meshes_ex07.py +++ b/doc/salome/examples/transforming_meshes_ex07.py @@ -1,7 +1,15 @@ # Sew Meshes Border to Side -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create two faces of a box box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.) diff --git a/doc/salome/examples/transforming_meshes_ex08.py b/doc/salome/examples/transforming_meshes_ex08.py index e028735a0..77042de99 100644 --- a/doc/salome/examples/transforming_meshes_ex08.py +++ b/doc/salome/examples/transforming_meshes_ex08.py @@ -1,7 +1,17 @@ # Sew Conform Free Borders -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create two faces of the box box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.) diff --git a/doc/salome/examples/transforming_meshes_ex09.py b/doc/salome/examples/transforming_meshes_ex09.py index 5f92fd1ad..62fea88d1 100644 --- a/doc/salome/examples/transforming_meshes_ex09.py +++ b/doc/salome/examples/transforming_meshes_ex09.py @@ -1,7 +1,15 @@ # Sew Free Borders -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create two faces of the box box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.) diff --git a/doc/salome/examples/transforming_meshes_ex10.py b/doc/salome/examples/transforming_meshes_ex10.py index c54aca660..426a011a6 100644 --- a/doc/salome/examples/transforming_meshes_ex10.py +++ b/doc/salome/examples/transforming_meshes_ex10.py @@ -1,7 +1,14 @@ # Sew Side Elements -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create two boxes box1 = geompy.MakeBox(0., 0., 0., 10., 10., 10.) diff --git a/doc/salome/examples/transforming_meshes_ex11.py b/doc/salome/examples/transforming_meshes_ex11.py index f94aafeda..0c3bee898 100644 --- a/doc/salome/examples/transforming_meshes_ex11.py +++ b/doc/salome/examples/transforming_meshes_ex11.py @@ -1,8 +1,15 @@ # Duplicate nodes + import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Create a box @@ -20,11 +27,11 @@ mesh.Compute() # Without the duplication of border elements # Nodes to duplicate -nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' ) +nodes1 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes1' ) nodes1.Add( [ 119, 125, 131, 137 ] ) # Group of faces to replace nodes with new ones -faces1 = mesh.CreateEmptyGroup( smesh.FACE, 'faces1' ) +faces1 = mesh.CreateEmptyGroup( SMESH.FACE, 'faces1' ) faces1.Add( [ 144, 151, 158 ] ) # Duplicate nodes @@ -44,15 +51,15 @@ print "Quadrangles : ", mesh.NbQuadrangles() # With the duplication of border elements # Edges to duplicate -edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' ) +edges = mesh.CreateEmptyGroup( SMESH.EDGE, 'edges' ) edges.Add( [ 32, 33, 34 ] ) # Nodes not to duplicate -nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' ) +nodes2 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes2' ) nodes2.Add( [ 35, 38 ] ) # Group of faces to replace nodes with new ones -faces2 = mesh.CreateEmptyGroup( smesh.FACE, 'faces2' ) +faces2 = mesh.CreateEmptyGroup( SMESH.FACE, 'faces2' ) faces2.Add( [ 141, 148, 155 ] ) # Duplicate nodes diff --git a/doc/salome/examples/transforming_meshes_ex12.py b/doc/salome/examples/transforming_meshes_ex12.py index 0380cc363..e1d850ec6 100644 --- a/doc/salome/examples/transforming_meshes_ex12.py +++ b/doc/salome/examples/transforming_meshes_ex12.py @@ -1,7 +1,17 @@ # Create boundary elements -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = geompy.MakeBoxDXDYDZ(100, 100, 100) gFaces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"]) @@ -19,7 +29,7 @@ twoFaces = geompy.MakeCompound([f1,f2]) ## ----------- dim = SMESH.BND_2DFROM3D -init_mesh = Mesh(box, "box") +init_mesh = smesh.Mesh(box, "box") init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons # remove some faces @@ -29,7 +39,7 @@ rm_face = faces[ : nb_faces/2] init_mesh.RemoveElements( rm_face ) # restore boundary in this mesh -mesh = CopyMesh( init_mesh, "2D from 3D") +mesh = smesh.CopyMesh( init_mesh, "2D from 3D") groupName = "bnd 2D" nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName) @@ -49,7 +59,7 @@ nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshNam ## ----------- dim = SMESH.BND_1DFROM2D -init_mesh = Mesh(f1, "2D mesh") +init_mesh = smesh.Mesh(f1, "2D mesh") init_mesh.AutomaticHexahedralization() # remove some edges @@ -60,7 +70,7 @@ init_mesh.RemoveElements( rm_edge ) # restore boundary edges in this mesh -mesh = CopyMesh( init_mesh, "1D from 2D") +mesh = smesh.CopyMesh( init_mesh, "1D from 2D") groupName = "bnd 1D" nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName) @@ -81,7 +91,7 @@ nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshNam ## ------------------ dim = SMESH.BND_1DFROM3D -init_mesh = Mesh(box, "box") +init_mesh = smesh.Mesh(box, "box") init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons # remove all edges rm_edges = init_mesh.GetElementsByType( SMESH.EDGE ) @@ -92,7 +102,7 @@ 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) +mesh = smesh.CopyMesh( init_mesh, "1D from 2D groups", toCopyGroups=True) groups = mesh.GetGroups() nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName,groups=groups) diff --git a/doc/salome/examples/transforming_meshes_ex13.py b/doc/salome/examples/transforming_meshes_ex13.py index 0126b7108..fb56273ba 100644 --- a/doc/salome/examples/transforming_meshes_ex13.py +++ b/doc/salome/examples/transforming_meshes_ex13.py @@ -1,6 +1,17 @@ # Reorient faces by vector -import smesh, geompy, SMESH + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create a geometry consisting of two faces box = geompy.MakeBoxDXDYDZ( 10, 10, 10 ) diff --git a/doc/salome/examples/use_existing_faces.py b/doc/salome/examples/use_existing_faces.py index 12b5a9a56..631316444 100644 --- a/doc/salome/examples/use_existing_faces.py +++ b/doc/salome/examples/use_existing_faces.py @@ -1,6 +1,17 @@ # Use existing faces algorithm -import smesh, geompy + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + import numpy as np # define my 2D algorithm diff --git a/doc/salome/examples/viewing_meshes_ex01.py b/doc/salome/examples/viewing_meshes_ex01.py index b2fa7df40..85bc69fbc 100644 --- a/doc/salome/examples/viewing_meshes_ex01.py +++ b/doc/salome/examples/viewing_meshes_ex01.py @@ -1,8 +1,15 @@ # Viewing Mesh Infos -import geompy -import smesh -import SMESH + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box box = geompy.MakeBox(0., 0., 0., 20., 20., 20.) diff --git a/doc/salome/examples/viewing_meshes_ex02.py b/doc/salome/examples/viewing_meshes_ex02.py index cd096ca76..2ed0a214b 100644 --- a/doc/salome/examples/viewing_meshes_ex02.py +++ b/doc/salome/examples/viewing_meshes_ex02.py @@ -1,8 +1,15 @@ # Find Element by Point -import geompy -import smesh -import SMESH + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Create a geometry to mesh box = geompy.MakeBoxDXDYDZ(100,100,100) diff --git a/doc/salome/gui/SMESH/Makefile.am b/doc/salome/gui/SMESH/Makefile.am index 2b47b8112..dcdcd8975 100755 --- a/doc/salome/gui/SMESH/Makefile.am +++ b/doc/salome/gui/SMESH/Makefile.am @@ -35,16 +35,7 @@ DOC_PYTHONPATH=$(prefix)/bin/salome:$(prefix)/lib/python$(PYTHON_VERSION)/site-p DOC_LD_LIBRARY_PATH=$(prefix)lib/salome:${MED_ROOT_DIR}/lib/salome:${GEOM_ROOT_DIR}/lib/salome:${KERNEL_ROOT_DIR}/lib/salome DOC_SMESH_MeshersList=StdMeshers -# to have smesh.py in the documentation instead of smeshDC.py -# we create dummy smesh.py from the smeshDC.py -smesh.py: ../../../../src/SMESH_SWIG/smeshDC.py - @awk '/^class Mesh:/ { mesh_found=1 } // { if (mesh_found) {print $$0; next} } /^ +(def|#)/ { match( $$0, /^ +/); print substr( $$0, 1+RLENGTH ); next } /^class smeshDC/ { next } //' \ - $< > $@ - -tmp/smesh.py: $(top_srcdir)/src/SMESH_SWIG/StdMeshersDC.py $(srcdir)/collect_mesh_methods.py - @mkdir -p tmp && PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} LD_LIBRARY_PATH=$(DOC_LD_LIBRARY_PATH):${LD_LIBRARY_PATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(srcdir)/collect_mesh_methods.py -o $@ StdMeshers - -usr_docs: doxyfile_py doxyfile smesh.py tmp/smesh.py +usr_docs: doxyfile_py doxyfile @$(DOXYGEN) doxyfile_py ; \ $(DOXYGEN) doxyfile diff --git a/doc/salome/gui/SMESH/doxyfile_py.in b/doc/salome/gui/SMESH/doxyfile_py.in index 381ed77b3..e9495d4bf 100755 --- a/doc/salome/gui/SMESH/doxyfile_py.in +++ b/doc/salome/gui/SMESH/doxyfile_py.in @@ -99,10 +99,9 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #Input related options #--------------------------------------------------------------------------- -INPUT = smesh.py \ +INPUT = @top_srcdir@/src/SMESH_SWIG/smeshBuilder.py \ @top_srcdir@/src/SMESH_SWIG/smesh_algorithm.py \ - @top_srcdir@/src/SMESH_SWIG/StdMeshersDC.py \ - tmp/smesh.py + @top_srcdir@/src/SMESH_SWIG/StdMeshersBuilder.py FILE_PATTERNS = IMAGE_PATH = @srcdir@/images RECURSIVE = NO diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index 72d4585e1..2542a93e3 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -9,17 +9,17 @@ Documentation for SALOME %Mesh module Python API is available in two forms: - Structured documentation, where all methods and classes are grouped by their functionality, like it is done in the GUI documentation - Linear documentation grouped only by classes, declared -in the \ref smesh and StdMeshersDC Python packages. +in the \ref SMESH_SWIG.smeshBuilder "smeshBuilder" and \ref SMESH_SWIG.StdMeshersBuilder "StdMeshersBuilder" Python packages. -Python package \ref smesh provides an interface to create and handle +Class \ref SMESH_SWIG.smeshBuilder.smeshBuilder "smeshBuilder" provides an interface to create and handle meshes. It can be used to create an empty mesh or to import mesh from the data file. As soon as mesh is created, it is possible to manage it via its own -methods, described in \ref smesh.Mesh "class Mesh" documentation. +methods, described in \ref SMESH_SWIG.smeshBuilder.Mesh "class Mesh" documentation. -Class \ref smesh.Mesh "Mesh" allows assigning algorithms to a mesh. +Class \ref SMESH_SWIG.smeshBuilder.Mesh "Mesh" allows assigning algorithms to a mesh. Please note that some algorithms, included in the standard SALOME -distribution are always available. Python package \ref StdMeshersDC +distribution are always available. Python package \ref SMESH_SWIG.StdMeshersBuilder "StdMeshersBuilder" provides an interface for standard meshing algorithms included into the SALOME %Mesh module distribution, like: - REGULAR (1D) diff --git a/doc/salome/gui/SMESH/input/tui_filters.doc b/doc/salome/gui/SMESH/input/tui_filters.doc index eaf5d2803..9f8bff80d 100755 --- a/doc/salome/gui/SMESH/input/tui_filters.doc +++ b/doc/salome/gui/SMESH/input/tui_filters.doc @@ -23,8 +23,8 @@ Python scripts. \section filter_aspect_ratio Aspect ratio Filter 2D mesh elements (faces) according to the aspect ratio value: -- element type should be \a smesh.FACE -- functor type should be \a smesh.FT_AspectRatio +- element type should be \a SMESH.FACE +- functor type should be \a SMESH.FT_AspectRatio - threshold is floating point value (aspect ratio) \tui_script{filters_ex01.py} @@ -34,8 +34,8 @@ Filter 2D mesh elements (faces) according to the aspect ratio value: \section filter_aspect_ratio_3d Aspect ratio 3D Filter 3D mesh elements (volumes) according to the aspect ratio value: -- element type is \a smesh.VOLUME -- functor type is \a smesh.FT_AspectRatio3D +- element type is \a SMESH.VOLUME +- functor type is \a SMESH.FT_AspectRatio3D - threshold is floating point value (aspect ratio) \tui_script{filters_ex02.py} @@ -45,8 +45,8 @@ Filter 3D mesh elements (volumes) according to the aspect ratio value: \section filter_warping_angle Warping angle Filter 2D mesh elements (faces) according to the warping angle value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_Warping +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_Warping - threshold is floating point value (warping angle) \tui_script{filters_ex03.py} @@ -56,8 +56,8 @@ Filter 2D mesh elements (faces) according to the warping angle value: \section filter_minimum_angle Minimum angle Filter 2D mesh elements (faces) according to the minimum angle value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_MinimumAngle +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_MinimumAngle - threshold is floating point value (minimum angle) \tui_script{filters_ex04.py} @@ -67,8 +67,8 @@ Filter 2D mesh elements (faces) according to the minimum angle value: \section filter_taper Taper Filter 2D mesh elements (faces) according to the taper value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_Taper +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_Taper - threshold is floating point value (taper) \tui_script{filters_ex05.py} @@ -78,8 +78,8 @@ Filter 2D mesh elements (faces) according to the taper value: \section filter_skew Skew Filter 2D mesh elements (faces) according to the skew value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_Skew +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_Skew - threshold is floating point value (skew) \tui_script{filters_ex06.py} @@ -89,8 +89,8 @@ Filter 2D mesh elements (faces) according to the skew value: \section filter_area Area Filter 2D mesh elements (faces) according to the area value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_Area +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_Area - threshold is floating point value (area) \tui_script{filters_ex07.py} @@ -100,8 +100,8 @@ Filter 2D mesh elements (faces) according to the area value: \section filter_volume Volume Filter 3D mesh elements (volumes) according to the volume value: -- element type is \a smesh.VOLUME -- functor type is \a smesh.FT_Volume3D +- element type is \a SMESH.VOLUME +- functor type is \a SMESH.FT_Volume3D - threshold is floating point value (volume) \tui_script{filters_ex08.py} @@ -111,8 +111,8 @@ Filter 3D mesh elements (volumes) according to the volume value: \section filter_free_borders Free borders Filter 1D mesh elements (edges) which represent free borders of a mesh: -- element type is \a smesh.EDGE -- functor type is \a smesh.FT_FreeBorders +- element type is \a SMESH.EDGE +- functor type is \a SMESH.FT_FreeBorders - threshold value is not required \tui_script{filters_ex09.py} @@ -123,8 +123,8 @@ Filter 1D mesh elements (edges) which represent free borders of a mesh: Filter 2D mesh elements (faces) consisting of edges belonging to one element of mesh only: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_FreeEdges +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_FreeEdges - threshold value is not required \tui_script{filters_ex10.py} @@ -134,8 +134,8 @@ element of mesh only: \section filter_free_nodes Free nodes Filter free nodes: -- element type is \a smesh.NODE -- functor type is \a smesh.FT_FreeNodes +- element type is \a SMESH.NODE +- functor type is \a SMESH.FT_FreeNodes - threshold value is not required \tui_script{filters_ex11.py} @@ -145,8 +145,8 @@ Filter free nodes: \section filter_free_faces Free faces Filter free faces: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_FreeFaces +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_FreeFaces - threshold value is not required \tui_script{filters_ex12.py} @@ -156,8 +156,8 @@ Filter free faces: \section filter_bare_border_faces Bare border faces Filter faces with bare borders: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_BareBorderFace +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_BareBorderFace - threshold value is not required \tui_script{filters_ex13.py} @@ -167,8 +167,8 @@ Filter faces with bare borders: \section filter_coplanar_faces Coplanar faces Filter faces with bare borders: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_CoplanarFaces +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_CoplanarFaces - threshold value is the face ID - tolerance is in degrees @@ -177,8 +177,8 @@ Filter faces with bare borders: \section filter_over_constrained_faces Over-constrained faces Filter over-constrained faces: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_OverConstrainedFace +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_OverConstrainedFace - threshold value is not required \tui_script{filters_ex15.py} @@ -188,9 +188,9 @@ Filter over-constrained faces: \section filter_double_elements Double edges, Double faces, Double volumes filter mesh elements basing on the same set of nodes: -- element type is either \a smesh.EGDE, \a smesh.FACE or \a smesh.VOLUME -- functor type is either \a smesh.FT_EqualEdges, \a - smesh.FT_EqualFaces or \a smesh.FT_EqualVolumes, +- element type is either \a smesh.EGDE, \a SMESH.FACE or \a SMESH.VOLUME +- functor type is either \a SMESH.FT_EqualEdges, \a + SMESH.FT_EqualFaces or \a SMESH.FT_EqualVolumes, - threshold value is not required \tui_script{filters_ex16.py} @@ -199,8 +199,8 @@ filter mesh elements basing on the same set of nodes: \section tui_double_nodes_control Double nodes filters mesh nodes which are coincident with other nodes (within a given tolerance): -- element type is \a smesh.NODE -- functor type is \a smesh.FT_EqualNodes +- element type is \a SMESH.NODE +- functor type is \a SMESH.FT_EqualNodes - threshold value is not required - default tolerance is 1.0e-7 @@ -211,8 +211,8 @@ filters mesh nodes which are coincident with other nodes (within a given toleran Filter border 1D mesh elements (edges) according to the specified number of connections (faces belonging the border edges) -- element type is \a smesh.EDGE -- functor type is \a smesh.FT_MultiConnection +- element type is \a SMESH.EDGE +- functor type is \a SMESH.FT_MultiConnection - threshold is integer value (number of connections) \tui_script{filters_ex18.py} @@ -223,8 +223,8 @@ connections (faces belonging the border edges) Filter 2D mesh elements (faces) which consist of edges belonging to the specified number of mesh elements -- element type is \a smesh.FACE -- functor type is \a smesh.FT_MultiConnection2D +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_MultiConnection2D - threshold is integer value (number of connections) \tui_script{filters_ex19.py} @@ -234,8 +234,8 @@ to the specified number of mesh elements \section filter_length Length Filter 1D mesh elements (edges) according to the edge length value: -- element type should be \a smesh.EDGE -- functor type should be \a smesh.FT_Length +- element type should be \a SMESH.EDGE +- functor type should be \a SMESH.FT_Length - threshold is floating point value (length) \tui_script{filters_ex20.py} @@ -246,8 +246,8 @@ Filter 1D mesh elements (edges) according to the edge length value: Filter 2D mesh elements (faces) corresponding to the maximum length. value of its edges: -- element type should be \a smesh.FACE -- functor type should be \a smesh.FT_Length2D +- element type should be \a SMESH.FACE +- functor type should be \a SMESH.FT_Length2D - threshold is floating point value (edge length) \tui_script{filters_ex21.py} @@ -258,8 +258,8 @@ value of its edges: Filter 2D mesh elements (faces) corresponding to the maximum length value of its edges and diagonals: -- element type should be \a smesh.FACE -- functor type should be \a smesh.FT_MaxElementLength2D +- element type should be \a SMESH.FACE +- functor type should be \a SMESH.FT_MaxElementLength2D - threshold is floating point value (edge/diagonal length) \tui_script{filters_ex22.py} @@ -270,8 +270,8 @@ value of its edges and diagonals: Filter 3D mesh elements (volumes) corresponding to the maximum length value of its edges and diagonals: -- element type should be \a smesh.VOLUME -- functor type should be \a smesh.FT_MaxElementLength3D +- element type should be \a SMESH.VOLUME +- functor type should be \a SMESH.FT_MaxElementLength3D - threshold is floating point value (edge/diagonal length) \tui_script{filters_ex23.py} @@ -281,8 +281,8 @@ value of its edges and diagonals: \section filter_bare_border_volumes Bare border volumes Filter 3D mesh elements with bare borders: -- element type is \a smesh.VOLUME -- functor type is \a smesh.FT_BareBorderVolume +- element type is \a SMESH.VOLUME +- functor type is \a SMESH.FT_BareBorderVolume - threshold value is not required \tui_script{filters_ex24.py} @@ -292,8 +292,8 @@ Filter 3D mesh elements with bare borders: \section filter_over_constrained_volumes Over-constrained volumes Filter over-constrained volumes: -- element type is \a smesh.VOLUME -- functor type is \a smesh.FT_OverConstrainedVolume +- element type is \a SMESH.VOLUME +- functor type is \a SMESH.FT_OverConstrainedVolume - threshold value is not required \tui_script{filters_ex25.py} @@ -304,8 +304,8 @@ Filter over-constrained volumes: Filter mesh entities (nodes or elements) which all nodes lie on the shape defined by threshold value: -- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME -- functor type should be \a smesh.FT_BelongToGeom +- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME +- functor type should be \a SMESH.FT_BelongToGeom - threshold is geometrical object \tui_script{filters_ex26.py} @@ -314,8 +314,8 @@ shape defined by threshold value: Filter mesh entities (nodes or elements) at least one node of which lies on the shape defined by threshold value: -- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME -- functor type should be \a smesh.FT_LyingOnGeom +- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME +- functor type should be \a SMESH.FT_LyingOnGeom - threshold is geometrical object \tui_script{filters_ex27.py} @@ -324,8 +324,8 @@ shape defined by threshold value: Filter mesh entities (nodes or elements) which all nodes belong to the plane defined by threshold value with the given tolerance: -- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE -- functor type should be \a smesh.FT_BelongToPlane +- element type can be: \a SMESH.NODE, \a SMESH.EDGE, \a SMESH.FACE +- functor type should be \a SMESH.FT_BelongToPlane - threshold is geometrical object (plane) - default tolerance is 1.0e-7 @@ -335,8 +335,8 @@ plane defined by threshold value with the given tolerance: Filter mesh entities (nodes or elements) which all nodes belong to the cylindrical face defined by threshold value with the given tolerance: -- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE -- functor type should be \a smesh.FT_BelongToCylinder +- element type can be: \a , \a SMESH.EDGE, \a SMESH.FACE +- functor type should be \a SMESH.FT_BelongToCylinder - threshold is geometrical object (cylindrical face) - default tolerance is 1.0e-7 @@ -346,8 +346,8 @@ cylindrical face defined by threshold value with the given tolerance: Filter mesh entities (nodes or elements) which all nodes belong to the arbitrary surface defined by threshold value with the given tolerance: -- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE -- functor type should be \a smesh.FT_BelongToGenSurface +- element type can be: \a SMESH.NODE, \a SMESH.EDGE, \a SMESH.FACE +- functor type should be \a SMESH.FT_BelongToGenSurface - threshold is geometrical object (arbitrary surface) - default tolerance is 1.0e-7 @@ -357,8 +357,8 @@ arbitrary surface defined by threshold value with the given tolerance: Filter mesh entities elements (nodes or elements) according to the specified identifiers range: -- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME -- functor type is \a smesh.FT_RangeOfIds +- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME +- functor type is \a SMESH.FT_RangeOfIds - threshold is string listing required IDs and/or ranges of IDs, e.g."1,2,3,50-60,63,67,70-78" \tui_script{filters_ex31.py} @@ -367,8 +367,8 @@ specified identifiers range: Filter 3D mesh elements (volumes), which are incorrectly oriented from the point of view of MED convention. -- element type should be \a smesh.VOLUME -- functor type is \a smesh.FT_BadOrientedVolume +- element type should be \a SMESH.VOLUME +- functor type is \a SMESH.FT_BadOrientedVolume - threshold is not required \tui_script{filters_ex32.py} @@ -376,10 +376,10 @@ the point of view of MED convention. \section filter_linear_or_quadratic Linear / quadratic Filter linear / quadratic mesh elements: -- element type should be any element type, e.g.: \a smesh.EDGE, \a smesh.FACE, \a smesh.VOLUME -- functor type is \a smesh.FT_LinearOrQuadratic +- element type should be any element type, e.g.: \a SMESH.EDGE, \a SMESH.FACE, \a SMESH.VOLUME +- functor type is \a SMESH.FT_LinearOrQuadratic - threshold is not required -- if unary operator is set to smesh.FT_LogicalNOT, the quadratic +- if unary operator is set to SMESH.FT_LogicalNOT, the quadratic elements are selected, otherwise (by default) linear elements are selected \tui_script{filters_ex33.py} @@ -387,8 +387,8 @@ elements are selected, otherwise (by default) linear elements are selected \section filter_group_color Group color Filter mesh entities, belonging to the group with the color defined by the threshold value. -- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME -- functor type is \a smesh.FT_GroupColor +- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME +- functor type is \a SMESH.FT_GroupColor - threshold should be of SALOMEDS.Color type \tui_script{filters_ex34.py} @@ -398,8 +398,8 @@ Filter mesh entities, belonging to the group with the color defined by the thres Filter mesh elements by the geometric type defined with the threshold value. The list of available geometric types depends on the element entity type. -- element type should be any element type, e.g.: \a smesh.EDGE, \a smesh.FACE, \a smesh.VOLUME -- functor type should be \a smesh.FT_ElemGeomType +- element type should be any element type, e.g.: \a SMESH.EDGE, \a SMESH.FACE, \a SMESH.VOLUME +- functor type should be \a SMESH.FT_ElemGeomType - threshold is of smesh.GeometryType value \tui_script{filters_ex35.py} diff --git a/resources/StdMeshers.xml b/resources/StdMeshers.xml index af3dd63aa..81c8ba228 100644 --- a/resources/StdMeshers.xml +++ b/resources/StdMeshers.xml @@ -227,7 +227,7 @@ output ="EDGE" dim ="1"> - CompositeSegment_1D=Segment(algo=smesh.COMPOSITE) + CompositeSegment_1D=Segment(algo=smeshBuilder.COMPOSITE) LocalLength=LocalLength(SetLength(), ,SetPrecision()) MaxLength=MaxSize(SetLength()) Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges()) @@ -244,7 +244,7 @@ output="EDGE" dim="1"> - Python_1D=Segment(algo=smesh.PYTHON) + Python_1D=Segment(algo=smeshBuilder.PYTHON) PythonSplit1D=PythonSplit1D(SetNumberOfSegments(),SetPythonLog10RatioFunction()) @@ -258,7 +258,7 @@ output ="TRIA" dim ="2"> - MEFISTO_2D=Triangle(algo=smesh.MEFISTO) + MEFISTO_2D=Triangle(algo=smeshBuilder.MEFISTO) LengthFromEdges=LengthFromEdges() MaxElementArea=MaxElementArea(SetMaxElementArea()) ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges()) @@ -274,7 +274,7 @@ output ="QUAD" dim ="2"> - Quadrangle_2D=Quadrangle(algo=smesh.QUADRANGLE) + Quadrangle_2D=Quadrangle(algo=smeshBuilder.QUADRANGLE) QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex()) ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges()) @@ -288,7 +288,7 @@ opt-hypos="ViscousLayers" dim ="3"> - Hexa_3D=Hexahedron(algo=smesh.Hexa) + Hexa_3D=Hexahedron(algo=smeshBuilder.Hexa) ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreFaces()) @@ -419,7 +419,7 @@ output ="QUAD,TRIA" dim ="2"> - RadialQuadrangle_1D2D=Quadrangle(algo=smesh.RADIAL_QUAD) + RadialQuadrangle_1D2D=Quadrangle(algo=smeshBuilder.RADIAL_QUAD) NumberOfLayers2D=NumberOfLayers(SetNumberOfLayers()) diff --git a/src/OBJECT/SMESH_Object.h b/src/OBJECT/SMESH_Object.h index 84d42dd25..dbafd97bc 100644 --- a/src/OBJECT/SMESH_Object.h +++ b/src/OBJECT/SMESH_Object.h @@ -24,7 +24,6 @@ // File : SMESH_Object.h // Author : Nicolas REJNERI // Module : SMESH -// $Header$ // #ifndef SMESH_OBJECT_H #define SMESH_OBJECT_H diff --git a/src/OBJECT/SMESH_ObjectDef.h b/src/OBJECT/SMESH_ObjectDef.h index 5f3733447..116ee532d 100644 --- a/src/OBJECT/SMESH_ObjectDef.h +++ b/src/OBJECT/SMESH_ObjectDef.h @@ -24,7 +24,6 @@ // File : SMESH_Object.h // Author : Nicolas REJNERI // Module : SMESH -// $Header$ // #ifndef SMESH_OBJECTDEF_H #define SMESH_OBJECTDEF_H diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index b8f6840b7..9994f8f8a 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -345,7 +345,7 @@ namespace { //================================================================================ /*! - * \brief Convert a python script using commands of smesh.py + * \brief Convert a python script using commands of smeshBuilder.py * \param theScript - Input script * \param theEntry2AccessorMethod - returns method names to access to * objects wrapped with python class @@ -498,7 +498,7 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod //================================================================================ /*! - * \brief name of SMESH_Gen in smesh.py + * \brief name of SMESH_Gen in smeshBuilder.py */ //================================================================================ @@ -916,7 +916,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand ) // Replace name of SMESH_Gen - // names of SMESH_Gen methods fully equal to methods defined in smesh.py + // names of SMESH_Gen methods fully equal to methods defined in smeshBuilder.py static TStringSet smeshpyMethods; if ( smeshpyMethods.empty() ) { const char * names[] = diff --git a/src/SMESH_I/SMESH_2smeshpy.hxx b/src/SMESH_I/SMESH_2smeshpy.hxx index 19a4648a1..f2df48dc5 100644 --- a/src/SMESH_I/SMESH_2smeshpy.hxx +++ b/src/SMESH_I/SMESH_2smeshpy.hxx @@ -47,8 +47,8 @@ * This file was created in order to respond to requirement of bug PAL10494: * SMESH python dump uses idl interface. * - * The creation reason is that smesh.py commands defining hypotheses encapsulate - * several SMESH engine method calls. As well, the dependencies between smesh.py + * The creation reason is that smeshBuilder.py commands defining hypotheses encapsulate + * several SMESH engine method calls. As well, the dependencies between smeshBuilder.py * classes differ from ones between corresponding SMESH IDL interfaces. * * Everything here is for internal usage by SMESH_2smeshpy::ConvertScript() diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 15770dcc8..8736356ac 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -869,9 +869,9 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl aScript += helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()\n\t"; aScript += helper + "aMeasurements = " + aSMESHGen + ".CreateMeasurements()\n\t"; if ( isPublished ) - aScript += aSMESHGen + ".SetCurrentStudy(theStudy)"; + aScript += aSMESHGen + " = smeshBuilder.New(theStudy)"; else - aScript += aSMESHGen + ".SetCurrentStudy(None)"; + aScript += aSMESHGen + " = smeshBuilder.New(None)"; // import python files corresponding to plugins set moduleNameSet; @@ -880,14 +880,14 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl string moduleName = hyp_creator->second->GetModuleName(); bool newModule = moduleNameSet.insert( moduleName ).second; if ( newModule ) - aScript += helper + "\n\t" + "import " + (char*) moduleName.c_str(); + aScript += helper + "\n\t" + "from salome." + (char*) moduleName.c_str() + " import " + (char*) moduleName.c_str() +"Builder"; } // Dump trace of restored study if (theSavedTrace.Length() > 0) { - // For the convertion of IDL API calls -> smesh.py API, "smesh" standing for SMESH_Gen + // For the convertion of IDL API calls -> smeshBuilder.py API, "smesh" standing for SMESH_Gen // was replaces with "smeshgen" (==TPythonDump::SMESHGenName()). - // Change "smesh" -> "smeshgen" in the trace saved before passage to smesh.py API + // Change "smesh" -> "smeshgen" in the trace saved before passage to smeshBuilder.py API bool isNewVersion = theSavedTrace.Location( anOldGen + ".", 1, theSavedTrace.Length() ); if ( !isNewVersion ) { @@ -915,7 +915,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl aScript += helper + "\n" + aNewLines; } - // Convert IDL API calls into smesh.py API. + // Convert IDL API calls into smeshBuilder.py API. // Some objects are wrapped with python classes and // Resource_DataMapOfAsciiStringAsciiString holds methods returning wrapped objects Resource_DataMapOfAsciiStringAsciiString anEntry2AccessorMethod; @@ -1003,7 +1003,8 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl TCollection_AsciiString initPart = "import "; if ( isMultiFile ) initPart += helper + "salome, "; - initPart += aSmeshpy + ", SMESH, SALOMEDS\n"; + initPart += " SMESH, SALOMEDS\n"; + initPart += "from salome.smesh import smeshBuilder\n"; if ( importGeom && isMultiFile ) { initPart += ("\n## import GEOM dump file ## \n" @@ -1026,7 +1027,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl if ( aRemovedObjIDs.count( seqRemoved.Value(ir) )) continue; anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR("; anUpdatedScript += seqRemoved.Value(ir); - // for object wrapped by class of smesh.py + // for object wrapped by class of smeshBuilder.py anEntry = theObjectNames( seqRemoved.Value(ir) ); if ( anEntry2AccessorMethod.IsBound( anEntry ) ) anUpdatedScript += helper + "." + anEntry2AccessorMethod( anEntry ); diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx index d1ba4f4ce..598ad9fb3 100644 --- a/src/SMESH_I/SMESH_PythonDump.hxx +++ b/src/SMESH_I/SMESH_PythonDump.hxx @@ -50,7 +50,7 @@ class SMESH_2smeshpy { public: /*! - * \brief Convert a python script using commands of smesh.py + * \brief Convert a python script using commands of smeshBuilder.py * \param theScript - Input script * \param theEntry2AccessorMethod - returns method names to access to * objects wrapped with python class diff --git a/src/SMESH_SWIG/Makefile.am b/src/SMESH_SWIG/Makefile.am index af94b1895..b42bc694e 100644 --- a/src/SMESH_SWIG/Makefile.am +++ b/src/SMESH_SWIG/Makefile.am @@ -28,9 +28,6 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # Scripts to be installed. dist_salomescript_PYTHON = \ smesh.py \ - smeshDC.py \ - smesh_algorithm.py \ - StdMeshersDC.py \ batchmode_smesh.py \ batchmode_mefisto.py \ ex00_all.py \ @@ -99,5 +96,15 @@ dist_salomescript_PYTHON = \ PAL_MESH_043_3D.py \ SMESH_reg.py +mypkgpythondir = $(salomepythondir)/salome/smesh +mypkgpython_PYTHON = \ + smeshBuilder.py \ + smesh_algorithm.py + +stdpkgpythondir = $(salomepythondir)/salome/StdMeshers +stdpkgpython_PYTHON = \ + __init__.py \ + StdMeshersBuilder.py + sharedpkgpython_PYTHON = \ SMESH_shared_modules.py diff --git a/src/SMESH_SWIG/PAL_MESH_041_mesh.py b/src/SMESH_SWIG/PAL_MESH_041_mesh.py index fe38452f0..12c5b8837 100755 --- a/src/SMESH_SWIG/PAL_MESH_041_mesh.py +++ b/src/SMESH_SWIG/PAL_MESH_041_mesh.py @@ -22,8 +22,14 @@ # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) #-----------------------------GEOM---------------------------------------- @@ -55,7 +61,6 @@ Id_face1 = geompy.addToStudy(face1,"Face1") #-----------------------------SMESH------------------------------------------- -smesh.SetCurrentStudy(salome.myStudy) # -- Init mesh -- plane_mesh = salome.IDToObject( Id_face1) diff --git a/src/SMESH_SWIG/PAL_MESH_043_2D.py b/src/SMESH_SWIG/PAL_MESH_043_2D.py index 15eb20e40..a51bf5b00 100755 --- a/src/SMESH_SWIG/PAL_MESH_043_2D.py +++ b/src/SMESH_SWIG/PAL_MESH_043_2D.py @@ -26,8 +26,14 @@ # Description : Create meshes to test extrusion of mesh elements along path # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) #----------------------------------GEOM @@ -53,7 +59,6 @@ id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2") #---------------------------------SMESH -smesh.SetCurrentStudy(salome.myStudy) # create the path mesh mesh1 = smesh.Mesh(ellipse1, "Path Mesh") diff --git a/src/SMESH_SWIG/PAL_MESH_043_3D.py b/src/SMESH_SWIG/PAL_MESH_043_3D.py index bcee8d84a..b547265bc 100755 --- a/src/SMESH_SWIG/PAL_MESH_043_3D.py +++ b/src/SMESH_SWIG/PAL_MESH_043_3D.py @@ -26,8 +26,14 @@ # Description : Create meshes to test extrusion of mesh elements along path # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create points to build two circles @@ -51,8 +57,6 @@ idcircle = geompy.addToStudy(circle, "Circle") idface = geompy.addToStudy(face, "Circular face") -smesh.SetCurrentStudy(salome.myStudy) - # init a Mesh with the circular face mesh1 = smesh.Mesh(face, "Mesh on circular face") diff --git a/src/SMESH_SWIG/SMESH_AdvancedEditor.py b/src/SMESH_SWIG/SMESH_AdvancedEditor.py index 1ebeaa981..49062d342 100644 --- a/src/SMESH_SWIG/SMESH_AdvancedEditor.py +++ b/src/SMESH_SWIG/SMESH_AdvancedEditor.py @@ -22,10 +22,16 @@ # import salome -import smesh -import math - salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +import math def GetNewNodes(mesh,Elems,OldNodes): """ @@ -55,7 +61,6 @@ def GetNewNodes(mesh,Elems,OldNodes): pass return newnodes -smesh.SetCurrentStudy(salome.myStudy) # create empty mesh mesh = smesh.Mesh() @@ -67,13 +72,13 @@ tol = 0.001 n1 = mesh.AddNode(55,-5,0) n2 = mesh.AddNode(55,5,0) e1 = mesh.AddEdge([n1,n2]) -dir1 = smesh.DirStruct(smesh.PointStruct(-10,0,0)) +dir1 = SMESH.DirStruct(SMESH.PointStruct(-10,0,0)) mesh.ExtrusionSweep([e1],dir1,11) # 2. create second edge and make extrusion along 0y n3 = mesh.AddNode(-5,-55,0) n4 = mesh.AddNode(5,-55,0) e2 = mesh.AddEdge([n3,n4]) -dir2 = smesh.DirStruct(smesh.PointStruct(0,10,0)) +dir2 = SMESH.DirStruct(SMESH.PointStruct(0,10,0)) mesh.ExtrusionSweep([e2],dir2,11) # since result has coincident nodes and faces @@ -83,12 +88,12 @@ mesh.MergeNodes(nodes) mesh.MergeEqualElements() # make extrusion faces along 0z -faces = mesh.GetElementsByType(smesh.FACE) +faces = mesh.GetElementsByType(SMESH.FACE) nbf = len(faces) maxang = 2.0 zstep = 5 nbzsteps = 50 -dir3 = smesh.DirStruct(smesh.PointStruct(0,0,zstep)) +dir3 = SMESH.DirStruct(SMESH.PointStruct(0,0,zstep)) newfaces = [] # list for keeping created top faces # during extrusion @@ -121,7 +126,7 @@ for i in range(0,nbzsteps): pass # rotate faces from newfaces -axisr1 = smesh.AxisStruct(0,0,0,0,0,1) +axisr1 = SMESH.AxisStruct(0,0,0,0,0,1) for i in range(0,nbzsteps): ang = maxang*(1-math.cos((i+1)*math.pi/nbzsteps)) mesh.Rotate(newfaces[i],axisr1,ang,0) @@ -135,7 +140,7 @@ n6 = mesh.AddNode(67.5,0,0) n7 = mesh.AddNode(70,0,0) e56 = mesh.AddEdge([n5,n6]) e67 = mesh.AddEdge([n6,n7]) -axisr2 = smesh.AxisStruct(65,0,0,0,1,0) +axisr2 = SMESH.AxisStruct(65,0,0,0,1,0) mesh.RotationSweep([e56,e67],axisr2, math.pi/6, 12, tol) res = mesh.GetLastCreatedElems() faces1 = [] @@ -152,7 +157,7 @@ n9 = mesh.AddNode(-67.5,0,0) n10 = mesh.AddNode(-70,0,0) e8 = mesh.AddEdge([n8,n9]) e9 = mesh.AddEdge([n9,n10]) -axisr3 = smesh.AxisStruct(-65,0,0,0,-1,0) +axisr3 = SMESH.AxisStruct(-65,0,0,0,-1,0) mesh.RotationSweep([e8,e9],axisr3, math.pi/6, 12, tol) res = mesh.GetLastCreatedElems() faces2 = [] @@ -212,4 +217,4 @@ for i in range(0,nbrs): oldnodes = newnodes pass -smesh.salome.sg.updateObjBrowser(1) +salome.sg.updateObjBrowser(1) diff --git a/src/SMESH_SWIG/SMESH_BelongToGeom.py b/src/SMESH_SWIG/SMESH_BelongToGeom.py index c87d78acf..4efbc01b4 100644 --- a/src/SMESH_SWIG/SMESH_BelongToGeom.py +++ b/src/SMESH_SWIG/SMESH_BelongToGeom.py @@ -25,7 +25,6 @@ from SMESH_test1 import * ## Old style def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theElemType): - import geompy if theShape != theSubShape: aName = str(theSubShape) geompy.addToStudyInFather(theShape,theSubShape,aName) @@ -45,25 +44,23 @@ def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theEl ## Current style def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType): - import geompy - import smesh if theShape != theSubShape: aName = str(theSubShape) geompy.addToStudyInFather(theShape,theSubShape,aName) theMesh.Compute() - aFilter = smesh.GetFilter(theElemType, smesh.FT_BelongToGeom, theSubShape) + aFilter = smesh.GetFilter(theElemType, SMESH.FT_BelongToGeom, theSubShape) return aFilter.GetElementsId(theMesh.GetMesh()) -anElemType = smesh.FACE; +anElemType = SMESH.FACE; print "anElemType =", anElemType #anIds = CheckBelongToGeomFilter(mesh,box,subShapeList[1],anElemType) anIds = CheckBelongToGeomFilter(mesh,box,box,anElemType) print "Number of ids = ", len(anIds) print "anIds = ", anIds ## Check old version -#anIds = CheckBelongToGeomFilterOld(smesh.smesh,mesh.GetMesh(),box,box,anElemType) +#anIds = CheckBelongToGeomFilterOld(smesh,mesh.GetMesh(),box,box,anElemType) #print "anIds = ", anIds salome.sg.updateObjBrowser(1); diff --git a/src/SMESH_SWIG/SMESH_BuildCompound.py b/src/SMESH_SWIG/SMESH_BuildCompound.py index 7f205fecb..599b09dd0 100644 --- a/src/SMESH_SWIG/SMESH_BuildCompound.py +++ b/src/SMESH_SWIG/SMESH_BuildCompound.py @@ -28,8 +28,14 @@ # ! documentation generation to identify certain places of this file # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) ## create a bottom box Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.) @@ -60,7 +66,6 @@ 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") @@ -91,10 +96,10 @@ 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) +Compound1 = 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) +Compound2 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True) smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems') #end diff --git a/src/SMESH_SWIG/SMESH_GroupFromGeom.py b/src/SMESH_SWIG/SMESH_GroupFromGeom.py index a062fba6e..2631388ec 100644 --- a/src/SMESH_SWIG/SMESH_GroupFromGeom.py +++ b/src/SMESH_SWIG/SMESH_GroupFromGeom.py @@ -44,7 +44,7 @@ geompy.AddObject(aGeomGroup2, 10) geompy.addToStudy(aGeomGroup1, "Group on Faces") geompy.addToStudy(aGeomGroup2, "Group on Edges") -aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", smesh.FACE) -aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", smesh.EDGE) +aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE) +aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE) salome.sg.updateObjBrowser(1); diff --git a/src/SMESH_SWIG/SMESH_GroupFromGeom2.py b/src/SMESH_SWIG/SMESH_GroupFromGeom2.py index 1f6274da4..9b13c6f61 100755 --- a/src/SMESH_SWIG/SMESH_GroupFromGeom2.py +++ b/src/SMESH_SWIG/SMESH_GroupFromGeom2.py @@ -50,11 +50,11 @@ geompy.AddObject(aGeomGroup2, 10) geompy.addToStudy(aGeomGroup1, "Group on Faces") geompy.addToStudy(aGeomGroup2, "Group on Edges") -aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", smesh.FACE) -aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", smesh.EDGE) +aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE) +aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE) print "Create aGroupOnShell - a group linked to a shell" -aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", smesh.EDGE) +aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", SMESH.EDGE) print "aGroupOnShell type =", aGroupOnShell.GetType() print "aGroupOnShell size =", aGroupOnShell.Size() print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() diff --git a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py index 0d2ddeadc..3c55446cb 100644 --- a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py +++ b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py @@ -21,13 +21,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -import salome -import smesh - -smesh.SetCurrentStudy(salome.myStudy) - def BuildGroupLyingOn(theMesh, theElemType, theName, theShape): - aFilterMgr = smesh.smesh.CreateFilterManager() + aFilterMgr = smesh.CreateFilterManager() aFilter = aFilterMgr.CreateFilter() aLyingOnGeom = aFilterMgr.CreateLyingOnGeom() @@ -47,9 +42,9 @@ from SMESH_test1 import * mesh.Compute() # First way -BuildGroupLyingOn(mesh.GetMesh(), smesh.FACE, "Group of faces lying on edge #1", edge ) +BuildGroupLyingOn(mesh.GetMesh(), SMESH.FACE, "Group of faces lying on edge #1", edge ) # Second way -mesh.MakeGroup("Group of faces lying on edge #2", smesh.FACE, smesh.FT_LyingOnGeom, edge) +mesh.MakeGroup("Group of faces lying on edge #2", SMESH.FACE, SMESH.FT_LyingOnGeom, edge) salome.sg.updateObjBrowser(1); diff --git a/src/SMESH_SWIG/SMESH_Nut.py b/src/SMESH_SWIG/SMESH_Nut.py index a4730817e..fdbeb489c 100755 --- a/src/SMESH_SWIG/SMESH_Nut.py +++ b/src/SMESH_SWIG/SMESH_Nut.py @@ -26,9 +26,16 @@ #Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey ##################################################################### # -import geompy import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + import os import math @@ -98,8 +105,6 @@ Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1") #Mesh creation -smesh.SetCurrentStudy(salome.myStudy) - # -- Init -- shape_mesh = salome.IDToObject( Cut_1_ID ) @@ -117,7 +122,7 @@ smesh.SetName(hAvLength, "AverageLength_"+str(theAverageLength)) print "-------------------------- MaxElementArea" theMaxElementArea = 20 -algoMef = mesh.Triangle(smesh.MEFISTO) +algoMef = mesh.Triangle(smeshBuilder.MEFISTO) hArea = algoMef.MaxElementArea( theMaxElementArea ) print hArea.GetName() print hArea.GetId() @@ -126,7 +131,7 @@ smesh.SetName(hArea, "MaxElementArea_"+str(theMaxElementArea)) print "-------------------------- MaxElementVolume" theMaxElementVolume = 150 -algoNg = mesh.Tetrahedron(smesh.NETGEN) +algoNg = mesh.Tetrahedron(smeshBuilder.NETGEN) hVolume = algoNg.MaxElementVolume( theMaxElementVolume ) print hVolume.GetName() print hVolume.GetId() diff --git a/src/SMESH_SWIG/SMESH_Partition1_tetra.py b/src/SMESH_SWIG/SMESH_Partition1_tetra.py index ef53fd353..5a85f26ff 100644 --- a/src/SMESH_SWIG/SMESH_Partition1_tetra.py +++ b/src/SMESH_SWIG/SMESH_Partition1_tetra.py @@ -26,8 +26,15 @@ # -- Rayon de la bariere # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + from math import sqrt @@ -119,8 +126,6 @@ print "number of Edges in alveole : ", len(subEdgeList) status = geompy.CheckShape(alveole) print " check status ", status -# ---- launch SMESH -smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the alveole shape_mesh = salome.IDToObject( idalveole ) @@ -155,7 +160,7 @@ print "-------------------------- MaxElementVolume" maxElementVolume = 0.5 -netgen3D = mesh.Tetrahedron(smesh.NETGEN) +netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() diff --git a/src/SMESH_SWIG/SMESH_Sphere.py b/src/SMESH_SWIG/SMESH_Sphere.py index 36767fdbe..58d2aadd3 100644 --- a/src/SMESH_SWIG/SMESH_Sphere.py +++ b/src/SMESH_SWIG/SMESH_Sphere.py @@ -27,10 +27,17 @@ # Module : GEOM # $Header: # -from geompy import * -from math import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +import math # It is an example of creating a hexahedrical mesh on a sphere. # @@ -42,20 +49,20 @@ import smesh Radius = 100. Dist = Radius / 2. Factor = 2.5 -Angle90 = pi / 2. +Angle90 = math.pi / 2. NbSeg = 10 PointsList = [] ShapesList = [] #Basic Elements -P0 = MakeVertex(0., 0., 0.) -P1 = MakeVertex(-Dist, -Dist, -Dist) -P2 = MakeVertex(-Dist, -Dist, Dist) -P3 = MakeVertex(-Dist, Dist, Dist) -P4 = MakeVertex(-Dist, Dist, -Dist) +P0 = geompy.MakeVertex(0., 0., 0.) +P1 = geompy.MakeVertex(-Dist, -Dist, -Dist) +P2 = geompy.MakeVertex(-Dist, -Dist, Dist) +P3 = geompy.MakeVertex(-Dist, Dist, Dist) +P4 = geompy.MakeVertex(-Dist, Dist, -Dist) -VZ = MakeVectorDXDYDZ(0., 0., 1.) +VZ = geompy.MakeVectorDXDYDZ(0., 0., 1.) #Construction Elements PointsList.append(P1) @@ -64,47 +71,46 @@ PointsList.append(P3) PointsList.append(P4) PointsList.append(P1) -PolyLine = MakePolyline(PointsList) +PolyLine = geompy.MakePolyline(PointsList) -Face1 = MakeFace(PolyLine, 1) -Face2 = MakeScaleTransform(Face1, P0, Factor) -Face3 = MakeScaleTransform(Face1, P0, -1.) +Face1 = geompy.MakeFace(PolyLine, 1) +Face2 = geompy.MakeScaleTransform(Face1, P0, Factor) +Face3 = geompy.MakeScaleTransform(Face1, P0, -1.) #Models -Sphere = MakeSphereR(Radius) +Sphere = geompy.MakeSphereR(Radius) -Block = MakeHexa2Faces(Face1, Face2) -Cube = MakeHexa2Faces(Face1, Face3) +Block = geompy.MakeHexa2Faces(Face1, Face2) +Cube = geompy.MakeHexa2Faces(Face1, Face3) -Common1 = MakeBoolean(Sphere, Block, 1) -Common2 = MakeRotation(Common1, VZ, Angle90) +Common1 = geompy.MakeBoolean(Sphere, Block, 1) +Common2 = geompy.MakeRotation(Common1, VZ, Angle90) -MultiBlock1 = MakeMultiTransformation1D(Common1, 20, -1, 3) -MultiBlock2 = MakeMultiTransformation1D(Common2, 30, -1, 3) +MultiBlock1 = geompy.MakeMultiTransformation1D(Common1, 20, -1, 3) +MultiBlock2 = geompy.MakeMultiTransformation1D(Common2, 30, -1, 3) #Reconstruct sphere from several blocks ShapesList.append(Cube) ShapesList.append(MultiBlock1) ShapesList.append(MultiBlock2) -Compound = MakeCompound(ShapesList) +Compound = geompy.MakeCompound(ShapesList) -Result = MakeGlueFaces(Compound, 0.1) +Result = geompy.MakeGlueFaces(Compound, 0.1) #addToStudy -Id_Sphere = addToStudy(Sphere, "Sphere") -Id_Cube = addToStudy(Cube, "Cube") +Id_Sphere = geompy.addToStudy(Sphere, "Sphere") +Id_Cube = geompy.addToStudy(Cube, "Cube") -Id_Common1 = addToStudy(Common1, "Common1") -Id_Common2 = addToStudy(Common2, "Common2") +Id_Common1 = geompy.addToStudy(Common1, "Common1") +Id_Common2 = geompy.addToStudy(Common2, "Common2") -Id_MultiBlock1 = addToStudy(MultiBlock1, "MultiBlock1") -Id_MultiBlock2 = addToStudy(MultiBlock2, "MultiBlock2") +Id_MultiBlock1 = geompy.addToStudy(MultiBlock1, "MultiBlock1") +Id_MultiBlock2 = geompy.addToStudy(MultiBlock2, "MultiBlock2") -Id_Result = addToStudy(Result, "Result") +Id_Result = geompy.addToStudy(Result, "Result") #----------------------------------------------------------------------- #Meshing -smesh.SetCurrentStudy(salome.myStudy) my_hexa = smesh.Mesh(Result, "Sphere_Mesh") algo = my_hexa.Segment() algo.NumberOfSegments(NbSeg) diff --git a/src/SMESH_SWIG/SMESH_blocks.py b/src/SMESH_SWIG/SMESH_blocks.py index 12c68d4f0..c5a5e17e6 100644 --- a/src/SMESH_SWIG/SMESH_blocks.py +++ b/src/SMESH_SWIG/SMESH_blocks.py @@ -28,17 +28,22 @@ # $Header$ # import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + import math -import smesh import GEOM_Spanner isBlocksTest = 0 # False isMeshTest = 1 # True -smesh.SetCurrentStudy(salome.myStudy) - GEOM_Spanner.MakeSpanner(geompy, math, isBlocksTest, isMeshTest, smesh) salome.sg.updateObjBrowser(1); diff --git a/src/SMESH_SWIG/SMESH_box.py b/src/SMESH_SWIG/SMESH_box.py index 1ec31ed47..c38c5292f 100755 --- a/src/SMESH_SWIG/SMESH_box.py +++ b/src/SMESH_SWIG/SMESH_box.py @@ -31,16 +31,16 @@ # Salome geometry and meshing for a box # import salome -from salome import sg -import geompy -import smesh - +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -# ---- launch GEOM +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") - -###geom.GetCurrentStudy(salome.myStudy._get_StudyId()) +from salome import sg # Plate @@ -48,7 +48,6 @@ box = geompy.MakeBox(0.,0.,0.,1.,1.,1.) boxId = geompy.addToStudy(box,"box") # ---- SMESH -smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh diff --git a/src/SMESH_SWIG/SMESH_box2_tetra.py b/src/SMESH_SWIG/SMESH_box2_tetra.py index b1bc06801..850df8e66 100644 --- a/src/SMESH_SWIG/SMESH_box2_tetra.py +++ b/src/SMESH_SWIG/SMESH_box2_tetra.py @@ -25,8 +25,14 @@ # Hypothesis and algorithms for the mesh generation are global # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- define 2 boxes box1 and box2 @@ -74,7 +80,6 @@ print "number of Edges in shell : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- -smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the shell @@ -109,7 +114,7 @@ print "-------------------------- MaxElementVolume" maxElementVolume = 500 -netgen3D = mesh.Tetrahedron(smesh.NETGEN) +netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() diff --git a/src/SMESH_SWIG/SMESH_box3_tetra.py b/src/SMESH_SWIG/SMESH_box3_tetra.py index a10965880..1e4963d4a 100644 --- a/src/SMESH_SWIG/SMESH_box3_tetra.py +++ b/src/SMESH_SWIG/SMESH_box3_tetra.py @@ -26,9 +26,14 @@ # Hypothesis and algorithms for the mesh generation are global # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- define 3 boxes box1, box2 and box3 @@ -85,7 +90,6 @@ print "number of Edges in shell : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- -smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the shell @@ -120,7 +124,7 @@ print "-------------------------- MaxElementVolume" maxElementVolume = 500 -netgen3D = mesh.Tetrahedron(smesh.NETGEN) +netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() diff --git a/src/SMESH_SWIG/SMESH_box_tetra.py b/src/SMESH_SWIG/SMESH_box_tetra.py index 4ebd38dc7..f6edcf762 100644 --- a/src/SMESH_SWIG/SMESH_box_tetra.py +++ b/src/SMESH_SWIG/SMESH_box_tetra.py @@ -25,9 +25,14 @@ # the mesh generation are global # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- define a boxe @@ -46,7 +51,6 @@ print "number of Edges in box : ", len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- -smesh.SetCurrentStudy(salome.myStudy) # ---- init a Mesh with the boxe @@ -79,7 +83,7 @@ print "-------------------------- MaxElementVolume" maxElementVolume = 500 -netgen3D = mesh.Tetrahedron(smesh.NETGEN) +netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() diff --git a/src/SMESH_SWIG/SMESH_controls.py b/src/SMESH_SWIG/SMESH_controls.py index dc8b4ff35..e2ff1be23 100644 --- a/src/SMESH_SWIG/SMESH_controls.py +++ b/src/SMESH_SWIG/SMESH_controls.py @@ -25,17 +25,16 @@ # Author : Sergey LITONIN # Module : SMESH # -import smesh import SMESH_mechanic -salome = smesh.salome -mesh = SMESH_mechanic.mesh - +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- Criterion : AREA > 100 # create group -aGroup = mesh.MakeGroup("Area > 100", smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100) +aGroup = mesh.MakeGroup("Area > 100", SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100) # print result anIds = aGroup.GetIDs() @@ -47,7 +46,7 @@ print "Criterion: Area > 100 Nb = ", len( anIds ) # ---- Criterion : Taper > 3e-15 # create group -aGroup = mesh.MakeGroup("Taper > 3e-15", smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, 3e-15) +aGroup = mesh.MakeGroup("Taper > 3e-15", SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, 3e-15) # print result anIds = aGroup.GetIDs() @@ -59,7 +58,7 @@ print "Criterion: Taper > 3e-15 Nb = ", len( anIds ) # ---- Criterion : ASPECT RATIO > 1.3 # create group -aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 1.3) +aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 1.3) # print result anIds = aGroup.GetIDs() @@ -71,7 +70,7 @@ print "Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds ) # ---- Criterion : MINIMUM ANGLE < 30 # create group -aGroup = mesh.MakeGroup("Minimum Angle < 30", smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, 30) +aGroup = mesh.MakeGroup("Minimum Angle < 30", SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, 30) # print result anIds = aGroup.GetIDs() @@ -83,7 +82,7 @@ print "Criterion: Minimum Angle < 30 Nb = ", len( anIds ) # ---- Criterion : Warp > 2e-13 # create group -aGroup = mesh.MakeGroup("Warp > 2e-13", smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, 2e-13 ) +aGroup = mesh.MakeGroup("Warp > 2e-13", SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, 2e-13 ) # print result anIds = aGroup.GetIDs() @@ -95,7 +94,7 @@ print "Criterion: Warp > 2e-13 Nb = ", len( anIds ) # ---- Criterion : Skew > 18 # create group -aGroup = mesh.MakeGroup("Skew > 18", smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 18 ) +aGroup = mesh.MakeGroup("Skew > 18", SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 18 ) # print result anIds = aGroup.GetIDs() @@ -107,7 +106,7 @@ print "Criterion: Skew > 18 Nb = ", len( anIds ) # Criterion : Length > 10 # create group -aGroup = mesh.MakeGroup("Length > 10", smesh.FACE, smesh.FT_Length, smesh.FT_MoreThan, 10 ) +aGroup = mesh.MakeGroup("Length > 10", SMESH.FACE, SMESH.FT_Length, SMESH.FT_MoreThan, 10 ) # print result anIds = aGroup.GetIDs() @@ -119,7 +118,7 @@ print "Criterion: Length > 10 Nb = ", len( anIds ) # Criterion : Borders at multi-connections = 2 # create group -aGroup = mesh.MakeGroup("Borders at multi-connections = 2", smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, 2) +aGroup = mesh.MakeGroup("Borders at multi-connections = 2", SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, 2) # print result anIds = aGroup.GetIDs() @@ -131,7 +130,7 @@ print "Criterion: Borders at multi-connections = 2 Nb = ", len( anIds ) # Criterion : Element Diameter 2D > 10 # create group -aGroup = mesh.MakeGroup("Element Diameter 2D > 10", smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10 ) +aGroup = mesh.MakeGroup("Element Diameter 2D > 10", SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10 ) # print result anIds = aGroup.GetIDs() diff --git a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py index f99c9201b..6e6837816 100755 --- a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py +++ b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py @@ -33,8 +33,14 @@ # the mesh of some edges is thinner # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import math diff --git a/src/SMESH_SWIG/SMESH_fixation.py b/src/SMESH_SWIG/SMESH_fixation.py index 948c867fa..8a327def5 100644 --- a/src/SMESH_SWIG/SMESH_fixation.py +++ b/src/SMESH_SWIG/SMESH_fixation.py @@ -27,7 +27,11 @@ # $Header$ # import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + import math # ----------------------------------------------------------------------------- diff --git a/src/SMESH_SWIG/SMESH_fixation_hexa.py b/src/SMESH_SWIG/SMESH_fixation_hexa.py index 7bd194163..edcfef821 100644 --- a/src/SMESH_SWIG/SMESH_fixation_hexa.py +++ b/src/SMESH_SWIG/SMESH_fixation_hexa.py @@ -26,7 +26,10 @@ # Hypothesis and algorithms for the mesh generation are global # import SMESH_fixation -import smesh + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) compshell = SMESH_fixation.compshell idcomp = SMESH_fixation.idcomp diff --git a/src/SMESH_SWIG/SMESH_fixation_netgen.py b/src/SMESH_SWIG/SMESH_fixation_netgen.py index fd644d519..d6f38cbc0 100644 --- a/src/SMESH_SWIG/SMESH_fixation_netgen.py +++ b/src/SMESH_SWIG/SMESH_fixation_netgen.py @@ -26,7 +26,10 @@ # The new Netgen algorithm is used that discretizes baoundaries itself # import SMESH_fixation -import smesh + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) compshell = SMESH_fixation.compshell idcomp = SMESH_fixation.idcomp @@ -51,10 +54,10 @@ smesh.SetCurrentStudy(salome.myStudy) print "-------------------------- create Mesh, algorithm, hypothesis" mesh = smesh.Mesh(compshell, "MeshcompShel"); -netgen = mesh.Tetrahedron(smesh.FULL_NETGEN) +netgen = mesh.Tetrahedron(smeshBuilder.FULL_NETGEN) netgen.SetMaxSize( 50 ) #netgen.SetSecondOrder( 0 ) -netgen.SetFineness( smesh.Fine ) +netgen.SetFineness( smeshBuilder.Fine ) #netgen.SetOptimize( 1 ) salome.sg.updateObjBrowser(1) diff --git a/src/SMESH_SWIG/SMESH_fixation_tetra.py b/src/SMESH_SWIG/SMESH_fixation_tetra.py index 5a4e2f3f5..9896da034 100644 --- a/src/SMESH_SWIG/SMESH_fixation_tetra.py +++ b/src/SMESH_SWIG/SMESH_fixation_tetra.py @@ -25,8 +25,12 @@ # SMESH_fixation.py # Hypothesis and algorithms for the mesh generation are global # + import SMESH_fixation -import smesh + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) compshell = SMESH_fixation.compshell idcomp = SMESH_fixation.idcomp @@ -93,7 +97,7 @@ print "-------------------------- MaxElementVolume" maxElementVolume = 1000 -netgen3D = mesh.Tetrahedron(smesh.NETGEN) +netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) netgen3D.SetName("NETGEN_3D") hypVolume = netgen3D.MaxElementVolume(maxElementVolume) print hypVolume.GetName() diff --git a/src/SMESH_SWIG/SMESH_flight_skin.py b/src/SMESH_SWIG/SMESH_flight_skin.py index 5c57e002e..fce24d749 100644 --- a/src/SMESH_SWIG/SMESH_flight_skin.py +++ b/src/SMESH_SWIG/SMESH_flight_skin.py @@ -26,8 +26,14 @@ # import os import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---------------------------- GEOM -------------------------------------- diff --git a/src/SMESH_SWIG/SMESH_freebord.py b/src/SMESH_SWIG/SMESH_freebord.py index 2bc4f5538..809fbff8d 100644 --- a/src/SMESH_SWIG/SMESH_freebord.py +++ b/src/SMESH_SWIG/SMESH_freebord.py @@ -22,8 +22,14 @@ # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Create box without one plane @@ -58,7 +64,7 @@ mesh.Compute() # Criterion : Free edges. Create group. -aCriterion = smesh.GetCriterion(smesh.EDGE, smesh.FT_FreeEdges) +aCriterion = smesh.GetCriterion(SMESH.EDGE, SMESH.FT_FreeEdges) aGroup = mesh.MakeGroupByCriterion("Free edges", aCriterion) diff --git a/src/SMESH_SWIG/SMESH_hexaedre.py b/src/SMESH_SWIG/SMESH_hexaedre.py index 66ba9c824..8fd527f8f 100755 --- a/src/SMESH_SWIG/SMESH_hexaedre.py +++ b/src/SMESH_SWIG/SMESH_hexaedre.py @@ -21,12 +21,16 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -# ----------------------------------------------------------------------------- +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) -geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") +# ----------------------------------------------------------------------------- p0 = geompy.MakeVertex(0., 0., 0.) px = geompy.MakeVertex(100., 0., 0.) diff --git a/src/SMESH_SWIG/SMESH_mechanic.py b/src/SMESH_SWIG/SMESH_mechanic.py index 9f306f154..d7835f437 100644 --- a/src/SMESH_SWIG/SMESH_mechanic.py +++ b/src/SMESH_SWIG/SMESH_mechanic.py @@ -28,8 +28,14 @@ #------------------------------------------------------------------------- # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import StdMeshers diff --git a/src/SMESH_SWIG/SMESH_mechanic_editor.py b/src/SMESH_SWIG/SMESH_mechanic_editor.py index 4563dd476..c973d4b44 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_editor.py +++ b/src/SMESH_SWIG/SMESH_mechanic_editor.py @@ -28,10 +28,15 @@ #------------------------------------------------------------------------- # import salome -import geompy -import smesh - salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + # ---------------------------- GEOM -------------------------------------- # ---- define contigous arcs and segment to define a closed wire @@ -120,7 +125,6 @@ name = geompy.SubShapeName( sub_face4, mechanic ) Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name ) # ---------------------------- SMESH -------------------------------------- -smesh.SetCurrentStudy(salome.myStudy) # -- Init -- shape_mesh = salome.IDToObject( Id_mechanic ) @@ -194,37 +198,37 @@ mesh.SplitQuadObject(submesh2, 1) #2 cutting of triangles of the group FacesTriToQuad = [ 2391, 2824, 2825, 2826, 2827, 2828, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2841, 2844, 2845, 2847, 2854, 2861, 2863, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2940, 2941, 2946, 2951, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985 ] -GroupTriToQuad = mesh.MakeGroupByIds("Group of faces (quad)", smesh.FACE, FacesTriToQuad) -mesh.TriToQuadObject(GroupTriToQuad, smesh.FT_AspectRatio , 1.57) +GroupTriToQuad = mesh.MakeGroupByIds("Group of faces (quad)", SMESH.FACE, FacesTriToQuad) +mesh.TriToQuadObject(GroupTriToQuad, SMESH.FT_AspectRatio , 1.57) #3 extrusion of the group -point = smesh.PointStruct(0, 0, 5) -vector = smesh.DirStruct(point) +point = SMESH.PointStruct(0, 0, 5) +vector = SMESH.DirStruct(point) mesh.ExtrusionSweepObject(GroupTriToQuad, vector, 5) #4 mirror object -mesh.Mirror([], smesh.AxisStruct(0, 0, 0, 0, 0, 0), smesh.POINT, 0) +mesh.Mirror([], SMESH.AxisStruct(0, 0, 0, 0, 0, 0), smesh.POINT, 0) #5 mesh translation -point = smesh.PointStruct(10, 10, 10) -vector = smesh.DirStruct(point) +point = SMESH.PointStruct(10, 10, 10) +vector = SMESH.DirStruct(point) mesh.Translate([], vector, 0) #6 mesh rotation -axisXYZ = smesh.AxisStruct(0, 0, 0, 10, 10, 10) +axisXYZ = SMESH.AxisStruct(0, 0, 0, 10, 10, 10) angle180 = 180*3.141/180 mesh.Rotate([], axisXYZ, angle180, 0) #7 group smoothing FacesSmooth = [864, 933, 941, 950, 1005, 1013] -GroupSmooth = mesh.MakeGroupByIds("Group of faces (smooth)", smesh.FACE, FacesSmooth) +GroupSmooth = mesh.MakeGroupByIds("Group of faces (smooth)", SMESH.FACE, FacesSmooth) mesh.SmoothObject(GroupSmooth, [], 20, 2, smesh.CENTROIDAL_SMOOTH) #8 rotation sweep object FacesRotate = [492, 493, 502, 503] -GroupRotate = mesh.MakeGroupByIds("Group of faces (rotate)", smesh.FACE, FacesRotate) +GroupRotate = mesh.MakeGroupByIds("Group of faces (rotate)", SMESH.FACE, FacesRotate) angle45 = 45*3.141/180 -axisXYZ = smesh.AxisStruct(-38.3128, -73.3658, -133.321, -13.3402, -13.3265, 6.66632) +axisXYZ = SMESH.AxisStruct(-38.3128, -73.3658, -133.321, -13.3402, -13.3265, 6.66632) mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5) #9 reorientation of the submesh1 diff --git a/src/SMESH_SWIG/SMESH_mechanic_netgen.py b/src/SMESH_SWIG/SMESH_mechanic_netgen.py index 653a61c6e..280975e64 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_netgen.py +++ b/src/SMESH_SWIG/SMESH_mechanic_netgen.py @@ -26,11 +26,14 @@ # The new Netgen algorithm is used that discretizes baoundaries itself # import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -geom = geompy.geom - -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---------------------------- GEOM -------------------------------------- @@ -105,15 +108,14 @@ print "number of Faces in mechanic : ",len(subFaceList) print "number of Edges in mechanic : ",len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- -smesh.SetCurrentStudy(salome.myStudy) print "-------------------------- create Mesh, algorithm, hypothesis" mesh = smesh.Mesh(mechanic, "Mesh_mechanic"); -netgen = mesh.Triangle(smesh.NETGEN) +netgen = mesh.Triangle(smeshBuilder.NETGEN) netgen.SetMaxSize( 50 ) #netgen.SetSecondOrder( 0 ) -netgen.SetFineness( smesh.Fine ) +netgen.SetFineness( smeshBuilder.Fine ) netgen.SetQuadAllowed( 1 ) #netgen.SetOptimize( 1 ) diff --git a/src/SMESH_SWIG/SMESH_mechanic_tetra.py b/src/SMESH_SWIG/SMESH_mechanic_tetra.py index e1893b685..68996d81c 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_tetra.py +++ b/src/SMESH_SWIG/SMESH_mechanic_tetra.py @@ -27,10 +27,14 @@ # $Header$ # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -geom = geompy.geom +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---------------------------- GEOM -------------------------------------- @@ -105,7 +109,6 @@ print "number of Faces in mechanic : ",len(subFaceList) print "number of Edges in mechanic : ",len(subEdgeList) ### ---------------------------- SMESH -------------------------------------- -smesh.SetCurrentStudy(salome.myStudy) shape_mesh = salome.IDToObject( Id_mechanic ) @@ -125,7 +128,7 @@ smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment)) maxElementArea = 20 -algo2 = mesh.Triangle(smesh.MEFISTO) +algo2 = mesh.Triangle(smeshBuilder.MEFISTO) hypArea = algo2.MaxElementArea(maxElementArea) print hypArea.GetName() print hypArea.GetId() @@ -135,7 +138,7 @@ smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) maxElementVolume = 20 -algo3 = mesh.Tetrahedron(smesh.NETGEN) +algo3 = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = algo3.MaxElementVolume(maxElementVolume) print hypVolume.GetName() print hypVolume.GetId() diff --git a/src/SMESH_SWIG/SMESH_reg.py b/src/SMESH_SWIG/SMESH_reg.py index 77439c83e..36fc4b897 100644 --- a/src/SMESH_SWIG/SMESH_reg.py +++ b/src/SMESH_SWIG/SMESH_reg.py @@ -25,8 +25,14 @@ # Module : SMESH # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import StdMeshers diff --git a/src/SMESH_SWIG/SMESH_test.py b/src/SMESH_SWIG/SMESH_test.py index bd467564d..c296df6fd 100644 --- a/src/SMESH_SWIG/SMESH_test.py +++ b/src/SMESH_SWIG/SMESH_test.py @@ -26,8 +26,14 @@ # Module : SMESH # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- define a box @@ -69,7 +75,7 @@ print hyp.GetName() print hyp.GetId() print hyp.GetLength() -algo_2 = mesh.Triangle(smesh.MEFISTO, box) +algo_2 = mesh.Triangle(smeshBuilder.MEFISTO, box) hyp = algo_2.MaxElementArea(5000) print hyp.GetName() print hyp.GetId() diff --git a/src/SMESH_SWIG/SMESH_test0.py b/src/SMESH_SWIG/SMESH_test0.py index 40ce96c58..0ddb6f3c6 100644 --- a/src/SMESH_SWIG/SMESH_test0.py +++ b/src/SMESH_SWIG/SMESH_test0.py @@ -25,11 +25,14 @@ # Module : SMESH # import salome -import geompy -from geompy import geom +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) - -myBuilder = salome.myStudy.NewBuilder() +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- define a box diff --git a/src/SMESH_SWIG/SMESH_test1.py b/src/SMESH_SWIG/SMESH_test1.py index 58fa45091..2a34cec6c 100644 --- a/src/SMESH_SWIG/SMESH_test1.py +++ b/src/SMESH_SWIG/SMESH_test1.py @@ -25,8 +25,14 @@ # Module : SMESH # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- define a box @@ -60,8 +66,6 @@ idedge = geompy.addToStudyInFather(face, edge, name) # ---- SMESH -smesh.SetCurrentStudy(salome.myStudy) - # ---- Init a Mesh with the box mesh = smesh.Mesh(box, "Meshbox") diff --git a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py index 9d70e9478..c3a09133d 100644 --- a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py +++ b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py @@ -25,9 +25,14 @@ # Module : SMESH # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- define a box @@ -61,8 +66,6 @@ idedge = geompy.addToStudyInFather(face, edge, name) # ---- SMESH -smesh.SetCurrentStudy(salome.myStudy) - # ---- Init a Mesh with the box mesh = smesh.Mesh(box, "Meshbox") diff --git a/src/SMESH_SWIG/SMESH_test3.py b/src/SMESH_SWIG/SMESH_test3.py index be051600e..5a967a42e 100644 --- a/src/SMESH_SWIG/SMESH_test3.py +++ b/src/SMESH_SWIG/SMESH_test3.py @@ -25,8 +25,16 @@ # Module : SMESH #import salome # +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import math -import geompy pi = math.pi diff --git a/src/SMESH_SWIG/SMESH_test4.py b/src/SMESH_SWIG/SMESH_test4.py index 67dc29895..ea8bc3c8c 100755 --- a/src/SMESH_SWIG/SMESH_test4.py +++ b/src/SMESH_SWIG/SMESH_test4.py @@ -22,8 +22,14 @@ # import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # ---- GEOM @@ -49,13 +55,13 @@ algo1 = mesh.Segment() algo1.NumberOfSegments(10) # Set 2D algorithm/hypotheses to mesh -algo2 = mesh.Triangle(smesh.MEFISTO) +algo2 = mesh.Triangle(smeshBuilder.MEFISTO) algo2.MaxElementArea(10) # Create submesh on face algo3 = mesh.Segment(face) algo3.NumberOfSegments(10) -algo4 = mesh.Triangle(smesh.MEFISTO, face) +algo4 = mesh.Triangle(smeshBuilder.MEFISTO, face) algo4.MaxElementArea(100) submesh = algo4.GetSubMesh() smesh.SetName(submesh, "SubMeshFace") @@ -63,11 +69,11 @@ smesh.SetName(submesh, "SubMeshFace") mesh.Compute() -faces = submesh.GetElementsByType(smesh.FACE) +faces = submesh.GetElementsByType(SMESH.FACE) if len(faces) > 1: print len(faces), len(faces)/2 - group1 = mesh.CreateEmptyGroup(smesh.FACE,"Group of faces") - group2 = mesh.CreateEmptyGroup(smesh.FACE,"Another group of faces") + group1 = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces") + group2 = mesh.CreateEmptyGroup(SMESH.FACE,"Another group of faces") group1.Add(faces[:int(len(faces)/2)]) group2.Add(faces[int(len(faces)/2):]) diff --git a/src/SMESH_SWIG/SMESH_test5.py b/src/SMESH_SWIG/SMESH_test5.py index b2fc9a8e1..625a82f9e 100644 --- a/src/SMESH_SWIG/SMESH_test5.py +++ b/src/SMESH_SWIG/SMESH_test5.py @@ -25,14 +25,19 @@ # Module : SMESH # import salome -import smesh -import SALOMEDS +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + import CORBA import os import os.path -smesh.SetCurrentStudy(salome.myStudy) - def SetSObjName(theSObj,theName) : ok, anAttr = theSObj.FindAttribute("AttributeName") if ok: diff --git a/src/SMESH_SWIG/StdMeshersDC.py b/src/SMESH_SWIG/StdMeshersBuilder.py similarity index 95% rename from src/SMESH_SWIG/StdMeshersDC.py rename to src/SMESH_SWIG/StdMeshersBuilder.py index 3e1abf1d3..bf79aeb03 100644 --- a/src/SMESH_SWIG/StdMeshersDC.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -18,13 +18,13 @@ # ## -# @package StdMeshersDC +# @package StdMeshersBuilder # Python API for the standard meshing plug-in module. -from smesh_algorithm import Mesh_Algorithm -from smesh import AssureGeomPublished, IsEqual, ParseParameters -from smesh import GetName, TreatHypoStatus -from smeshDC import Mesh +from salome.smesh.smesh_algorithm import Mesh_Algorithm +from salome.smesh.smeshBuilder import AssureGeomPublished, IsEqual, ParseParameters +from salome.smesh.smeshBuilder import GetName, TreatHypoStatus +from salome.smesh.smeshBuilder import Mesh import StdMeshers @@ -32,19 +32,19 @@ import StdMeshers # Mesh algo type identifiers #---------------------------- -## Algorithm type: Regular 1D algorithm, see StdMeshersDC_Segment +## Algorithm type: Regular 1D algorithm, see StdMeshersBuilder_Segment REGULAR = "Regular_1D" -## Algorithm type: Python 1D algorithm, see StdMeshersDC_Segment_Python +## Algorithm type: Python 1D algorithm, see StdMeshersBuilder_Segment_Python PYTHON = "Python_1D" -## Algorithm type: Composite segment 1D algorithm, see StdMeshersDC_CompositeSegment +## Algorithm type: Composite segment 1D algorithm, see StdMeshersBuilder_CompositeSegment COMPOSITE = "CompositeSegment_1D" -## Algorithm type: Triangle MEFISTO 2D algorithm, see StdMeshersDC_Triangle_MEFISTO +## Algorithm type: Triangle MEFISTO 2D algorithm, see StdMeshersBuilder_Triangle_MEFISTO MEFISTO = "MEFISTO_2D" -## Algorithm type: Hexahedron 3D (i-j-k) algorithm, see StdMeshersDC_Hexahedron +## Algorithm type: Hexahedron 3D (i-j-k) algorithm, see StdMeshersBuilder_Hexahedron Hexa = "Hexa_3D" -## Algorithm type: Quadrangle 2D algorithm, see StdMeshersDC_Quadrangle +## Algorithm type: Quadrangle 2D algorithm, see StdMeshersBuilder_Quadrangle QUADRANGLE = "Quadrangle_2D" -## Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersDC_RadialQuadrangle1D2D +## Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersBuilder_RadialQuadrangle1D2D RADIAL_QUAD = "RadialQuadrangle_1D2D" # import items of enum QuadType @@ -59,7 +59,7 @@ for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e)) # It can be created by calling smesh.Mesh.Segment(geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_Segment(Mesh_Algorithm): +class StdMeshersBuilder_Segment(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -302,8 +302,8 @@ class StdMeshersDC_Segment(Mesh_Algorithm): store_geom = self.geom if type(vertex) is types.IntType: if vertex == 0 or vertex == 1: - import geompyDC - vertex = self.mesh.geompyD.ExtractShapes(self.geom, geompyDC.ShapeType["VERTEX"],True)[vertex] + from salome.geom import geomBuilder + vertex = self.mesh.geompyD.ExtractShapes(self.geom, geomBuilder.ShapeType["VERTEX"],True)[vertex] self.geom = vertex pass pass @@ -342,14 +342,14 @@ class StdMeshersDC_Segment(Mesh_Algorithm): hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp) return hyp - pass # end of StdMeshersDC_Segment class + pass # end of StdMeshersBuilder_Segment class ## Segment 1D algorithm for discretization of a set of adjacent edges as one edge. # # It is created by calling smesh.Mesh.Segment(smesh.COMPOSITE,geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_CompositeSegment(StdMeshersDC_Segment): +class StdMeshersBuilder_CompositeSegment(StdMeshersBuilder_Segment): ## name of the dynamic method in smesh.Mesh class # @internal @@ -373,14 +373,14 @@ class StdMeshersDC_CompositeSegment(StdMeshersDC_Segment): self.Create(mesh, geom, self.algoType) pass - pass # end of StdMeshersDC_CompositeSegment class + pass # end of StdMeshersBuilder_CompositeSegment class ## Defines a segment 1D algorithm for discretization of edges with Python function # # It is created by calling smesh.Mesh.Segment(smesh.PYTHON,geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_Segment_Python(Mesh_Algorithm): +class StdMeshersBuilder_Segment_Python(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -418,14 +418,14 @@ class StdMeshersDC_Segment_Python(Mesh_Algorithm): hyp.SetPythonLog10RatioFunction(func) return hyp - pass # end of StdMeshersDC_Segment_Python class + pass # end of StdMeshersBuilder_Segment_Python class ## Triangle MEFISTO 2D algorithm # # It is created by calling smesh.Mesh.Triangle(smesh.MEFISTO,geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_Triangle_MEFISTO(Mesh_Algorithm): +class StdMeshersBuilder_Triangle_MEFISTO(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -471,14 +471,14 @@ class StdMeshersDC_Triangle_MEFISTO(Mesh_Algorithm): hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp) return hyp - pass # end of StdMeshersDC_Triangle_MEFISTO class + pass # end of StdMeshersBuilder_Triangle_MEFISTO class ## Defines a quadrangle 2D algorithm # # It is created by calling smesh.Mesh.Quadrangle(geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_Quadrangle(Mesh_Algorithm): +class StdMeshersBuilder_Quadrangle(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -590,14 +590,14 @@ class StdMeshersDC_Quadrangle(Mesh_Algorithm): def TriangleVertex(self, vertex, UseExisting=0): return self.QuadrangleParameters(QUAD_STANDARD,vertex,UseExisting) - pass # end of StdMeshersDC_Quadrangle class + pass # end of StdMeshersBuilder_Quadrangle class ## Defines a hexahedron 3D algorithm # # It is created by calling smesh.Mesh.Hexahedron(geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_Hexahedron(Mesh_Algorithm): +class StdMeshersBuilder_Hexahedron(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -622,14 +622,14 @@ class StdMeshersDC_Hexahedron(Mesh_Algorithm): self.Create(mesh, geom, Hexa) pass - pass # end of StdMeshersDC_Hexahedron class + pass # end of StdMeshersBuilder_Hexahedron class ## Defines a projection 1D algorithm # # It is created by calling smesh.Mesh.Projection1D(geom=0) # # @ingroup l3_algos_proj -class StdMeshersDC_Projection1D(Mesh_Algorithm): +class StdMeshersBuilder_Projection1D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -679,14 +679,14 @@ class StdMeshersDC_Projection1D(Mesh_Algorithm): hyp.SetVertexAssociation( srcV, tgtV ) return hyp - pass # end of StdMeshersDC_Projection1D class + pass # end of StdMeshersBuilder_Projection1D class ## Defines a projection 2D algorithm # # It is created by calling smesh.Mesh.Projection2D(geom=0) # # @ingroup l3_algos_proj -class StdMeshersDC_Projection2D(Mesh_Algorithm): +class StdMeshersBuilder_Projection2D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -728,7 +728,7 @@ class StdMeshersDC_Projection2D(Mesh_Algorithm): # Note: all association vertices must belong to one edge of a face def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None, srcV2=None, tgtV2=None, UseExisting=0): - from smeshDC import Mesh + from salome.smesh.smeshBuilder import Mesh if isinstance(mesh, Mesh): mesh = mesh.GetMesh() for geom in [ face, srcV1, tgtV1, srcV2, tgtV2 ]: @@ -742,14 +742,14 @@ class StdMeshersDC_Projection2D(Mesh_Algorithm): hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 ) return hyp - pass # end of StdMeshersDC_Projection2D class + pass # end of StdMeshersBuilder_Projection2D class ## Defines a projection 1D-2D algorithm # # It is created by calling smesh.Mesh.Projection1D2D(geom=0) # # @ingroup l3_algos_proj -class StdMeshersDC_Projection1D2D(StdMeshersDC_Projection2D): +class StdMeshersBuilder_Projection1D2D(StdMeshersBuilder_Projection2D): ## name of the dynamic method in smesh.Mesh class # @internal @@ -766,17 +766,17 @@ class StdMeshersDC_Projection1D2D(StdMeshersDC_Projection2D): # @param geom geometry (shape/sub-shape) algorithm is assigned to; # if it is @c 0 (default), the algorithm is assigned to the main shape def __init__(self, mesh, geom=0): - StdMeshersDC_Projection2D.__init__(self, mesh, geom) + StdMeshersBuilder_Projection2D.__init__(self, mesh, geom) pass - pass # end of StdMeshersDC_Projection1D2D class + pass # end of StdMeshersBuilder_Projection1D2D class ## Defines a projection 3D algorithm # # It is created by calling smesh.Mesh.Projection3D(geom=0) # # @ingroup l3_algos_proj -class StdMeshersDC_Projection3D(Mesh_Algorithm): +class StdMeshersBuilder_Projection3D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -831,7 +831,7 @@ class StdMeshersDC_Projection3D(Mesh_Algorithm): #elif srcV1 or srcV2 or tgtV1 or tgtV2: return hyp - pass # end of StdMeshersDC_Projection3D class + pass # end of StdMeshersBuilder_Projection3D class ## Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism" # depending on geometry @@ -839,7 +839,7 @@ class StdMeshersDC_Projection3D(Mesh_Algorithm): # It is created by calling smesh.Mesh.Prism(geom=0) # # @ingroup l3_algos_3dextr -class StdMeshersDC_Prism3D(Mesh_Algorithm): +class StdMeshersBuilder_Prism3D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -983,7 +983,7 @@ class StdMeshersDC_Prism3D(Mesh_Algorithm): hyp.SetFineness( fineness ) return hyp - pass # end of StdMeshersDC_Prism3D class + pass # end of StdMeshersBuilder_Prism3D class ## Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism" # depending on geometry @@ -991,7 +991,7 @@ class StdMeshersDC_Prism3D(Mesh_Algorithm): # It is created by calling smesh.Mesh.Prism(geom=0) # # @ingroup l3_algos_3dextr -class StdMeshersDC_RadialPrism3D(StdMeshersDC_Prism3D): +class StdMeshersBuilder_RadialPrism3D(StdMeshersBuilder_Prism3D): ## name of the dynamic method in smesh.Mesh class # @internal @@ -1023,7 +1023,7 @@ class StdMeshersDC_RadialPrism3D(StdMeshersDC_Prism3D): # It is created by calling smesh.Mesh.Quadrangle(smesh.RADIAL_QUAD,geom=0) # # @ingroup l2_algos_radialq -class StdMeshersDC_RadialQuadrangle1D2D(Mesh_Algorithm): +class StdMeshersBuilder_RadialQuadrangle1D2D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -1131,14 +1131,14 @@ class StdMeshersDC_RadialQuadrangle1D2D(Mesh_Algorithm): hyp.SetFineness( fineness ) return hyp - pass # end of StdMeshersDC_RadialQuadrangle1D2D class + pass # end of StdMeshersBuilder_RadialQuadrangle1D2D class ## Defines a Use Existing Elements 1D algorithm # # It is created by calling smesh.Mesh.UseExisting1DElements(geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_UseExistingElements_1D(Mesh_Algorithm): +class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -1180,14 +1180,14 @@ class StdMeshersDC_UseExistingElements_1D(Mesh_Algorithm): hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups) return hyp - pass # end of StdMeshersDC_UseExistingElements_1D class + pass # end of StdMeshersBuilder_UseExistingElements_1D class ## Defines a Use Existing Elements 1D-2D algorithm # # It is created by calling smesh.Mesh.UseExisting2DElements(geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_UseExistingElements_1D2D(Mesh_Algorithm): +class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -1229,14 +1229,14 @@ class StdMeshersDC_UseExistingElements_1D2D(Mesh_Algorithm): hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups) return hyp - pass # end of StdMeshersDC_UseExistingElements_1D2D class + pass # end of StdMeshersBuilder_UseExistingElements_1D2D class ## Defines a Body Fitting 3D algorithm # # It is created by calling smesh.Mesh.BodyFitted(geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_Cartesian_3D(Mesh_Algorithm): +class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -1302,7 +1302,7 @@ class StdMeshersDC_Cartesian_3D(Mesh_Algorithm): self.hyp.SetSizeThreshold( sizeThreshold ) return self.hyp - pass # end of StdMeshersDC_Cartesian_3D class + pass # end of StdMeshersBuilder_Cartesian_3D class ## Defines a stub 1D algorithm, which enables "manual" creation of nodes and # segments usable by 2D algoritms @@ -1310,7 +1310,7 @@ class StdMeshersDC_Cartesian_3D(Mesh_Algorithm): # It is created by calling smesh.Mesh.UseExistingSegments(geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_UseExisting_1D(Mesh_Algorithm): +class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -1330,7 +1330,7 @@ class StdMeshersDC_UseExisting_1D(Mesh_Algorithm): self.Create(mesh, geom, self.algoType) pass - pass # end of StdMeshersDC_UseExisting_1D class + pass # end of StdMeshersBuilder_UseExisting_1D class ## Defines a stub 2D algorithm, which enables "manual" creation of nodes and # faces usable by 3D algoritms @@ -1338,7 +1338,7 @@ class StdMeshersDC_UseExisting_1D(Mesh_Algorithm): # It is created by calling smesh.Mesh.UseExistingFaces(geom=0) # # @ingroup l3_algos_basic -class StdMeshersDC_UseExisting_2D(Mesh_Algorithm): +class StdMeshersBuilder_UseExisting_2D(Mesh_Algorithm): ## name of the dynamic method in smesh.Mesh class # @internal @@ -1358,4 +1358,4 @@ class StdMeshersDC_UseExisting_2D(Mesh_Algorithm): self.Create(mesh, geom, self.algoType) pass - pass # end of StdMeshersDC_UseExisting_2D class + pass # end of StdMeshersBuilder_UseExisting_2D class diff --git a/src/SMESH_SWIG/__init__.py b/src/SMESH_SWIG/__init__.py new file mode 100644 index 000000000..630e0eda8 --- /dev/null +++ b/src/SMESH_SWIG/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# File : __init__.py +# Package : StdMeshers \ No newline at end of file diff --git a/src/SMESH_SWIG/ex01_cube2build.py b/src/SMESH_SWIG/ex01_cube2build.py index 25917942e..76b3a3840 100644 --- a/src/SMESH_SWIG/ex01_cube2build.py +++ b/src/SMESH_SWIG/ex01_cube2build.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -35,233 +41,233 @@ import smesh # Points # ------ -greatPoint111 = MakeVertex( 0, 0, 0) -greatPoint211 = MakeVertex(10, 0, 0) -greatPoint311 = MakeVertex(20, 0, 0) -greatPoint411 = MakeVertex(30, 0, 0) +greatPoint111 = geompy.MakeVertex( 0, 0, 0) +greatPoint211 = geompy.MakeVertex(10, 0, 0) +greatPoint311 = geompy.MakeVertex(20, 0, 0) +greatPoint411 = geompy.MakeVertex(30, 0, 0) -greatPoint121 = MakeVertex( 0, 10, 0) -greatPoint221 = MakeVertex(10, 10, 0) -greatPoint321 = MakeVertex(20, 10, 0) -greatPoint421 = MakeVertex(30, 10, 0) +greatPoint121 = geompy.MakeVertex( 0, 10, 0) +greatPoint221 = geompy.MakeVertex(10, 10, 0) +greatPoint321 = geompy.MakeVertex(20, 10, 0) +greatPoint421 = geompy.MakeVertex(30, 10, 0) -greatPoint112 = MakeVertex( 0, 0, 10) -greatPoint212 = MakeVertex(10, 0, 10) -greatPoint312 = MakeVertex(20, 0, 10) -greatPoint412 = MakeVertex(30, 0, 10) +greatPoint112 = geompy.MakeVertex( 0, 0, 10) +greatPoint212 = geompy.MakeVertex(10, 0, 10) +greatPoint312 = geompy.MakeVertex(20, 0, 10) +greatPoint412 = geompy.MakeVertex(30, 0, 10) -greatPoint122 = MakeVertex( 0, 10, 10) -greatPoint222 = MakeVertex(10, 10, 10) -greatPoint322 = MakeVertex(20, 10, 10) -greatPoint422 = MakeVertex(30, 10, 10) +greatPoint122 = geompy.MakeVertex( 0, 10, 10) +greatPoint222 = geompy.MakeVertex(10, 10, 10) +greatPoint322 = geompy.MakeVertex(20, 10, 10) +greatPoint422 = geompy.MakeVertex(30, 10, 10) -greatPoint113 = MakeVertex( 0, 0, 20) -greatPoint213 = MakeVertex(10, 0, 20) -greatPoint313 = MakeVertex(20, 0, 20) -greatPoint413 = MakeVertex(30, 0, 20) +greatPoint113 = geompy.MakeVertex( 0, 0, 20) +greatPoint213 = geompy.MakeVertex(10, 0, 20) +greatPoint313 = geompy.MakeVertex(20, 0, 20) +greatPoint413 = geompy.MakeVertex(30, 0, 20) -greatPoint123 = MakeVertex( 0, 10, 20) -greatPoint223 = MakeVertex(10, 10, 20) -greatPoint323 = MakeVertex(20, 10, 20) -greatPoint423 = MakeVertex(30, 10, 20) +greatPoint123 = geompy.MakeVertex( 0, 10, 20) +greatPoint223 = geompy.MakeVertex(10, 10, 20) +greatPoint323 = geompy.MakeVertex(20, 10, 20) +greatPoint423 = geompy.MakeVertex(30, 10, 20) -greatPoint114 = MakeVertex( 0, 0, 30) -greatPoint214 = MakeVertex(10, 0, 30) -greatPoint314 = MakeVertex(20, 0, 30) -greatPoint414 = MakeVertex(30, 0, 30) +greatPoint114 = geompy.MakeVertex( 0, 0, 30) +greatPoint214 = geompy.MakeVertex(10, 0, 30) +greatPoint314 = geompy.MakeVertex(20, 0, 30) +greatPoint414 = geompy.MakeVertex(30, 0, 30) -greatPoint124 = MakeVertex( 0, 10, 30) -greatPoint224 = MakeVertex(10, 10, 30) -greatPoint324 = MakeVertex(20, 10, 30) -greatPoint424 = MakeVertex(30, 10, 30) +greatPoint124 = geompy.MakeVertex( 0, 10, 30) +greatPoint224 = geompy.MakeVertex(10, 10, 30) +greatPoint324 = geompy.MakeVertex(20, 10, 30) +greatPoint424 = geompy.MakeVertex(30, 10, 30) smallPoint111 = greatPoint222 smallPoint211 = greatPoint322 -smallPoint121 = MakeVertex(10, 20, 10) -smallPoint221 = MakeVertex(20, 20, 10) +smallPoint121 = geompy.MakeVertex(10, 20, 10) +smallPoint221 = geompy.MakeVertex(20, 20, 10) smallPoint112 = greatPoint223 smallPoint212 = greatPoint323 -smallPoint122 = MakeVertex(10, 20, 20) -smallPoint222 = MakeVertex(20, 20, 20) +smallPoint122 = geompy.MakeVertex(10, 20, 20) +smallPoint222 = geompy.MakeVertex(20, 20, 20) # Edges # ----- -smallEdgeX11 = MakeEdge(smallPoint111, smallPoint211) -smallEdgeX21 = MakeEdge(smallPoint121, smallPoint221) -smallEdgeX12 = MakeEdge(smallPoint112, smallPoint212) -smallEdgeX22 = MakeEdge(smallPoint122, smallPoint222) - -smallEdgeY11 = MakeEdge(smallPoint111, smallPoint121) -smallEdgeY21 = MakeEdge(smallPoint211, smallPoint221) -smallEdgeY12 = MakeEdge(smallPoint112, smallPoint122) -smallEdgeY22 = MakeEdge(smallPoint212, smallPoint222) - -smallEdgeZ11 = MakeEdge(smallPoint111, smallPoint112) -smallEdgeZ21 = MakeEdge(smallPoint211, smallPoint212) -smallEdgeZ12 = MakeEdge(smallPoint121, smallPoint122) -smallEdgeZ22 = MakeEdge(smallPoint221, smallPoint222) - - -greatEdgeX111 = MakeEdge(greatPoint111, greatPoint211) -greatEdgeX211 = MakeEdge(greatPoint211, greatPoint311) -greatEdgeX311 = MakeEdge(greatPoint311, greatPoint411) -greatEdgeX121 = MakeEdge(greatPoint121, greatPoint221) -greatEdgeX221 = MakeEdge(greatPoint221, greatPoint321) -greatEdgeX321 = MakeEdge(greatPoint321, greatPoint421) - -greatEdgeX112 = MakeEdge(greatPoint112, greatPoint212) -greatEdgeX212 = MakeEdge(greatPoint212, greatPoint312) -greatEdgeX312 = MakeEdge(greatPoint312, greatPoint412) -greatEdgeX122 = MakeEdge(greatPoint122, greatPoint222) +smallEdgeX11 = geompy.MakeEdge(smallPoint111, smallPoint211) +smallEdgeX21 = geompy.MakeEdge(smallPoint121, smallPoint221) +smallEdgeX12 = geompy.MakeEdge(smallPoint112, smallPoint212) +smallEdgeX22 = geompy.MakeEdge(smallPoint122, smallPoint222) + +smallEdgeY11 = geompy.MakeEdge(smallPoint111, smallPoint121) +smallEdgeY21 = geompy.MakeEdge(smallPoint211, smallPoint221) +smallEdgeY12 = geompy.MakeEdge(smallPoint112, smallPoint122) +smallEdgeY22 = geompy.MakeEdge(smallPoint212, smallPoint222) + +smallEdgeZ11 = geompy.MakeEdge(smallPoint111, smallPoint112) +smallEdgeZ21 = geompy.MakeEdge(smallPoint211, smallPoint212) +smallEdgeZ12 = geompy.MakeEdge(smallPoint121, smallPoint122) +smallEdgeZ22 = geompy.MakeEdge(smallPoint221, smallPoint222) + + +greatEdgeX111 = geompy.MakeEdge(greatPoint111, greatPoint211) +greatEdgeX211 = geompy.MakeEdge(greatPoint211, greatPoint311) +greatEdgeX311 = geompy.MakeEdge(greatPoint311, greatPoint411) +greatEdgeX121 = geompy.MakeEdge(greatPoint121, greatPoint221) +greatEdgeX221 = geompy.MakeEdge(greatPoint221, greatPoint321) +greatEdgeX321 = geompy.MakeEdge(greatPoint321, greatPoint421) + +greatEdgeX112 = geompy.MakeEdge(greatPoint112, greatPoint212) +greatEdgeX212 = geompy.MakeEdge(greatPoint212, greatPoint312) +greatEdgeX312 = geompy.MakeEdge(greatPoint312, greatPoint412) +greatEdgeX122 = geompy.MakeEdge(greatPoint122, greatPoint222) greatEdgeX222 = smallEdgeX11 -greatEdgeX322 = MakeEdge(greatPoint322, greatPoint422) +greatEdgeX322 = geompy.MakeEdge(greatPoint322, greatPoint422) -greatEdgeX113 = MakeEdge(greatPoint113, greatPoint213) -greatEdgeX213 = MakeEdge(greatPoint213, greatPoint313) -greatEdgeX313 = MakeEdge(greatPoint313, greatPoint413) -greatEdgeX123 = MakeEdge(greatPoint123, greatPoint223) +greatEdgeX113 = geompy.MakeEdge(greatPoint113, greatPoint213) +greatEdgeX213 = geompy.MakeEdge(greatPoint213, greatPoint313) +greatEdgeX313 = geompy.MakeEdge(greatPoint313, greatPoint413) +greatEdgeX123 = geompy.MakeEdge(greatPoint123, greatPoint223) greatEdgeX223 = smallEdgeX12 -greatEdgeX323 = MakeEdge(greatPoint323, greatPoint423) - -greatEdgeX114 = MakeEdge(greatPoint114, greatPoint214) -greatEdgeX214 = MakeEdge(greatPoint214, greatPoint314) -greatEdgeX314 = MakeEdge(greatPoint314, greatPoint414) -greatEdgeX124 = MakeEdge(greatPoint124, greatPoint224) -greatEdgeX224 = MakeEdge(greatPoint224, greatPoint324) -greatEdgeX324 = MakeEdge(greatPoint324, greatPoint424) - -greatEdgeY11 = MakeEdge(greatPoint111, greatPoint121) -greatEdgeY21 = MakeEdge(greatPoint211, greatPoint221) -greatEdgeY31 = MakeEdge(greatPoint311, greatPoint321) -greatEdgeY41 = MakeEdge(greatPoint411, greatPoint421) - -greatEdgeY12 = MakeEdge(greatPoint112, greatPoint122) -greatEdgeY22 = MakeEdge(greatPoint212, greatPoint222) -greatEdgeY32 = MakeEdge(greatPoint312, greatPoint322) -greatEdgeY42 = MakeEdge(greatPoint412, greatPoint422) - -greatEdgeY13 = MakeEdge(greatPoint113, greatPoint123) -greatEdgeY23 = MakeEdge(greatPoint213, greatPoint223) -greatEdgeY33 = MakeEdge(greatPoint313, greatPoint323) -greatEdgeY43 = MakeEdge(greatPoint413, greatPoint423) - -greatEdgeY14 = MakeEdge(greatPoint114, greatPoint124) -greatEdgeY24 = MakeEdge(greatPoint214, greatPoint224) -greatEdgeY34 = MakeEdge(greatPoint314, greatPoint324) -greatEdgeY44 = MakeEdge(greatPoint414, greatPoint424) - -greatEdgeZ111 = MakeEdge(greatPoint111, greatPoint112) -greatEdgeZ211 = MakeEdge(greatPoint211, greatPoint212) -greatEdgeZ311 = MakeEdge(greatPoint311, greatPoint312) -greatEdgeZ411 = MakeEdge(greatPoint411, greatPoint412) - -greatEdgeZ121 = MakeEdge(greatPoint121, greatPoint122) -greatEdgeZ221 = MakeEdge(greatPoint221, greatPoint222) -greatEdgeZ321 = MakeEdge(greatPoint321, greatPoint322) -greatEdgeZ421 = MakeEdge(greatPoint421, greatPoint422) - -greatEdgeZ112 = MakeEdge(greatPoint112, greatPoint113) -greatEdgeZ212 = MakeEdge(greatPoint212, greatPoint213) -greatEdgeZ312 = MakeEdge(greatPoint312, greatPoint313) -greatEdgeZ412 = MakeEdge(greatPoint412, greatPoint413) - -greatEdgeZ122 = MakeEdge(greatPoint122, greatPoint123) +greatEdgeX323 = geompy.MakeEdge(greatPoint323, greatPoint423) + +greatEdgeX114 = geompy.MakeEdge(greatPoint114, greatPoint214) +greatEdgeX214 = geompy.MakeEdge(greatPoint214, greatPoint314) +greatEdgeX314 = geompy.MakeEdge(greatPoint314, greatPoint414) +greatEdgeX124 = geompy.MakeEdge(greatPoint124, greatPoint224) +greatEdgeX224 = geompy.MakeEdge(greatPoint224, greatPoint324) +greatEdgeX324 = geompy.MakeEdge(greatPoint324, greatPoint424) + +greatEdgeY11 = geompy.MakeEdge(greatPoint111, greatPoint121) +greatEdgeY21 = geompy.MakeEdge(greatPoint211, greatPoint221) +greatEdgeY31 = geompy.MakeEdge(greatPoint311, greatPoint321) +greatEdgeY41 = geompy.MakeEdge(greatPoint411, greatPoint421) + +greatEdgeY12 = geompy.MakeEdge(greatPoint112, greatPoint122) +greatEdgeY22 = geompy.MakeEdge(greatPoint212, greatPoint222) +greatEdgeY32 = geompy.MakeEdge(greatPoint312, greatPoint322) +greatEdgeY42 = geompy.MakeEdge(greatPoint412, greatPoint422) + +greatEdgeY13 = geompy.MakeEdge(greatPoint113, greatPoint123) +greatEdgeY23 = geompy.MakeEdge(greatPoint213, greatPoint223) +greatEdgeY33 = geompy.MakeEdge(greatPoint313, greatPoint323) +greatEdgeY43 = geompy.MakeEdge(greatPoint413, greatPoint423) + +greatEdgeY14 = geompy.MakeEdge(greatPoint114, greatPoint124) +greatEdgeY24 = geompy.MakeEdge(greatPoint214, greatPoint224) +greatEdgeY34 = geompy.MakeEdge(greatPoint314, greatPoint324) +greatEdgeY44 = geompy.MakeEdge(greatPoint414, greatPoint424) + +greatEdgeZ111 = geompy.MakeEdge(greatPoint111, greatPoint112) +greatEdgeZ211 = geompy.MakeEdge(greatPoint211, greatPoint212) +greatEdgeZ311 = geompy.MakeEdge(greatPoint311, greatPoint312) +greatEdgeZ411 = geompy.MakeEdge(greatPoint411, greatPoint412) + +greatEdgeZ121 = geompy.MakeEdge(greatPoint121, greatPoint122) +greatEdgeZ221 = geompy.MakeEdge(greatPoint221, greatPoint222) +greatEdgeZ321 = geompy.MakeEdge(greatPoint321, greatPoint322) +greatEdgeZ421 = geompy.MakeEdge(greatPoint421, greatPoint422) + +greatEdgeZ112 = geompy.MakeEdge(greatPoint112, greatPoint113) +greatEdgeZ212 = geompy.MakeEdge(greatPoint212, greatPoint213) +greatEdgeZ312 = geompy.MakeEdge(greatPoint312, greatPoint313) +greatEdgeZ412 = geompy.MakeEdge(greatPoint412, greatPoint413) + +greatEdgeZ122 = geompy.MakeEdge(greatPoint122, greatPoint123) greatEdgeZ222 = smallEdgeZ11 greatEdgeZ322 = smallEdgeZ21 -greatEdgeZ422 = MakeEdge(greatPoint422, greatPoint423) +greatEdgeZ422 = geompy.MakeEdge(greatPoint422, greatPoint423) -greatEdgeZ113 = MakeEdge(greatPoint113, greatPoint114) -greatEdgeZ213 = MakeEdge(greatPoint213, greatPoint214) -greatEdgeZ313 = MakeEdge(greatPoint313, greatPoint314) -greatEdgeZ413 = MakeEdge(greatPoint413, greatPoint414) +greatEdgeZ113 = geompy.MakeEdge(greatPoint113, greatPoint114) +greatEdgeZ213 = geompy.MakeEdge(greatPoint213, greatPoint214) +greatEdgeZ313 = geompy.MakeEdge(greatPoint313, greatPoint314) +greatEdgeZ413 = geompy.MakeEdge(greatPoint413, greatPoint414) -greatEdgeZ123 = MakeEdge(greatPoint123, greatPoint124) -greatEdgeZ223 = MakeEdge(greatPoint223, greatPoint224) -greatEdgeZ323 = MakeEdge(greatPoint323, greatPoint324) -greatEdgeZ423 = MakeEdge(greatPoint423, greatPoint424) +greatEdgeZ123 = geompy.MakeEdge(greatPoint123, greatPoint124) +greatEdgeZ223 = geompy.MakeEdge(greatPoint223, greatPoint224) +greatEdgeZ323 = geompy.MakeEdge(greatPoint323, greatPoint324) +greatEdgeZ423 = geompy.MakeEdge(greatPoint423, greatPoint424) # Faces # ----- -smallFaceX1 = MakeQuad(smallEdgeY11, smallEdgeZ11, smallEdgeY12, smallEdgeZ12) -smallFaceX2 = MakeQuad(smallEdgeY21, smallEdgeZ21, smallEdgeY22, smallEdgeZ22) -smallFaceY1 = MakeQuad(smallEdgeX11, smallEdgeZ11, smallEdgeX12, smallEdgeZ21) -smallFaceY2 = MakeQuad(smallEdgeX21, smallEdgeZ12, smallEdgeX22, smallEdgeZ22) -smallFaceZ1 = MakeQuad(smallEdgeX11, smallEdgeY11, smallEdgeX21, smallEdgeY21) -smallFaceZ2 = MakeQuad(smallEdgeX12, smallEdgeY12, smallEdgeX22, smallEdgeY22) - - -greatFaceX11 = MakeQuad(greatEdgeY11, greatEdgeZ111, greatEdgeY12, greatEdgeZ121) -greatFaceX21 = MakeQuad(greatEdgeY21, greatEdgeZ211, greatEdgeY22, greatEdgeZ221) -greatFaceX31 = MakeQuad(greatEdgeY31, greatEdgeZ311, greatEdgeY32, greatEdgeZ321) -greatFaceX41 = MakeQuad(greatEdgeY41, greatEdgeZ411, greatEdgeY42, greatEdgeZ421) - -greatFaceX12 = MakeQuad(greatEdgeY12, greatEdgeZ112, greatEdgeY13, greatEdgeZ122) -greatFaceX22 = MakeQuad(greatEdgeY22, greatEdgeZ212, greatEdgeY23, greatEdgeZ222) -greatFaceX32 = MakeQuad(greatEdgeY32, greatEdgeZ312, greatEdgeY33, greatEdgeZ322) -greatFaceX42 = MakeQuad(greatEdgeY42, greatEdgeZ412, greatEdgeY43, greatEdgeZ422) - -greatFaceX13 = MakeQuad(greatEdgeY13, greatEdgeZ113, greatEdgeY14, greatEdgeZ123) -greatFaceX23 = MakeQuad(greatEdgeY23, greatEdgeZ213, greatEdgeY24, greatEdgeZ223) -greatFaceX33 = MakeQuad(greatEdgeY33, greatEdgeZ313, greatEdgeY34, greatEdgeZ323) -greatFaceX43 = MakeQuad(greatEdgeY43, greatEdgeZ413, greatEdgeY44, greatEdgeZ423) - -greatFaceY111 = MakeQuad(greatEdgeX111, greatEdgeZ111, greatEdgeX112, greatEdgeZ211) -greatFaceY211 = MakeQuad(greatEdgeX211, greatEdgeZ211, greatEdgeX212, greatEdgeZ311) -greatFaceY311 = MakeQuad(greatEdgeX311, greatEdgeZ311, greatEdgeX312, greatEdgeZ411) -greatFaceY121 = MakeQuad(greatEdgeX121, greatEdgeZ121, greatEdgeX122, greatEdgeZ221) -greatFaceY221 = MakeQuad(greatEdgeX221, greatEdgeZ221, greatEdgeX222, greatEdgeZ321) -greatFaceY321 = MakeQuad(greatEdgeX321, greatEdgeZ321, greatEdgeX322, greatEdgeZ421) - -greatFaceY112 = MakeQuad(greatEdgeX112, greatEdgeZ112, greatEdgeX113, greatEdgeZ212) -greatFaceY212 = MakeQuad(greatEdgeX212, greatEdgeZ212, greatEdgeX213, greatEdgeZ312) -greatFaceY312 = MakeQuad(greatEdgeX312, greatEdgeZ312, greatEdgeX313, greatEdgeZ412) -greatFaceY122 = MakeQuad(greatEdgeX122, greatEdgeZ122, greatEdgeX123, greatEdgeZ222) +smallFaceX1 = geompy.MakeQuad(smallEdgeY11, smallEdgeZ11, smallEdgeY12, smallEdgeZ12) +smallFaceX2 = geompy.MakeQuad(smallEdgeY21, smallEdgeZ21, smallEdgeY22, smallEdgeZ22) +smallFaceY1 = geompy.MakeQuad(smallEdgeX11, smallEdgeZ11, smallEdgeX12, smallEdgeZ21) +smallFaceY2 = geompy.MakeQuad(smallEdgeX21, smallEdgeZ12, smallEdgeX22, smallEdgeZ22) +smallFaceZ1 = geompy.MakeQuad(smallEdgeX11, smallEdgeY11, smallEdgeX21, smallEdgeY21) +smallFaceZ2 = geompy.MakeQuad(smallEdgeX12, smallEdgeY12, smallEdgeX22, smallEdgeY22) + + +greatFaceX11 = geompy.MakeQuad(greatEdgeY11, greatEdgeZ111, greatEdgeY12, greatEdgeZ121) +greatFaceX21 = geompy.MakeQuad(greatEdgeY21, greatEdgeZ211, greatEdgeY22, greatEdgeZ221) +greatFaceX31 = geompy.MakeQuad(greatEdgeY31, greatEdgeZ311, greatEdgeY32, greatEdgeZ321) +greatFaceX41 = geompy.MakeQuad(greatEdgeY41, greatEdgeZ411, greatEdgeY42, greatEdgeZ421) + +greatFaceX12 = geompy.MakeQuad(greatEdgeY12, greatEdgeZ112, greatEdgeY13, greatEdgeZ122) +greatFaceX22 = geompy.MakeQuad(greatEdgeY22, greatEdgeZ212, greatEdgeY23, greatEdgeZ222) +greatFaceX32 = geompy.MakeQuad(greatEdgeY32, greatEdgeZ312, greatEdgeY33, greatEdgeZ322) +greatFaceX42 = geompy.MakeQuad(greatEdgeY42, greatEdgeZ412, greatEdgeY43, greatEdgeZ422) + +greatFaceX13 = geompy.MakeQuad(greatEdgeY13, greatEdgeZ113, greatEdgeY14, greatEdgeZ123) +greatFaceX23 = geompy.MakeQuad(greatEdgeY23, greatEdgeZ213, greatEdgeY24, greatEdgeZ223) +greatFaceX33 = geompy.MakeQuad(greatEdgeY33, greatEdgeZ313, greatEdgeY34, greatEdgeZ323) +greatFaceX43 = geompy.MakeQuad(greatEdgeY43, greatEdgeZ413, greatEdgeY44, greatEdgeZ423) + +greatFaceY111 = geompy.MakeQuad(greatEdgeX111, greatEdgeZ111, greatEdgeX112, greatEdgeZ211) +greatFaceY211 = geompy.MakeQuad(greatEdgeX211, greatEdgeZ211, greatEdgeX212, greatEdgeZ311) +greatFaceY311 = geompy.MakeQuad(greatEdgeX311, greatEdgeZ311, greatEdgeX312, greatEdgeZ411) +greatFaceY121 = geompy.MakeQuad(greatEdgeX121, greatEdgeZ121, greatEdgeX122, greatEdgeZ221) +greatFaceY221 = geompy.MakeQuad(greatEdgeX221, greatEdgeZ221, greatEdgeX222, greatEdgeZ321) +greatFaceY321 = geompy.MakeQuad(greatEdgeX321, greatEdgeZ321, greatEdgeX322, greatEdgeZ421) + +greatFaceY112 = geompy.MakeQuad(greatEdgeX112, greatEdgeZ112, greatEdgeX113, greatEdgeZ212) +greatFaceY212 = geompy.MakeQuad(greatEdgeX212, greatEdgeZ212, greatEdgeX213, greatEdgeZ312) +greatFaceY312 = geompy.MakeQuad(greatEdgeX312, greatEdgeZ312, greatEdgeX313, greatEdgeZ412) +greatFaceY122 = geompy.MakeQuad(greatEdgeX122, greatEdgeZ122, greatEdgeX123, greatEdgeZ222) greatFaceY222 = smallFaceY1 -greatFaceY322 = MakeQuad(greatEdgeX322, greatEdgeZ322, greatEdgeX323, greatEdgeZ422) +greatFaceY322 = geompy.MakeQuad(greatEdgeX322, greatEdgeZ322, greatEdgeX323, greatEdgeZ422) -greatFaceY113 = MakeQuad(greatEdgeX113, greatEdgeZ113, greatEdgeX114, greatEdgeZ213) -greatFaceY213 = MakeQuad(greatEdgeX213, greatEdgeZ213, greatEdgeX214, greatEdgeZ313) -greatFaceY313 = MakeQuad(greatEdgeX313, greatEdgeZ313, greatEdgeX314, greatEdgeZ413) -greatFaceY123 = MakeQuad(greatEdgeX123, greatEdgeZ123, greatEdgeX124, greatEdgeZ223) -greatFaceY223 = MakeQuad(greatEdgeX223, greatEdgeZ223, greatEdgeX224, greatEdgeZ323) -greatFaceY323 = MakeQuad(greatEdgeX323, greatEdgeZ323, greatEdgeX324, greatEdgeZ423) +greatFaceY113 = geompy.MakeQuad(greatEdgeX113, greatEdgeZ113, greatEdgeX114, greatEdgeZ213) +greatFaceY213 = geompy.MakeQuad(greatEdgeX213, greatEdgeZ213, greatEdgeX214, greatEdgeZ313) +greatFaceY313 = geompy.MakeQuad(greatEdgeX313, greatEdgeZ313, greatEdgeX314, greatEdgeZ413) +greatFaceY123 = geompy.MakeQuad(greatEdgeX123, greatEdgeZ123, greatEdgeX124, greatEdgeZ223) +greatFaceY223 = geompy.MakeQuad(greatEdgeX223, greatEdgeZ223, greatEdgeX224, greatEdgeZ323) +greatFaceY323 = geompy.MakeQuad(greatEdgeX323, greatEdgeZ323, greatEdgeX324, greatEdgeZ423) -greatFaceZ11 = MakeQuad(greatEdgeX111, greatEdgeY11, greatEdgeX121, greatEdgeY21) -greatFaceZ21 = MakeQuad(greatEdgeX211, greatEdgeY21, greatEdgeX221, greatEdgeY31) -greatFaceZ31 = MakeQuad(greatEdgeX311, greatEdgeY31, greatEdgeX321, greatEdgeY41) +greatFaceZ11 = geompy.MakeQuad(greatEdgeX111, greatEdgeY11, greatEdgeX121, greatEdgeY21) +greatFaceZ21 = geompy.MakeQuad(greatEdgeX211, greatEdgeY21, greatEdgeX221, greatEdgeY31) +greatFaceZ31 = geompy.MakeQuad(greatEdgeX311, greatEdgeY31, greatEdgeX321, greatEdgeY41) -greatFaceZ12 = MakeQuad(greatEdgeX112, greatEdgeY12, greatEdgeX122, greatEdgeY22) -greatFaceZ22 = MakeQuad(greatEdgeX212, greatEdgeY22, greatEdgeX222, greatEdgeY32) -greatFaceZ32 = MakeQuad(greatEdgeX312, greatEdgeY32, greatEdgeX322, greatEdgeY42) +greatFaceZ12 = geompy.MakeQuad(greatEdgeX112, greatEdgeY12, greatEdgeX122, greatEdgeY22) +greatFaceZ22 = geompy.MakeQuad(greatEdgeX212, greatEdgeY22, greatEdgeX222, greatEdgeY32) +greatFaceZ32 = geompy.MakeQuad(greatEdgeX312, greatEdgeY32, greatEdgeX322, greatEdgeY42) -greatFaceZ13 = MakeQuad(greatEdgeX113, greatEdgeY13, greatEdgeX123, greatEdgeY23) -greatFaceZ23 = MakeQuad(greatEdgeX213, greatEdgeY23, greatEdgeX223, greatEdgeY33) -greatFaceZ33 = MakeQuad(greatEdgeX313, greatEdgeY33, greatEdgeX323, greatEdgeY43) +greatFaceZ13 = geompy.MakeQuad(greatEdgeX113, greatEdgeY13, greatEdgeX123, greatEdgeY23) +greatFaceZ23 = geompy.MakeQuad(greatEdgeX213, greatEdgeY23, greatEdgeX223, greatEdgeY33) +greatFaceZ33 = geompy.MakeQuad(greatEdgeX313, greatEdgeY33, greatEdgeX323, greatEdgeY43) -greatFaceZ14 = MakeQuad(greatEdgeX114, greatEdgeY14, greatEdgeX124, greatEdgeY24) -greatFaceZ24 = MakeQuad(greatEdgeX214, greatEdgeY24, greatEdgeX224, greatEdgeY34) -greatFaceZ34 = MakeQuad(greatEdgeX314, greatEdgeY34, greatEdgeX324, greatEdgeY44) +greatFaceZ14 = geompy.MakeQuad(greatEdgeX114, greatEdgeY14, greatEdgeX124, greatEdgeY24) +greatFaceZ24 = geompy.MakeQuad(greatEdgeX214, greatEdgeY24, greatEdgeX224, greatEdgeY34) +greatFaceZ34 = geompy.MakeQuad(greatEdgeX314, greatEdgeY34, greatEdgeX324, greatEdgeY44) # Solids # ------ -smallBlock = MakeHexa(smallFaceX1, smallFaceX2, smallFaceY1, smallFaceY2, smallFaceZ1, smallFaceZ2) +smallBlock = geompy.MakeHexa(smallFaceX1, smallFaceX2, smallFaceY1, smallFaceY2, smallFaceZ1, smallFaceZ2) -greatBlock11 = MakeHexa(greatFaceX11, greatFaceX21, greatFaceY111, greatFaceY121, greatFaceZ11, greatFaceZ12) -greatBlock21 = MakeHexa(greatFaceX21, greatFaceX31, greatFaceY211, greatFaceY221, greatFaceZ21, greatFaceZ22) -greatBlock31 = MakeHexa(greatFaceX31, greatFaceX41, greatFaceY311, greatFaceY321, greatFaceZ31, greatFaceZ32) +greatBlock11 = geompy.MakeHexa(greatFaceX11, greatFaceX21, greatFaceY111, greatFaceY121, greatFaceZ11, greatFaceZ12) +greatBlock21 = geompy.MakeHexa(greatFaceX21, greatFaceX31, greatFaceY211, greatFaceY221, greatFaceZ21, greatFaceZ22) +greatBlock31 = geompy.MakeHexa(greatFaceX31, greatFaceX41, greatFaceY311, greatFaceY321, greatFaceZ31, greatFaceZ32) -greatBlock12 = MakeHexa(greatFaceX12, greatFaceX22, greatFaceY112, greatFaceY122, greatFaceZ12, greatFaceZ13) -greatBlock22 = MakeHexa(greatFaceX22, greatFaceX32, greatFaceY212, greatFaceY222, greatFaceZ22, greatFaceZ23) -greatBlock32 = MakeHexa(greatFaceX32, greatFaceX42, greatFaceY312, greatFaceY322, greatFaceZ32, greatFaceZ33) +greatBlock12 = geompy.MakeHexa(greatFaceX12, greatFaceX22, greatFaceY112, greatFaceY122, greatFaceZ12, greatFaceZ13) +greatBlock22 = geompy.MakeHexa(greatFaceX22, greatFaceX32, greatFaceY212, greatFaceY222, greatFaceZ22, greatFaceZ23) +greatBlock32 = geompy.MakeHexa(greatFaceX32, greatFaceX42, greatFaceY312, greatFaceY322, greatFaceZ32, greatFaceZ33) -greatBlock13 = MakeHexa(greatFaceX13, greatFaceX23, greatFaceY113, greatFaceY123, greatFaceZ13, greatFaceZ14) -greatBlock23 = MakeHexa(greatFaceX23, greatFaceX33, greatFaceY213, greatFaceY223, greatFaceZ23, greatFaceZ24) -greatBlock33 = MakeHexa(greatFaceX33, greatFaceX43, greatFaceY313, greatFaceY323, greatFaceZ33, greatFaceZ34) +greatBlock13 = geompy.MakeHexa(greatFaceX13, greatFaceX23, greatFaceY113, greatFaceY123, greatFaceZ13, greatFaceZ14) +greatBlock23 = geompy.MakeHexa(greatFaceX23, greatFaceX33, greatFaceY213, greatFaceY223, greatFaceZ23, greatFaceZ24) +greatBlock33 = geompy.MakeHexa(greatFaceX33, greatFaceX43, greatFaceY313, greatFaceY323, greatFaceZ33, greatFaceZ34) # Compound # -------- @@ -278,18 +284,16 @@ c_l.append(greatBlock13) c_l.append(greatBlock23) c_l.append(greatBlock33) -piece = MakeCompound(c_l) +piece = geompy.MakeCompound(c_l) # Add in study # ------------ -piece_id = addToStudy(piece, "ex01_cube2build") +piece_id = geompy.addToStudy(piece, "ex01_cube2build") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create hexahedrical mesh on piece # --------------------------------- diff --git a/src/SMESH_SWIG/ex02_cube2primitive.py b/src/SMESH_SWIG/ex02_cube2primitive.py index 4f13c7f9d..e064c2ec7 100644 --- a/src/SMESH_SWIG/ex02_cube2primitive.py +++ b/src/SMESH_SWIG/ex02_cube2primitive.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -44,33 +50,33 @@ arete = 10 # Points # ------ -blockPoint111 = MakeVertex(ox , oy, oz) -blockPoint211 = MakeVertex(ox+arete, oy, oz) -blockPoint112 = MakeVertex(ox , oy, oz+arete) -blockPoint212 = MakeVertex(ox+arete, oy, oz+arete) +blockPoint111 = geompy.MakeVertex(ox , oy, oz) +blockPoint211 = geompy.MakeVertex(ox+arete, oy, oz) +blockPoint112 = geompy.MakeVertex(ox , oy, oz+arete) +blockPoint212 = geompy.MakeVertex(ox+arete, oy, oz+arete) # Face and solid # -------------- -blockFace1 = MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112) +blockFace1 = geompy.MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112) -blockSolid11 = MakePrismVecH(blockFace1, MakeVectorDXDYDZ(0, 1, 0), arete) +blockSolid11 = geompy.MakePrismVecH(blockFace1, geompy.MakeVectorDXDYDZ(0, 1, 0), arete) # Translations # ------------ -blockSolid21 = MakeTranslation(blockSolid11, arete, 0, 0) -blockSolid31 = MakeTranslation(blockSolid21, arete, 0, 0) +blockSolid21 = geompy.MakeTranslation(blockSolid11, arete, 0, 0) +blockSolid31 = geompy.MakeTranslation(blockSolid21, arete, 0, 0) -blockSolid12 = MakeTranslation(blockSolid11, 0, 0, arete) -blockSolid22 = MakeTranslation(blockSolid12, arete, 0, 0) -blockSolid32 = MakeTranslation(blockSolid22, arete, 0, 0) +blockSolid12 = geompy.MakeTranslation(blockSolid11, 0, 0, arete) +blockSolid22 = geompy.MakeTranslation(blockSolid12, arete, 0, 0) +blockSolid32 = geompy.MakeTranslation(blockSolid22, arete, 0, 0) -blockSolid13 = MakeTranslation(blockSolid12, 0, 0, arete) -blockSolid23 = MakeTranslation(blockSolid13, arete, 0, 0) -blockSolid33 = MakeTranslation(blockSolid23, arete, 0, 0) +blockSolid13 = geompy.MakeTranslation(blockSolid12, 0, 0, arete) +blockSolid23 = geompy.MakeTranslation(blockSolid13, arete, 0, 0) +blockSolid33 = geompy.MakeTranslation(blockSolid23, arete, 0, 0) -blockSolid111 = MakeTranslation(blockSolid22, 0, arete, 0) +blockSolid111 = geompy.MakeTranslation(blockSolid22, 0, arete, 0) # Compound and glue # ----------------- @@ -87,20 +93,18 @@ c_l.append(blockSolid23) c_l.append(blockSolid33) c_l.append(blockSolid111) -c_cpd = MakeCompound(c_l) +c_cpd = geompy.MakeCompound(c_l) -piece = MakeGlueFaces(c_cpd, 1.e-5) +piece = geompy.MakeGlueFaces(c_cpd, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex02_cube2primitive") +piece_id = geompy.addToStudy(piece, "ex02_cube2primitive") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create hexahedrical mesh on piece # --------------------------------- diff --git a/src/SMESH_SWIG/ex03_cube2partition.py b/src/SMESH_SWIG/ex03_cube2partition.py index 5832c2eeb..ea1c24cf4 100644 --- a/src/SMESH_SWIG/ex03_cube2partition.py +++ b/src/SMESH_SWIG/ex03_cube2partition.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -49,45 +55,43 @@ g_trim = 1000 v_arete2 = g_arete*2 v_arete3 = g_arete*3 -v_1 = MakeVertex(g_ox , g_oy , g_oz ) -v_2 = MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3) +v_1 = geompy.MakeVertex(g_ox , g_oy , g_oz ) +v_2 = geompy.MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3) -v_3 = MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete ) -v_4 = MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2) +v_3 = geompy.MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete ) +v_4 = geompy.MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2) # Solids # ------ -s_base = MakeBoxTwoPnt(v_1, v_2) -s_haut = MakeBoxTwoPnt(v_3, v_4) +s_base = geompy.MakeBoxTwoPnt(v_1, v_2) +s_haut = geompy.MakeBoxTwoPnt(v_3, v_4) # Partition # --------- -p_dir1 = MakeVectorDXDYDZ(1, 0, 0) -p_dir2 = MakeVectorDXDYDZ(0, 0, 1) -p_dir3 = MakeVectorDXDYDZ(0, 1, 0) +p_dir1 = geompy.MakeVectorDXDYDZ(1, 0, 0) +p_dir2 = geompy.MakeVectorDXDYDZ(0, 0, 1) +p_dir3 = geompy.MakeVectorDXDYDZ(0, 1, 0) p_tools = [] -p_tools.append(MakePlane(v_3, p_dir1, g_trim)) -p_tools.append(MakePlane(v_4, p_dir1, g_trim)) -p_tools.append(MakePlane(v_3, p_dir2, g_trim)) -p_tools.append(MakePlane(v_4, p_dir2, g_trim)) -p_tools.append(MakePlane(v_3, p_dir3, g_trim)) +p_tools.append(geompy.MakePlane(v_3, p_dir1, g_trim)) +p_tools.append(geompy.MakePlane(v_4, p_dir1, g_trim)) +p_tools.append(geompy.MakePlane(v_3, p_dir2, g_trim)) +p_tools.append(geompy.MakePlane(v_4, p_dir2, g_trim)) +p_tools.append(geompy.MakePlane(v_3, p_dir3, g_trim)) -piece = MakePartition([s_base, s_haut], p_tools, [], [], ShapeType["SOLID"]) +piece = geompy.MakePartition([s_base, s_haut], p_tools, [], [], geompy.ShapeType["SOLID"]) # Study # ----- -piece_id = addToStudy(piece, "ex03_cube2partition") +piece_id = geompy.addToStudy(piece, "ex03_cube2partition") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create hexahedrical mesh on piece # --------------------------------- diff --git a/src/SMESH_SWIG/ex04_cube5tetraHexa.py b/src/SMESH_SWIG/ex04_cube5tetraHexa.py index 5660692bb..fae90efe0 100644 --- a/src/SMESH_SWIG/ex04_cube5tetraHexa.py +++ b/src/SMESH_SWIG/ex04_cube5tetraHexa.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -45,30 +51,28 @@ arete3 = arete*3 # Solids # ------ -box_tetra1 = MakeBox(arete0, arete0, 0, arete1, arete1, arete) +box_tetra1 = geompy.MakeBox(arete0, arete0, 0, arete1, arete1, arete) -box_ijk1 = MakeBox(arete1, arete0, 0, arete2, arete1, arete) +box_ijk1 = geompy.MakeBox(arete1, arete0, 0, arete2, arete1, arete) -box_hexa = MakeBox(arete1, arete1, 0, arete2, arete2, arete) +box_hexa = geompy.MakeBox(arete1, arete1, 0, arete2, arete2, arete) -box_ijk2 = MakeBox(arete2, arete1, 0, arete3, arete2, arete) +box_ijk2 = geompy.MakeBox(arete2, arete1, 0, arete3, arete2, arete) -box_tetra2 = MakeBox(arete2, arete2, 0, arete3 ,arete3, arete) +box_tetra2 = geompy.MakeBox(arete2, arete2, 0, arete3 ,arete3, arete) # Piece # ----- -piece_cpd = MakeCompound([box_tetra1, box_ijk1, box_hexa, box_ijk2, box_tetra2]) +piece_cpd = geompy.MakeCompound([box_tetra1, box_ijk1, box_hexa, box_ijk2, box_tetra2]) -piece = MakeGlueFaces(piece_cpd, 1e-4) +piece = geompy.MakeGlueFaces(piece_cpd, 1e-4) -piece_id = addToStudy(piece, "ex04_cube5tetraHexa") +piece_id = geompy.addToStudy(piece, "ex04_cube5tetraHexa") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ @@ -86,8 +90,8 @@ mixed.Hexahedron() # ---------------------- def localMesh(b, hyp): - box = GetInPlace(piece, b) - faces = SubShapeAll(box, ShapeType["FACE"]) + box = geompy.GetInPlace(piece, b) + faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) i = 0 n = len(faces) @@ -99,7 +103,7 @@ def localMesh(b, hyp): algo.LengthFromEdges() i = i + 1 - algo = mixed.Tetrahedron(smesh.NETGEN, box) + algo = mixed.Tetrahedron(smeshBuilder.NETGEN, box) algo.MaxElementVolume(400) localMesh(box_tetra1, 1) diff --git a/src/SMESH_SWIG/ex05_hole1build.py b/src/SMESH_SWIG/ex05_hole1build.py index 89e5acc2a..1c0493df8 100644 --- a/src/SMESH_SWIG/ex05_hole1build.py +++ b/src/SMESH_SWIG/ex05_hole1build.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import math @@ -50,10 +56,10 @@ rayon = 10 # Points # ------ -basePoint111 = MakeVertex(ox , oy, oz) -basePoint211 = MakeVertex(ox+longueur, oy, oz) -basePoint112 = MakeVertex(ox , oy, oz+largeur) -basePoint212 = MakeVertex(ox+longueur, oy, oz+largeur) +basePoint111 = geompy.MakeVertex(ox , oy, oz) +basePoint211 = geompy.MakeVertex(ox+longueur, oy, oz) +basePoint112 = geompy.MakeVertex(ox , oy, oz+largeur) +basePoint212 = geompy.MakeVertex(ox+longueur, oy, oz+largeur) cx = ox+longueur/2 cy = oy @@ -64,46 +70,46 @@ ll = ll*ll dx = rayon/math.sqrt(1+ll) dz = rayon/math.sqrt(1+1/ll) -circlePoint1 = MakeVertex(cx-dx, cy, cz-dz) -circlePoint2 = MakeVertex(cx+dx, cy, cz-dz) -circlePoint3 = MakeVertex(cx+dx, cy, cz+dz) -circlePoint4 = MakeVertex(cx-dx, cy, cz+dz) +circlePoint1 = geompy.MakeVertex(cx-dx, cy, cz-dz) +circlePoint2 = geompy.MakeVertex(cx+dx, cy, cz-dz) +circlePoint3 = geompy.MakeVertex(cx+dx, cy, cz+dz) +circlePoint4 = geompy.MakeVertex(cx-dx, cy, cz+dz) # Edges # ----- -squareEdge1 = MakeEdge(basePoint111, basePoint211) -squareEdge2 = MakeEdge(basePoint211, basePoint212) -squareEdge3 = MakeEdge(basePoint212, basePoint112) -squareEdge4 = MakeEdge(basePoint112, basePoint111) +squareEdge1 = geompy.MakeEdge(basePoint111, basePoint211) +squareEdge2 = geompy.MakeEdge(basePoint211, basePoint212) +squareEdge3 = geompy.MakeEdge(basePoint212, basePoint112) +squareEdge4 = geompy.MakeEdge(basePoint112, basePoint111) -diagEdge1 = MakeEdge(basePoint111, circlePoint1) -diagEdge2 = MakeEdge(basePoint211, circlePoint2) -diagEdge3 = MakeEdge(basePoint212, circlePoint3) -diagEdge4 = MakeEdge(basePoint112, circlePoint4) +diagEdge1 = geompy.MakeEdge(basePoint111, circlePoint1) +diagEdge2 = geompy.MakeEdge(basePoint211, circlePoint2) +diagEdge3 = geompy.MakeEdge(basePoint212, circlePoint3) +diagEdge4 = geompy.MakeEdge(basePoint112, circlePoint4) -arcEdge1 = MakeArc(circlePoint1, MakeVertex(cx , cy, cz-rayon), circlePoint2) -arcEdge2 = MakeArc(circlePoint2, MakeVertex(cx+rayon, cy, cz ), circlePoint3) -arcEdge3 = MakeArc(circlePoint3, MakeVertex(cx , cy, cz+rayon), circlePoint4) -arcEdge4 = MakeArc(circlePoint4, MakeVertex(cx-rayon, cy, cz ), circlePoint1) +arcEdge1 = geompy.MakeArc(circlePoint1, geompy.MakeVertex(cx , cy, cz-rayon), circlePoint2) +arcEdge2 = geompy.MakeArc(circlePoint2, geompy.MakeVertex(cx+rayon, cy, cz ), circlePoint3) +arcEdge3 = geompy.MakeArc(circlePoint3, geompy.MakeVertex(cx , cy, cz+rayon), circlePoint4) +arcEdge4 = geompy.MakeArc(circlePoint4, geompy.MakeVertex(cx-rayon, cy, cz ), circlePoint1) # Faces # ----- -baseFace1 = MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1) -baseFace2 = MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2) -baseFace3 = MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3) -baseFace4 = MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4) +baseFace1 = geompy.MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1) +baseFace2 = geompy.MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2) +baseFace3 = geompy.MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3) +baseFace4 = geompy.MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4) # Solids # ------ -baseVector = MakeVectorDXDYDZ(0, 1, 0) +baseVector = geompy.MakeVectorDXDYDZ(0, 1, 0) -baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur) -baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur) -baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur) -baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur) +baseSolid1 = geompy.MakePrismVecH(baseFace1, baseVector, hauteur) +baseSolid2 = geompy.MakePrismVecH(baseFace2, baseVector, hauteur) +baseSolid3 = geompy.MakePrismVecH(baseFace3, baseVector, hauteur) +baseSolid4 = geompy.MakePrismVecH(baseFace4, baseVector, hauteur) # Compound # -------- @@ -114,19 +120,17 @@ c_l.append(baseSolid2) c_l.append(baseSolid3) c_l.append(baseSolid4) -c_cpd = MakeCompound(c_l) -piece = MakeGlueFaces(c_cpd, 1.e-5) +c_cpd = geompy.MakeCompound(c_l) +piece = geompy.MakeGlueFaces(c_cpd, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex05_hole1build") +piece_id = geompy.addToStudy(piece, "ex05_hole1build") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex06_hole1boolean.py b/src/SMESH_SWIG/ex06_hole1boolean.py index d78447641..7729e0379 100644 --- a/src/SMESH_SWIG/ex06_hole1boolean.py +++ b/src/SMESH_SWIG/ex06_hole1boolean.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -54,21 +60,21 @@ rayon = 10 def triangle(p1, p2, p3): l = [] - l.append(MakeEdge(p1, p2)) - l.append(MakeEdge(p2, p3)) - l.append(MakeEdge(p3, p1)) - w = MakeWire(l) - return MakeFace(w, 1) + l.append(geompy.MakeEdge(p1, p2)) + l.append(geompy.MakeEdge(p2, p3)) + l.append(geompy.MakeEdge(p3, p1)) + w = geompy.MakeWire(l) + return geompy.MakeFace(w, 1) # Points # ------ -basePoint111 = MakeVertex(ox-longueur1, oy, oz-largeur1) -basePoint211 = MakeVertex(ox+longueur2, oy, oz-largeur1) -basePoint112 = MakeVertex(ox-longueur1, oy, oz+largeur2) -basePoint212 = MakeVertex(ox+longueur2, oy, oz+largeur2) +basePoint111 = geompy.MakeVertex(ox-longueur1, oy, oz-largeur1) +basePoint211 = geompy.MakeVertex(ox+longueur2, oy, oz-largeur1) +basePoint112 = geompy.MakeVertex(ox-longueur1, oy, oz+largeur2) +basePoint212 = geompy.MakeVertex(ox+longueur2, oy, oz+largeur2) -holePoint = MakeVertex(ox, oy, oz) +holePoint = geompy.MakeVertex(ox, oy, oz) # Faces # ----- @@ -81,22 +87,22 @@ baseFace4 = triangle(basePoint112, basePoint111, holePoint) # Solids # ------ -baseVector = MakeVectorDXDYDZ(0, 1, 0) +baseVector = geompy.MakeVectorDXDYDZ(0, 1, 0) -baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur) -baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur) -baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur) -baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur) +baseSolid1 = geompy.MakePrismVecH(baseFace1, baseVector, hauteur) +baseSolid2 = geompy.MakePrismVecH(baseFace2, baseVector, hauteur) +baseSolid3 = geompy.MakePrismVecH(baseFace3, baseVector, hauteur) +baseSolid4 = geompy.MakePrismVecH(baseFace4, baseVector, hauteur) -holeSolid = MakeCylinder(holePoint, baseVector, rayon, hauteur) +holeSolid = geompy.MakeCylinder(holePoint, baseVector, rayon, hauteur) # Boolean operations # ------------------ -baseHexa1 = MakeCut(baseSolid1, holeSolid) -baseHexa2 = MakeCut(baseSolid2, holeSolid) -baseHexa3 = MakeCut(baseSolid3, holeSolid) -baseHexa4 = MakeCut(baseSolid4, holeSolid) +baseHexa1 = geompy.MakeCut(baseSolid1, holeSolid) +baseHexa2 = geompy.MakeCut(baseSolid2, holeSolid) +baseHexa3 = geompy.MakeCut(baseSolid3, holeSolid) +baseHexa4 = geompy.MakeCut(baseSolid4, holeSolid) # Compound, glue and repair # ------------------------- @@ -107,20 +113,18 @@ c_l.append(baseHexa2) c_l.append(baseHexa3) c_l.append(baseHexa4) -c_cpd = MakeCompound(c_l) -c_glu = MakeGlueFaces(c_cpd, 1.e-5) -piece = RemoveExtraEdges(c_glu, doUnionFaces=True) +c_cpd = geompy.MakeCompound(c_l) +c_glu = geompy.MakeGlueFaces(c_cpd, 1.e-5) +piece = geompy.RemoveExtraEdges(c_glu, doUnionFaces=True) # Add in study # ------------ -piece_id = addToStudy(piece, "ex06_hole1boolean") +piece_id = geompy.addToStudy(piece, "ex06_hole1boolean") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ @@ -137,22 +141,22 @@ hexa.Hexahedron() # Create local hypothesis # ----------------------- -edge1 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz-largeur1)) +edge1 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox, oy, oz-largeur1)) algo1 = hexa.Segment(edge1) algo1.NumberOfSegments(3) algo1.Propagation() -edge2 = GetEdgeNearPoint(piece, MakeVertex(ox-longueur1, oy, oz)) +edge2 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox-longueur1, oy, oz)) algo2 = hexa.Segment(edge2) algo2.NumberOfSegments(5) algo2.Propagation() -edge3 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz+largeur2)) +edge3 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox, oy, oz+largeur2)) algo3 = hexa.Segment(edge3) algo3.NumberOfSegments(7) algo3.Propagation() -edge4 = GetEdgeNearPoint(piece, MakeVertex(ox+longueur2, oy, oz)) +edge4 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox+longueur2, oy, oz)) algo4 = hexa.Segment(edge4) algo4.NumberOfSegments(9) algo4.Propagation() diff --git a/src/SMESH_SWIG/ex07_hole1partition.py b/src/SMESH_SWIG/ex07_hole1partition.py index ae661e00b..d6ec2a23c 100644 --- a/src/SMESH_SWIG/ex07_hole1partition.py +++ b/src/SMESH_SWIG/ex07_hole1partition.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -50,41 +56,39 @@ g_trim = 1000 # Box # --- -b_boite = MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur, g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur) +b_boite = geompy.MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur, g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur) # Cylinder # -------- -c_axe = MakeVectorDXDYDZ(0, 1, 0) +c_axe = geompy.MakeVectorDXDYDZ(0, 1, 0) -c_cyl = MakeCylinder(MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2) +c_cyl = geompy.MakeCylinder(geompy.MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2) -c_piece = MakeCut(b_boite, c_cyl) +c_piece = geompy.MakeCut(b_boite, c_cyl) # Partition and reperation # ------------------------ -p_centre = MakeVertex(g_x, g_y, g_z) +p_centre = geompy.MakeVertex(g_x, g_y, g_z) p_tools = [] -p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim)) -p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim)) +p_tools.append(geompy.MakePlane(p_centre, geompy.MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim)) +p_tools.append(geompy.MakePlane(p_centre, geompy.MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim)) -p_part = MakePartition([c_piece], p_tools, [], [], ShapeType["SOLID"]) +p_part = geompy.MakePartition([c_piece], p_tools, [], [], geompy.ShapeType["SOLID"]) -p_blocs = RemoveExtraEdges(p_part, doUnionFaces=True) -piece = MakeGlueFaces(p_blocs, 1.e-5) +p_blocs = geompy.RemoveExtraEdges(p_part, doUnionFaces=True) +piece = geompy.MakeGlueFaces(p_blocs, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex07_hole1partition") +piece_id = geompy.addToStudy(piece, "ex07_hole1partition") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex08_hole2build.py b/src/SMESH_SWIG/ex08_hole2build.py index 726ca3dee..0c33f99a4 100644 --- a/src/SMESH_SWIG/ex08_hole2build.py +++ b/src/SMESH_SWIG/ex08_hole2build.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -50,74 +56,72 @@ rayon = 20 # Points # ------ -piecePoint1 = MakeVertex(ox , oy, oz) -piecePoint2 = MakeVertex(ox+longueur, oy, oz) -piecePoint3 = MakeVertex(ox+longueur, oy, oz+largeur) -piecePoint4 = MakeVertex(ox , oy, oz+largeur) +piecePoint1 = geompy.MakeVertex(ox , oy, oz) +piecePoint2 = geompy.MakeVertex(ox+longueur, oy, oz) +piecePoint3 = geompy.MakeVertex(ox+longueur, oy, oz+largeur) +piecePoint4 = geompy.MakeVertex(ox , oy, oz+largeur) cz = oz+largeur/2 -cylPoint1 = MakeVertex(ox+cylindre , oy, cz-rayon) -cylPoint2 = MakeVertex(ox+longueur-cylindre, oy, cz-rayon) -cylPoint3 = MakeVertex(ox+longueur-cylindre, oy, cz+rayon) -cylPoint4 = MakeVertex(ox+cylindre , oy, cz+rayon) +cylPoint1 = geompy.MakeVertex(ox+cylindre , oy, cz-rayon) +cylPoint2 = geompy.MakeVertex(ox+longueur-cylindre, oy, cz-rayon) +cylPoint3 = geompy.MakeVertex(ox+longueur-cylindre, oy, cz+rayon) +cylPoint4 = geompy.MakeVertex(ox+cylindre , oy, cz+rayon) # Edges # ----- -pieceEdge1 = MakeEdge(piecePoint1, piecePoint4) -pieceEdge2 = MakeEdge(piecePoint1, cylPoint1) -pieceEdge3 = MakeEdge(piecePoint4, cylPoint4) +pieceEdge1 = geompy.MakeEdge(piecePoint1, piecePoint4) +pieceEdge2 = geompy.MakeEdge(piecePoint1, cylPoint1) +pieceEdge3 = geompy.MakeEdge(piecePoint4, cylPoint4) -pieceEdge4 = MakeEdge(piecePoint2, piecePoint3) -pieceEdge5 = MakeEdge(piecePoint2, cylPoint2) -pieceEdge6 = MakeEdge(piecePoint3, cylPoint3) +pieceEdge4 = geompy.MakeEdge(piecePoint2, piecePoint3) +pieceEdge5 = geompy.MakeEdge(piecePoint2, cylPoint2) +pieceEdge6 = geompy.MakeEdge(piecePoint3, cylPoint3) -pieceEdge7 = MakeEdge(cylPoint1, cylPoint2) -pieceEdge8 = MakeEdge(cylPoint3, cylPoint4) +pieceEdge7 = geompy.MakeEdge(cylPoint1, cylPoint2) +pieceEdge8 = geompy.MakeEdge(cylPoint3, cylPoint4) -cylEdge1 = MakeArc(cylPoint1, MakeVertex(ox+cylindre-rayon , oy, cz), cylPoint4) -cylEdge2 = MakeArc(cylPoint1, MakeVertex(ox+cylindre+rayon , oy, cz), cylPoint4) -cylEdge3 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3) -cylEdge4 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3) +cylEdge1 = geompy.MakeArc(cylPoint1, geompy.MakeVertex(ox+cylindre-rayon , oy, cz), cylPoint4) +cylEdge2 = geompy.MakeArc(cylPoint1, geompy.MakeVertex(ox+cylindre+rayon , oy, cz), cylPoint4) +cylEdge3 = geompy.MakeArc(cylPoint2, geompy.MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3) +cylEdge4 = geompy.MakeArc(cylPoint2, geompy.MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3) # Faces # ----- -pieceFace1 = MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 ) -pieceFace2 = MakeQuad (pieceEdge1 , pieceEdge2 , cylEdge1 , pieceEdge3) -pieceFace3 = MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 ) -pieceFace4 = MakeQuad (pieceEdge4 , pieceEdge5 , cylEdge4 , pieceEdge6) -pieceFace5 = MakeQuad (pieceEdge7 , cylEdge3 , pieceEdge8, cylEdge2 ) +pieceFace1 = geompy.MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 ) +pieceFace2 = geompy.MakeQuad (pieceEdge1 , pieceEdge2 , cylEdge1 , pieceEdge3) +pieceFace3 = geompy.MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 ) +pieceFace4 = geompy.MakeQuad (pieceEdge4 , pieceEdge5 , cylEdge4 , pieceEdge6) +pieceFace5 = geompy.MakeQuad (pieceEdge7 , cylEdge3 , pieceEdge8, cylEdge2 ) # Solids # ------ -pieceVector = MakeVectorDXDYDZ(0, 1, 0) +pieceVector = geompy.MakeVectorDXDYDZ(0, 1, 0) -pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur) -pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur) -pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur) -pieceSolid4 = MakePrismVecH(pieceFace4, pieceVector, hauteur) -pieceSolid5 = MakePrismVecH(pieceFace5, pieceVector, hauteur) +pieceSolid1 = geompy.MakePrismVecH(pieceFace1, pieceVector, hauteur) +pieceSolid2 = geompy.MakePrismVecH(pieceFace2, pieceVector, hauteur) +pieceSolid3 = geompy.MakePrismVecH(pieceFace3, pieceVector, hauteur) +pieceSolid4 = geompy.MakePrismVecH(pieceFace4, pieceVector, hauteur) +pieceSolid5 = geompy.MakePrismVecH(pieceFace5, pieceVector, hauteur) # Compound and glue # ----------------- -c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3, pieceSolid4, pieceSolid5]) +c_cpd = geompy.MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3, pieceSolid4, pieceSolid5]) -piece = MakeGlueFaces(c_cpd, 1.e-5) +piece = geompy.MakeGlueFaces(c_cpd, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex08_hole2build") +piece_id = geompy.addToStudy(piece, "ex08_hole2build") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex09_grid4build.py b/src/SMESH_SWIG/ex09_grid4build.py index 04759a1d5..a015b75e2 100644 --- a/src/SMESH_SWIG/ex09_grid4build.py +++ b/src/SMESH_SWIG/ex09_grid4build.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import math @@ -52,75 +58,73 @@ r3 = demi*math.sqrt(3) # Points # ------ -piecePoint111 = MakeVertex(ox+rayon , oy, oz) -piecePoint211 = MakeVertex(ox+arete-rayon, oy, oz) -piecePoint112 = MakeVertex(ox , oy, oz+rayon) -piecePoint212 = MakeVertex(ox+arete , oy, oz+rayon) -piecePoint113 = MakeVertex(ox , oy, oz+arete-rayon) -piecePoint213 = MakeVertex(ox+arete , oy, oz+arete-rayon) -piecePoint114 = MakeVertex(ox+rayon , oy, oz+arete) -piecePoint214 = MakeVertex(ox+arete-rayon, oy, oz+arete) - -pieceCenter1 = MakeVertex(ox , oy, oz) -pieceCenter2 = MakeVertex(ox+arete , oy, oz) -pieceCenter3 = MakeVertex(ox , oy, oz+arete) -pieceCenter4 = MakeVertex(ox+arete , oy, oz+arete) - -piecePass1 = MakeVertex(ox+demi , oy, oz+r3) -piecePass2 = MakeVertex(ox+arete-demi , oy, oz+r3) -piecePass3 = MakeVertex(ox+arete-demi , oy, oz+arete-r3) -piecePass4 = MakeVertex(ox+demi , oy, oz+arete-r3) +piecePoint111 = geompy.MakeVertex(ox+rayon , oy, oz) +piecePoint211 = geompy.MakeVertex(ox+arete-rayon, oy, oz) +piecePoint112 = geompy.MakeVertex(ox , oy, oz+rayon) +piecePoint212 = geompy.MakeVertex(ox+arete , oy, oz+rayon) +piecePoint113 = geompy.MakeVertex(ox , oy, oz+arete-rayon) +piecePoint213 = geompy.MakeVertex(ox+arete , oy, oz+arete-rayon) +piecePoint114 = geompy.MakeVertex(ox+rayon , oy, oz+arete) +piecePoint214 = geompy.MakeVertex(ox+arete-rayon, oy, oz+arete) + +pieceCenter1 = geompy.MakeVertex(ox , oy, oz) +pieceCenter2 = geompy.MakeVertex(ox+arete , oy, oz) +pieceCenter3 = geompy.MakeVertex(ox , oy, oz+arete) +pieceCenter4 = geompy.MakeVertex(ox+arete , oy, oz+arete) + +piecePass1 = geompy.MakeVertex(ox+demi , oy, oz+r3) +piecePass2 = geompy.MakeVertex(ox+arete-demi , oy, oz+r3) +piecePass3 = geompy.MakeVertex(ox+arete-demi , oy, oz+arete-r3) +piecePass4 = geompy.MakeVertex(ox+demi , oy, oz+arete-r3) # Edges # ----- -pieceEdgeSquare1 = MakeEdge(piecePoint111, piecePoint211) -pieceEdgeSquare2 = MakeEdge(piecePoint114, piecePoint214) -pieceEdgeSquare3 = MakeEdge(piecePoint112, piecePoint113) -pieceEdgeSquare4 = MakeEdge(piecePoint212, piecePoint213) +pieceEdgeSquare1 = geompy.MakeEdge(piecePoint111, piecePoint211) +pieceEdgeSquare2 = geompy.MakeEdge(piecePoint114, piecePoint214) +pieceEdgeSquare3 = geompy.MakeEdge(piecePoint112, piecePoint113) +pieceEdgeSquare4 = geompy.MakeEdge(piecePoint212, piecePoint213) -pieceEdgeDiagonal1 = MakeEdge(piecePoint111, piecePoint213) -pieceEdgeDiagonal2 = MakeEdge(piecePoint112, piecePoint214) +pieceEdgeDiagonal1 = geompy.MakeEdge(piecePoint111, piecePoint213) +pieceEdgeDiagonal2 = geompy.MakeEdge(piecePoint112, piecePoint214) -pieceEdgeArc1 = MakeArc(piecePoint111, piecePass1, piecePoint112) -pieceEdgeArc2 = MakeArc(piecePoint211, piecePass2, piecePoint212) -pieceEdgeArc3 = MakeArc(piecePoint213, piecePass3, piecePoint214) -pieceEdgeArc4 = MakeArc(piecePoint113, piecePass4, piecePoint114) +pieceEdgeArc1 = geompy.MakeArc(piecePoint111, piecePass1, piecePoint112) +pieceEdgeArc2 = geompy.MakeArc(piecePoint211, piecePass2, piecePoint212) +pieceEdgeArc3 = geompy.MakeArc(piecePoint213, piecePass3, piecePoint214) +pieceEdgeArc4 = geompy.MakeArc(piecePoint113, piecePass4, piecePoint114) # Faces # ----- -pieceFace1 = MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1) -pieceFace2 = MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2) +pieceFace1 = geompy.MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1) +pieceFace2 = geompy.MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2) -pieceFace3 = MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2) +pieceFace3 = geompy.MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2) # Solids # ------ -pieceVector = MakeVectorDXDYDZ(0, 1, 0) +pieceVector = geompy.MakeVectorDXDYDZ(0, 1, 0) -pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur) -pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur) -pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur) +pieceSolid1 = geompy.MakePrismVecH(pieceFace1, pieceVector, hauteur) +pieceSolid2 = geompy.MakePrismVecH(pieceFace2, pieceVector, hauteur) +pieceSolid3 = geompy.MakePrismVecH(pieceFace3, pieceVector, hauteur) # Compound and glue # ----------------- -c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3]) +c_cpd = geompy.MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3]) -piece = MakeGlueFaces(c_cpd, 1.e-5) +piece = geompy.MakeGlueFaces(c_cpd, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex09_grid4build") +piece_id = geompy.addToStudy(piece, "ex09_grid4build") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex10_grid4geometry.py b/src/SMESH_SWIG/ex10_grid4geometry.py index ac9c0abf3..c743d40d4 100644 --- a/src/SMESH_SWIG/ex10_grid4geometry.py +++ b/src/SMESH_SWIG/ex10_grid4geometry.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -48,41 +54,39 @@ g_trim = 1000 # Box # --- -piecePoint = MakeVertex(ox, oy, oz) +piecePoint = geompy.MakeVertex(ox, oy, oz) -pieceBox = MakeBoxTwoPnt(piecePoint, MakeVertex(ox+arete, oy+hauteur, oz+arete)) +pieceBox = geompy.MakeBoxTwoPnt(piecePoint, geompy.MakeVertex(ox+arete, oy+hauteur, oz+arete)) # Cut by cylinders # ---------------- -dirUp = MakeVectorDXDYDZ(0, 1, 0) +dirUp = geompy.MakeVectorDXDYDZ(0, 1, 0) -pieceCut1 = MakeCut(pieceBox , MakeCylinder(piecePoint , dirUp, rayon, hauteur)) -pieceCut2 = MakeCut(pieceCut1, MakeCylinder(MakeVertex(ox+arete, oy, oz ), dirUp, rayon, hauteur)) -pieceCut3 = MakeCut(pieceCut2, MakeCylinder(MakeVertex(ox , oy, oz+arete), dirUp, rayon, hauteur)) -pieceCut4 = MakeCut(pieceCut3, MakeCylinder(MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur)) +pieceCut1 = geompy.MakeCut(pieceBox , geompy.MakeCylinder(piecePoint , dirUp, rayon, hauteur)) +pieceCut2 = geompy.MakeCut(pieceCut1, geompy.MakeCylinder(geompy.MakeVertex(ox+arete, oy, oz ), dirUp, rayon, hauteur)) +pieceCut3 = geompy.MakeCut(pieceCut2, geompy.MakeCylinder(geompy.MakeVertex(ox , oy, oz+arete), dirUp, rayon, hauteur)) +pieceCut4 = geompy.MakeCut(pieceCut3, geompy.MakeCylinder(geompy.MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur)) # Compound by make a partition of a solid # --------------------------------------- -dir = MakeVectorDXDYDZ(-1, 0, 1) +dir = geompy.MakeVectorDXDYDZ(-1, 0, 1) tools = [] -tools.append(MakePlane(MakeVertex(ox+rayon, oy, oz ), dir, g_trim)) -tools.append(MakePlane(MakeVertex(ox , oy, oz+rayon), dir, g_trim)) +tools.append(geompy.MakePlane(geompy.MakeVertex(ox+rayon, oy, oz ), dir, g_trim)) +tools.append(geompy.MakePlane(geompy.MakeVertex(ox , oy, oz+rayon), dir, g_trim)) -piece = MakePartition([pieceCut4], tools, [], [], ShapeType["SOLID"]) +piece = geompy.MakePartition([pieceCut4], tools, [], [], geompy.ShapeType["SOLID"]) # Add in study # ------------ -piece_id = addToStudy(piece, "ex10_grid4geometry") +piece_id = geompy.addToStudy(piece, "ex10_grid4geometry") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex11_grid3partition.py b/src/SMESH_SWIG/ex11_grid3partition.py index f2ae89463..3d3e336f3 100644 --- a/src/SMESH_SWIG/ex11_grid3partition.py +++ b/src/SMESH_SWIG/ex11_grid3partition.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -58,52 +64,50 @@ g_trim = 1000 # Element # ------- -e_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete) +e_boite = geompy.MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete) e_hauteur = 2*g_hauteur -e_centre = MakeVertex(g_x, g_y-g_hauteur, g_z) -e_dir = MakeVectorDXDYDZ(0, 1, 0) +e_centre = geompy.MakeVertex(g_x, g_y-g_hauteur, g_z) +e_dir = geompy.MakeVectorDXDYDZ(0, 1, 0) -e_cyl1 = MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur) +e_cyl1 = geompy.MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur) -e_blo1 = MakeCut(e_boite, e_cyl1) +e_blo1 = geompy.MakeCut(e_boite, e_cyl1) -e_cyl2 = MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur) +e_cyl2 = geompy.MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur) -e_blo2 = MakeCut(e_cyl1, e_cyl2) +e_blo2 = geompy.MakeCut(e_cyl1, e_cyl2) -e_cyl3 = MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur) +e_cyl3 = geompy.MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur) -e_blo3 = MakeCut(e_cyl2, e_cyl3) +e_blo3 = geompy.MakeCut(e_cyl2, e_cyl3) # Partition and repair # -------------------- p_tools = [] -p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim)) -p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim)) +p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), g_trim)) +p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ(-1, 0, 1), g_trim)) -p_part = MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], ShapeType["SOLID"]) +p_part = geompy.MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], geompy.ShapeType["SOLID"]) -p_element = RemoveExtraEdges(p_part, doUnionFaces=True) +p_element = geompy.RemoveExtraEdges(p_part, doUnionFaces=True) # Grid and glue # ------------- -grid = MakeMultiTranslation2D(p_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid) +grid = geompy.MakeMultiTranslation2D(p_element, geompy.MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, geompy.MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid) -piece = MakeGlueFaces(grid, 1e-5) +piece = geompy.MakeGlueFaces(grid, 1e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex11_grid3partition") +piece_id = geompy.addToStudy(piece, "ex11_grid3partition") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex12_grid17partition.py b/src/SMESH_SWIG/ex12_grid17partition.py index 8bc62f40e..b8f550880 100644 --- a/src/SMESH_SWIG/ex12_grid17partition.py +++ b/src/SMESH_SWIG/ex12_grid17partition.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -57,68 +63,66 @@ g_trim = 1000 # Solids and rotation to prevent repair # ------------------------------------- -s_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete) +s_boite = geompy.MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete) s_pi4 = 3.141592653/4 s_hauteur = 2*g_hauteur -s_centre = MakeVertex(g_x, g_y-g_hauteur, g_z) -s_dir = MakeVectorDXDYDZ(0, 1, 0) +s_centre = geompy.MakeVertex(g_x, g_y-g_hauteur, g_z) +s_dir = geompy.MakeVectorDXDYDZ(0, 1, 0) -s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon3, s_hauteur) -s_cyl1 = MakeRotation(s_cyl0, s_dir, s_pi4) +s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon3, s_hauteur) +s_cyl1 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4) -s_blo1 = MakeCut(s_boite, s_cyl1) +s_blo1 = geompy.MakeCut(s_boite, s_cyl1) -s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon2, s_hauteur) -s_cyl2 = MakeRotation(s_cyl0, s_dir, s_pi4) +s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon2, s_hauteur) +s_cyl2 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4) -s_blo2 = MakeCut(s_cyl1, s_cyl2) +s_blo2 = geompy.MakeCut(s_cyl1, s_cyl2) -s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon1, s_hauteur) -s_cyl3 = MakeRotation(s_cyl0, s_dir, s_pi4) +s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon1, s_hauteur) +s_cyl3 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4) -s_blo3 = MakeCut(s_cyl2, s_cyl3) +s_blo3 = geompy.MakeCut(s_cyl2, s_cyl3) s_arete = g_rayon1/2 -s_blo4 = MakeBox(g_x-s_arete, g_y-g_hauteur, g_z-s_arete, g_x+s_arete, g_y+g_hauteur, g_z+s_arete) +s_blo4 = geompy.MakeBox(g_x-s_arete, g_y-g_hauteur, g_z-s_arete, g_x+s_arete, g_y+g_hauteur, g_z+s_arete) -s_blo5 = MakeCut(s_cyl3, s_blo4) +s_blo5 = geompy.MakeCut(s_cyl3, s_blo4) # Partition # --------- p_tools = [] -p_tools.append(MakePlane(s_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim)) -p_tools.append(MakePlane(s_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim)) +p_tools.append(geompy.MakePlane(s_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), g_trim)) +p_tools.append(geompy.MakePlane(s_centre, geompy.MakeVectorDXDYDZ(-1, 0, 1), g_trim)) -p_partie = MakePartition([s_blo1, s_blo2, s_blo3, s_blo5], p_tools, [], [], ShapeType["SOLID"]) +p_partie = geompy.MakePartition([s_blo1, s_blo2, s_blo3, s_blo5], p_tools, [], [], geompy.ShapeType["SOLID"]) # Compound and glue # ----------------- -c_blocs = SubShapeAll(p_partie, ShapeType["SOLID"]) +c_blocs = geompy.SubShapeAll(p_partie, geompy.ShapeType["SOLID"]) c_blocs.append(s_blo4) -c_cpd = MakeCompound(c_blocs) +c_cpd = geompy.MakeCompound(c_blocs) -c_element = MakeGlueFaces(c_cpd, 1e-4) +c_element = geompy.MakeGlueFaces(c_cpd, 1e-4) # Grid # ---- -piece = MakeMultiTranslation2D(c_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid) +piece = geompy.MakeMultiTranslation2D(c_element, geompy.MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, geompy.MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid) # Add in study # ------------ -piece_id = addToStudy(piece, "ex12_grid17partition") +piece_id = geompy.addToStudy(piece, "ex12_grid17partition") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex13_hole1partial.py b/src/SMESH_SWIG/ex13_hole1partial.py index a441a77f3..772df4bd3 100644 --- a/src/SMESH_SWIG/ex13_hole1partial.py +++ b/src/SMESH_SWIG/ex13_hole1partial.py @@ -23,9 +23,15 @@ # ================================== # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -50,11 +56,11 @@ cyl_thick = 30 def triangle(p1, p2, p3): l = [] - l.append(MakeEdge(p1, p2)) - l.append(MakeEdge(p2, p3)) - l.append(MakeEdge(p3, p1)) - w = MakeWire(l) - return MakeFace(w, 1) + l.append(geompy.MakeEdge(p1, p2)) + l.append(geompy.MakeEdge(p2, p3)) + l.append(geompy.MakeEdge(p3, p1)) + w = geompy.MakeWire(l) + return geompy.MakeFace(w, 1) # The holed part # ============== @@ -62,12 +68,12 @@ def triangle(p1, p2, p3): # Vertex of the holed part # ------------------------ -hole_point_11 = MakeVertex(0 , 0 , 0) -hole_point_21 = MakeVertex(box_dx, 0 , 0) -hole_point_12 = MakeVertex(0 , box_dy, 0) -hole_point_22 = MakeVertex(box_dx, box_dy, 0) +hole_point_11 = geompy.MakeVertex(0 , 0 , 0) +hole_point_21 = geompy.MakeVertex(box_dx, 0 , 0) +hole_point_12 = geompy.MakeVertex(0 , box_dy, 0) +hole_point_22 = geompy.MakeVertex(box_dx, box_dy, 0) -hole_center = MakeVertex(cyl_x, cyl_y, 0) +hole_center = geompy.MakeVertex(cyl_x, cyl_y, 0) # Faces of the holed part # ----------------------- @@ -80,33 +86,33 @@ hole_face_4 = triangle(hole_point_11, hole_point_12, hole_center) # Solids of the holed part # ------------------------ -cyl_dir = MakeVectorDXDYDZ(0, 0, 1) +cyl_dir = geompy.MakeVectorDXDYDZ(0, 0, 1) -hole_solid_1 = MakePrismVecH(hole_face_1, cyl_dir, cyl_dz) -hole_solid_2 = MakePrismVecH(hole_face_2, cyl_dir, cyl_dz) -hole_solid_3 = MakePrismVecH(hole_face_3, cyl_dir, cyl_dz) -hole_solid_4 = MakePrismVecH(hole_face_4, cyl_dir, cyl_dz) +hole_solid_1 = geompy.MakePrismVecH(hole_face_1, cyl_dir, cyl_dz) +hole_solid_2 = geompy.MakePrismVecH(hole_face_2, cyl_dir, cyl_dz) +hole_solid_3 = geompy.MakePrismVecH(hole_face_3, cyl_dir, cyl_dz) +hole_solid_4 = geompy.MakePrismVecH(hole_face_4, cyl_dir, cyl_dz) -hole_internal = MakeCylinder(hole_center, cyl_dir, cyl_radius , cyl_dz) -hole_external = MakeCylinder(hole_center, cyl_dir, cyl_radius+cyl_thick, cyl_dz) -hole_median = MakeCut(hole_external, hole_internal) +hole_internal = geompy.MakeCylinder(hole_center, cyl_dir, cyl_radius , cyl_dz) +hole_external = geompy.MakeCylinder(hole_center, cyl_dir, cyl_radius+cyl_thick, cyl_dz) +hole_median = geompy.MakeCut(hole_external, hole_internal) # Boolean operations # ------------------ blocks = [] -blocks.append( MakeCut(hole_solid_1, hole_external)) -blocks.append(MakeCommon(hole_solid_1, hole_median )) +blocks.append( geompy.MakeCut(hole_solid_1, hole_external)) +blocks.append(geompy.MakeCommon(hole_solid_1, hole_median )) -blocks.append( MakeCut(hole_solid_2, hole_external)) -blocks.append(MakeCommon(hole_solid_2, hole_median )) +blocks.append( geompy.MakeCut(hole_solid_2, hole_external)) +blocks.append(geompy.MakeCommon(hole_solid_2, hole_median )) -blocks.append( MakeCut(hole_solid_3, hole_external)) -blocks.append(MakeCommon(hole_solid_3, hole_median )) +blocks.append( geompy.MakeCut(hole_solid_3, hole_external)) +blocks.append(geompy.MakeCommon(hole_solid_3, hole_median )) -blocks.append( MakeCut(hole_solid_4, hole_external)) -blocks.append(MakeCommon(hole_solid_4, hole_median )) +blocks.append( geompy.MakeCut(hole_solid_4, hole_external)) +blocks.append(geompy.MakeCommon(hole_solid_4, hole_median )) # The full part # ============= @@ -114,12 +120,12 @@ blocks.append(MakeCommon(hole_solid_4, hole_median )) # Vertex of the full part # ----------------------- -full_point_11 = MakeVertex(0 , 0 , cyl_dz) -full_point_21 = MakeVertex(box_dx, 0 , cyl_dz) -full_point_12 = MakeVertex(0 , box_dy, cyl_dz) -full_point_22 = MakeVertex(box_dx, box_dy, cyl_dz) +full_point_11 = geompy.MakeVertex(0 , 0 , cyl_dz) +full_point_21 = geompy.MakeVertex(box_dx, 0 , cyl_dz) +full_point_12 = geompy.MakeVertex(0 , box_dy, cyl_dz) +full_point_22 = geompy.MakeVertex(box_dx, box_dy, cyl_dz) -full_center = MakeVertex(cyl_x, cyl_y, cyl_dz) +full_center = geompy.MakeVertex(cyl_x, cyl_y, cyl_dz) # Faces of the full part # ---------------------- @@ -134,31 +140,31 @@ full_face_4 = triangle(full_point_11, full_point_12, full_center) full_dz = box_dz - cyl_dz -full_solid_1 = MakePrismVecH(full_face_1, cyl_dir, full_dz) -full_solid_2 = MakePrismVecH(full_face_2, cyl_dir, full_dz) -full_solid_3 = MakePrismVecH(full_face_3, cyl_dir, full_dz) -full_solid_4 = MakePrismVecH(full_face_4, cyl_dir, full_dz) +full_solid_1 = geompy.MakePrismVecH(full_face_1, cyl_dir, full_dz) +full_solid_2 = geompy.MakePrismVecH(full_face_2, cyl_dir, full_dz) +full_solid_3 = geompy.MakePrismVecH(full_face_3, cyl_dir, full_dz) +full_solid_4 = geompy.MakePrismVecH(full_face_4, cyl_dir, full_dz) -full_internal = MakeCylinder(full_center, cyl_dir, cyl_radius , full_dz) -full_external = MakeCylinder(full_center, cyl_dir, cyl_radius+cyl_thick, full_dz) -full_median = MakeCut(full_external, full_internal) +full_internal = geompy.MakeCylinder(full_center, cyl_dir, cyl_radius , full_dz) +full_external = geompy.MakeCylinder(full_center, cyl_dir, cyl_radius+cyl_thick, full_dz) +full_median = geompy.MakeCut(full_external, full_internal) # Boolean operations # ------------------ full = [] -full.append( MakeCut(full_solid_1, full_external)) -full.append(MakeCommon(full_solid_1, full_median)) +full.append( geompy.MakeCut(full_solid_1, full_external)) +full.append(geompy.MakeCommon(full_solid_1, full_median)) -full.append( MakeCut(full_solid_2, full_external)) -full.append(MakeCommon(full_solid_2, full_median )) +full.append( geompy.MakeCut(full_solid_2, full_external)) +full.append(geompy.MakeCommon(full_solid_2, full_median )) -full.append( MakeCut(full_solid_3, full_external)) -full.append(MakeCommon(full_solid_3, full_median)) +full.append( geompy.MakeCut(full_solid_3, full_external)) +full.append(geompy.MakeCommon(full_solid_3, full_median)) -full.append( MakeCut(full_solid_4, full_external)) -full.append(MakeCommon(full_solid_4, full_median)) +full.append( geompy.MakeCut(full_solid_4, full_external)) +full.append(geompy.MakeCommon(full_solid_4, full_median)) # Filling the hole # ---------------- @@ -167,56 +173,54 @@ box_d = cyl_radius/3 x = cyl_x-box_d y = x * cyl_y / cyl_x -box_point_11 = MakeVertex(x, y, cyl_dz) +box_point_11 = geompy.MakeVertex(x, y, cyl_dz) x = cyl_x+box_d y = (box_dx - x) * cyl_y / (box_dx - cyl_x) -box_point_12 = MakeVertex(x, y, cyl_dz) +box_point_12 = geompy.MakeVertex(x, y, cyl_dz) x = cyl_x-box_d y = box_dy - x * (box_dy - cyl_y) / cyl_x -box_point_21 = MakeVertex(x, y, cyl_dz) +box_point_21 = geompy.MakeVertex(x, y, cyl_dz) x = cyl_x+box_d y = box_dy - (box_dx - x) * (box_dy - cyl_y) / (box_dx - cyl_x) -box_point_22 = MakeVertex(x, y, cyl_dz) +box_point_22 = geompy.MakeVertex(x, y, cyl_dz) -box_face = MakeQuad4Vertices(box_point_11, box_point_12, box_point_21, box_point_22) +box_face = geompy.MakeQuad4Vertices(box_point_11, box_point_12, box_point_21, box_point_22) -box = MakePrismVecH(box_face, cyl_dir, full_dz) +box = geompy.MakePrismVecH(box_face, cyl_dir, full_dz) full.append(box) -full.append(MakeCut(MakeCommon(full_solid_1, full_internal), box)) -full.append(MakeCut(MakeCommon(full_solid_2, full_internal), box)) -full.append(MakeCut(MakeCommon(full_solid_3, full_internal), box)) -full.append(MakeCut(MakeCommon(full_solid_4, full_internal), box)) +full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_1, full_internal), box)) +full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_2, full_internal), box)) +full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_3, full_internal), box)) +full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_4, full_internal), box)) # Cut the cylinder thikness # ------------------------- -full_plan = MakePlane(MakeVertex(0, 0, cyl_dz+cyl_thick), cyl_dir, 5000) +full_plan = geompy.MakePlane(geompy.MakeVertex(0, 0, cyl_dz+cyl_thick), cyl_dir, 5000) -full_parts = MakePartition(full, [full_plan], [], [], ShapeType["SOLID"]) +full_parts = geompy.MakePartition(full, [full_plan], [], [], geompy.ShapeType["SOLID"]) # Geometry result # --------------- blocks.append(full_parts) -piece_cpd = MakeCompound(blocks) +piece_cpd = geompy.MakeCompound(blocks) -piece_ok = RemoveExtraEdges(piece_cpd, doUnionFaces=True) +piece_ok = geompy.RemoveExtraEdges(piece_cpd, doUnionFaces=True) -piece = MakeGlueFaces(piece_ok, 1.e-3) +piece = geompy.MakeGlueFaces(piece_ok, 1.e-3) -piece_id = addToStudy(piece, "ex13_hole1partial") +piece_id = geompy.addToStudy(piece, "ex13_hole1partial") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a mesh # ------------- @@ -233,7 +237,7 @@ hexa.Hexahedron() # ---------------- def local(x, y, z, d): - edge = GetEdgeNearPoint(piece, MakeVertex(x, y, z)) + edge = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(x, y, z)) algo = hexa.Segment(edge) algo.NumberOfSegments(d) algo.Propagation() diff --git a/src/SMESH_SWIG/ex14_cyl1holed.py b/src/SMESH_SWIG/ex14_cyl1holed.py index d68cc001c..02eb337af 100644 --- a/src/SMESH_SWIG/ex14_cyl1holed.py +++ b/src/SMESH_SWIG/ex14_cyl1holed.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometrie # ========= @@ -52,19 +58,19 @@ g_trim = 15000 # Construire le cylindre # ---------------------- -c_point = MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur) -c_dir = MakeVectorDXDYDZ(0, 0, 1) +c_point = geompy.MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur) +c_dir = geompy.MakeVectorDXDYDZ(0, 0, 1) c_hauteur = 2*g_cyl_demiHauteur -c_cylindre = MakeCylinder(c_point, c_dir, g_cyl_rayon, c_hauteur) +c_cylindre = geompy.MakeCylinder(c_point, c_dir, g_cyl_rayon, c_hauteur) # Trouer le cylindre par un minuscule cylindre excentre # ----------------------------------------------------- t_hauteur = g_cyl_demiHauteur -t_point = MakeVertex(g_ox-g_trou_centre, g_oy, g_oz-t_hauteur) -t_trou = MakeCylinder(t_point, c_dir, g_trou_rayon, 2*t_hauteur) +t_point = geompy.MakeVertex(g_ox-g_trou_centre, g_oy, g_oz-t_hauteur) +t_trou = geompy.MakeCylinder(t_point, c_dir, g_trou_rayon, 2*t_hauteur) -t_piece = MakeCut(c_cylindre, t_trou) +t_piece = geompy.MakeCut(c_cylindre, t_trou) # Geometrie hexahedrique # ====================== @@ -73,10 +79,10 @@ t_piece = MakeCut(c_cylindre, t_trou) # -------- h_outils = [] -h_outils.append(MakePlane(t_point, MakeVectorDXDYDZ(1, 0, 0), g_trim)) -h_outils.append(MakePlane(t_point, MakeVectorDXDYDZ(0, 1, 0), g_trim)) +h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(1, 0, 0), g_trim)) +h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim)) -h_piece = MakePartition([t_piece], h_outils, [], [], ShapeType["SOLID"]) +h_piece = geompy.MakePartition([t_piece], h_outils, [], [], geompy.ShapeType["SOLID"]) # Decouper pour les conditions locales # ------------------------------------ @@ -87,21 +93,19 @@ l_n = 12 l_hauteur = c_hauteur/l_n while l_i algo.smeshBuilder.xxxx | + | +=============================================================================== +""" diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshBuilder.py similarity index 95% rename from src/SMESH_SWIG/smeshDC.py rename to src/SMESH_SWIG/smeshBuilder.py index 49235f848..25bf8e9e0 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -16,11 +16,11 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# File : smesh.py +# File : smeshBuilder.py # Author : Francis KLOSS, OCC # Module : SMESH -## @package smesh +## @package smeshBuilder # Python API for SALOME %Mesh module ## @defgroup l1_auxiliary Auxiliary methods and structures @@ -83,35 +83,19 @@ ## @defgroup l1_measurements Measurements import salome -import geompyDC +from salome.geom import geomBuilder import SMESH # This is necessary for back compatibility from SMESH import * -from smesh_algorithm import Mesh_Algorithm +from salome.smesh.smesh_algorithm import Mesh_Algorithm import SALOME import SALOMEDS +import os ## @addtogroup l1_auxiliary ## @{ -# MirrorType enumeration -POINT = SMESH_MeshEditor.POINT -AXIS = SMESH_MeshEditor.AXIS -PLANE = SMESH_MeshEditor.PLANE - -# Smooth_Method enumeration -LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH -CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH - -PrecisionConfusion = 1e-07 - -# TopAbs_State enumeration -[TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = range(4) - -# Methods of splitting a hexahedron into tetrahedra -Hex_5Tet, Hex_6Tet, Hex_24Tet = 1, 2, 3 - ## Converts an angle from degrees to radians def DegreesToRadians(AngleInDegrees): from math import pi @@ -171,8 +155,8 @@ def __initAxisStruct(ax,*args): pass SMESH.AxisStruct.__init__ = __initAxisStruct - -def IsEqual(val1, val2, tol=PrecisionConfusion): +smeshPrecisionConfusion = 1.e-07 +def IsEqual(val1, val2, tol=smeshPrecisionConfusion): if abs(val1 - val2) < tol: return True return False @@ -256,7 +240,7 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo): ## Private method. Add geom (sub-shape of the main shape) into the study if not yet there def AssureGeomPublished(mesh, geom, name=''): - if not isinstance( geom, geompyDC.GEOM._objref_GEOM_Object ): + if not isinstance( geom, geomBuilder.GEOM._objref_GEOM_Object ): return if not geom.GetStudyEntry() and \ mesh.smeshpyD.GetCurrentStudy(): @@ -265,7 +249,7 @@ def AssureGeomPublished(mesh, geom, name=''): if studyID != mesh.geompyD.myStudyId: mesh.geompyD.init_geom( mesh.smeshpyD.GetCurrentStudy()) ## get a name - if not name and geom.GetShapeType() != geompyDC.GEOM.COMPOUND: + if not name and geom.GetShapeType() != geomBuilder.GEOM.COMPOUND: # for all groups SubShapeName() returns "Compound_-1" name = mesh.geompyD.SubShapeName(geom, mesh.geom) if not name: @@ -274,17 +258,16 @@ def AssureGeomPublished(mesh, geom, name=''): mesh.geompyD.addToStudyInFather( mesh.geom, geom, name ) return -## Return the first vertex of a geomertical edge by ignoring orienation +## Return the first vertex of a geometrical edge by ignoring orientation def FirstVertexOnCurve(edge): - from geompy import SubShapeAll, ShapeType, MakeVertexOnCurve, PointCoordinates - vv = SubShapeAll( edge, ShapeType["VERTEX"]) + vv = geomBuilder.SubShapeAll( edge, geomBuilder.geomBuilder.ShapeType["VERTEX"]) if not vv: raise TypeError, "Given object has no vertices" if len( vv ) == 1: return vv[0] - v0 = MakeVertexOnCurve(edge,0.) - xyz = PointCoordinates( v0 ) # coords of the first vertex - xyz1 = PointCoordinates( vv[0] ) - xyz2 = PointCoordinates( vv[1] ) + v0 = geomBuilder.MakeVertexOnCurve(edge,0.) + xyz = geomBuilder.PointCoordinates( v0 ) # coords of the first vertex + xyz1 = geomBuilder.PointCoordinates( vv[0] ) + xyz2 = geomBuilder.PointCoordinates( vv[1] ) dist1, dist2 = 0,0 for i in range(3): dist1 += abs( xyz[i] - xyz1[i] ) @@ -297,8 +280,73 @@ def FirstVertexOnCurve(edge): # end of l1_auxiliary ## @} -# All methods of this class are accessible directly from the smesh.py package. -class smeshDC(SMESH._objref_SMESH_Gen): + +# Warning: smeshInst is a singleton +smeshInst = None +engine = None +doLcc = False + +## This class allows to create, load or manipulate meshes +# It has a set of methods to create load or copy meshes, to combine several meshes. +# It also has methods to get infos on meshes. +class smeshBuilder(object, SMESH._objref_SMESH_Gen): + + # MirrorType enumeration + POINT = SMESH_MeshEditor.POINT + AXIS = SMESH_MeshEditor.AXIS + PLANE = SMESH_MeshEditor.PLANE + + # Smooth_Method enumeration + LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH + CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH + + PrecisionConfusion = smeshPrecisionConfusion + + # TopAbs_State enumeration + [TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = range(4) + + # Methods of splitting a hexahedron into tetrahedra + Hex_5Tet, Hex_6Tet, Hex_24Tet = 1, 2, 3 + + def __new__(cls): + global engine + global smeshInst + global doLcc + #print "__new__", engine, smeshInst, doLcc + + if smeshInst is None: + # smesh engine is either retrieved from engine, or created + smeshInst = engine + # Following test avoids a recursive loop + if doLcc: + if smeshInst is not None: + # smesh engine not created: existing engine found + doLcc = False + if doLcc: + doLcc = False + # FindOrLoadComponent called: + # 1. CORBA resolution of server + # 2. the __new__ method is called again + #print "smeshInst = lcc.FindOrLoadComponent ", engine, smeshInst, doLcc + smeshInst = salome.lcc.FindOrLoadComponent( "FactoryServer", "SMESH" ) + else: + # FindOrLoadComponent not called + if smeshInst is None: + # smeshBuilder instance is created from lcc.FindOrLoadComponent + #print "smeshInst = super(smeshBuilder,cls).__new__(cls) ", engine, smeshInst, doLcc + smeshInst = super(smeshBuilder,cls).__new__(cls) + else: + # smesh engine not created: existing engine found + #print "existing ", engine, smeshInst, doLcc + pass + + return smeshInst + + return smeshInst + + def __init__(self): + #print "__init__" + SMESH._objref_SMESH_Gen.__init__(self) ## Dump component to the Python script # This method overrides IDL function to allow default values for the parameters. @@ -317,7 +365,8 @@ class smeshDC(SMESH._objref_SMESH_Gen): ## Sets the current study and Geometry component # @ingroup l1_auxiliary - def init_smesh(self,theStudy,geompyD): + def init_smesh(self,theStudy,geompyD = None): + #print "init_smesh" self.SetCurrentStudy(theStudy,geompyD) ## Creates an empty Mesh. This mesh can have an underlying geometry. @@ -363,7 +412,7 @@ class smeshDC(SMESH._objref_SMESH_Gen): # @return SMESH.DirStruct # @ingroup l1_auxiliary def GetDirStruct(self,theVector): - vertices = self.geompyD.SubShapeAll( theVector, geompyDC.ShapeType["VERTEX"] ) + vertices = self.geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] ) if(len(vertices) != 2): print "Error: vector object is incorrect." return None @@ -386,10 +435,10 @@ class smeshDC(SMESH._objref_SMESH_Gen): # @return SMESH.AxisStruct # @ingroup l1_auxiliary def GetAxisStruct(self,theObj): - edges = self.geompyD.SubShapeAll( theObj, geompyDC.ShapeType["EDGE"] ) + edges = self.geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] ) if len(edges) > 1: - vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geompyDC.ShapeType["VERTEX"] ) - vertex3, vertex4 = self.geompyD.SubShapeAll( edges[1], geompyDC.ShapeType["VERTEX"] ) + vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] ) + vertex3, vertex4 = self.geompyD.SubShapeAll( edges[1], geomBuilder.geomBuilder.ShapeType["VERTEX"] ) vertex1 = self.geompyD.PointCoordinates(vertex1) vertex2 = self.geompyD.PointCoordinates(vertex2) vertex3 = self.geompyD.PointCoordinates(vertex3) @@ -400,7 +449,7 @@ class smeshDC(SMESH._objref_SMESH_Gen): axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2]) return axis elif len(edges) == 1: - vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geompyDC.ShapeType["VERTEX"] ) + vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] ) p1 = self.geompyD.PointCoordinates( vertex1 ) p2 = self.geompyD.PointCoordinates( vertex2 ) axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2]) @@ -439,8 +488,8 @@ class smeshDC(SMESH._objref_SMESH_Gen): def SetCurrentStudy( self, theStudy, geompyD = None ): #self.SetCurrentStudy(theStudy) if not geompyD: - import geompy - geompyD = geompy.geom + from salome.geom import geomBuilder + geompyD = geomBuilder.geom pass self.geompyD=geompyD self.SetGeomEngine(geompyD) @@ -643,7 +692,7 @@ class smeshDC(SMESH._objref_SMESH_Gen): if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface, FT_BelongToCylinder, FT_LyingOnGeom]: # Checks that Threshold is GEOM object - if isinstance(aThreshold, geompyDC.GEOM._objref_GEOM_Object): + if isinstance(aThreshold, geomBuilder.GEOM._objref_GEOM_Object): aCriterion.ThresholdStr = GetName(aThreshold) aCriterion.ThresholdID = aThreshold.GetStudyEntry() if not aCriterion.ThresholdID: @@ -969,7 +1018,49 @@ class smeshDC(SMESH._objref_SMESH_Gen): import omniORB #Registering the new proxy for SMESH_Gen -omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC) +omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshBuilder) + +## Create a new smeshBuilder instance.The smeshBuilder class provides the Python +# interface to create or load meshes. +# +# Typical use is: +# \code +# import salome +# salome.salome_init() +# from salome.smesh import smeshBuilder +# smesh = smeshBuilder.New(theStudy) +# \endcode +# @param study SALOME study, generally obtained by salome.myStudy. +# @param instance CORBA proxy of SMESH Engine. If None, the default Engine is used. +# @return smeshBuilder instance + +def New( study, instance=None): + """ + Create a new smeshBuilder instance.The smeshBuilder class provides the Python + interface to create or load meshes. + + Typical use is: + import salome + salome.salome_init() + from salome.smesh import smeshBuilder + smesh = smeshBuilder.New(theStudy) + + Parameters: + study SALOME study, generally obtained by salome.myStudy. + instance CORBA proxy of SMESH Engine. If None, the default Engine is used. + Returns: + smeshBuilder instance + """ + global engine + global smeshInst + global doLcc + engine = instance + if engine is None: + doLcc = True + smeshInst = smeshBuilder() + assert isinstance(smeshInst,smeshBuilder), "Smesh engine class is %s but should be smeshBuilder.smeshBuilder. Import salome.smesh.smeshBuilder before creating the instance."%smeshInst.__class__ + smeshInst.init_smesh(study) + return smeshInst # Public class: Mesh @@ -990,8 +1081,8 @@ class Mesh: # # Creates a mesh on the shape \a obj (or an empty mesh if \a obj is equal to 0) and # sets the GUI name of this mesh to \a name. - # @param smeshpyD an instance of smeshDC class - # @param geompyD an instance of geompyDC class + # @param smeshpyD an instance of smeshBuilder class + # @param geompyD an instance of geomBuilder class # @param obj Shape to be meshed or SMESH_Mesh object # @param name Study name of the mesh # @ingroup l2_construct @@ -1002,7 +1093,7 @@ class Mesh: obj = 0 objHasName = False if obj != 0: - if isinstance(obj, geompyDC.GEOM._objref_GEOM_Object): + if isinstance(obj, geomBuilder.GEOM._objref_GEOM_Object): self.geom = obj objHasName = True # publish geom of mesh (issue 0021122) @@ -1038,6 +1129,7 @@ class Mesh: for attrName in dir(self): attr = getattr( self, attrName ) if isinstance( attr, algoCreator ): + #print "algoCreator ", attrName setattr( self, attrName, attr.copy( self )) ## Initializes the Mesh object from an instance of SMESH_Mesh interface @@ -1127,7 +1219,7 @@ class Mesh: # @ingroup l1_auxiliary def MeshDimension(self): if self.mesh.HasShapeToMesh(): - shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SOLID"] ) + shells = self.geompyD.SubShapeAllIDs( self.geom, self.geompyD.ShapeType["SOLID"] ) if len( shells ) > 0 : return 3 elif self.geompyD.NumberOfFaces( self.geom ) > 0 : @@ -1147,7 +1239,7 @@ class Mesh: # To know predicted number of e.g. edges, inquire it this way # Evaluate()[ EnumToLong( Entity_Edge )] def Evaluate(self, geom=0): - if geom == 0 or not isinstance(geom, geompyDC.GEOM._objref_GEOM_Object): + if geom == 0 or not isinstance(geom, geomBuilder.GEOM._objref_GEOM_Object): if self.geom == 0: geom = self.mesh.GetShapeToMesh() else: @@ -1163,7 +1255,7 @@ class Mesh: # @return True or False # @ingroup l2_construct def Compute(self, geom=0, discardModifs=False): - if geom == 0 or not isinstance(geom, geompyDC.GEOM._objref_GEOM_Object): + if geom == 0 or not isinstance(geom, geomBuilder.GEOM._objref_GEOM_Object): if self.geom == 0: geom = self.mesh.GetShapeToMesh() else: @@ -1203,7 +1295,7 @@ class Mesh: subIt.Next() obj = subSO.GetObject() if not obj: continue - go = obj._narrow( geompyDC.GEOM._objref_GEOM_Object ) + go = obj._narrow( geomBuilder.GEOM._objref_GEOM_Object ) if not go: continue ids = go.GetSubShapeIndices() if len(ids) == 1 and ids[0] == err.subShapeID: @@ -1269,7 +1361,7 @@ class Mesh: % ( glob, dim, name, glob, dim )) else: reason = ("For unknown reason. " - "Developer, revise Mesh.Compute() implementation in smeshDC.py!") + "Developer, revise Mesh.Compute() implementation in smeshBuilder.py!") pass if allReasons != "":allReasons += "\n" allReasons += "- " + reason @@ -1337,7 +1429,7 @@ class Mesh: self.Triangle().LengthFromEdges() pass if dim > 2 : - from NETGENPluginDC import NETGEN + from salome.NETGENPlugin.NETGENPluginBuilder import NETGEN self.Tetrahedron(NETGEN) pass return self.Compute() @@ -1590,7 +1682,7 @@ class Mesh: elif tgeo == "SOLID" or tgeo == "COMPSOLID": typ = VOLUME elif tgeo == "COMPOUND": - sub = self.geompyD.SubShapeAll( shape, geompyDC.ShapeType["SHAPE"]) + sub = self.geompyD.SubShapeAll( shape, self.geompyD.ShapeType["SHAPE"]) if not sub: raise ValueError,"_groupTypeFromShape(): empty geometric group or compound '%s'" % GetName(shape) return self._groupTypeFromShape( sub[0] ) @@ -2086,7 +2178,7 @@ class Mesh: # @return the list of integer values # @ingroup l1_meshinfo def GetSubMeshElementsId(self, Shape): - if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Shape, geomBuilder.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] else: ShapeID = Shape @@ -2099,7 +2191,7 @@ class Mesh: # @return the list of integer values # @ingroup l1_meshinfo def GetSubMeshNodesId(self, Shape, all): - if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Shape, geomBuilder.GEOM._objref_GEOM_Object)): ShapeID = self.geompyD.GetSubShapeID( self.geom, Shape ) else: ShapeID = Shape @@ -2111,7 +2203,7 @@ class Mesh: # @return element type # @ingroup l1_meshinfo def GetSubMeshElementType(self, Shape): - if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Shape, geomBuilder.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] else: ShapeID = Shape @@ -2481,7 +2573,7 @@ class Mesh: # @return True if succeed else raises an exception # @ingroup l2_modif_add def SetNodeOnVertex(self, NodeID, Vertex): - if ( isinstance( Vertex, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Vertex, geomBuilder.GEOM._objref_GEOM_Object)): VertexID = Vertex.GetSubShapeIndices()[0] else: VertexID = Vertex @@ -2499,7 +2591,7 @@ class Mesh: # @return True if succeed else raises an exception # @ingroup l2_modif_add def SetNodeOnEdge(self, NodeID, Edge, paramOnEdge): - if ( isinstance( Edge, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Edge, geomBuilder.GEOM._objref_GEOM_Object)): EdgeID = Edge.GetSubShapeIndices()[0] else: EdgeID = Edge @@ -2517,7 +2609,7 @@ class Mesh: # @return True if succeed else raises an exception # @ingroup l2_modif_add def SetNodeOnFace(self, NodeID, Face, u, v): - if ( isinstance( Face, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Face, geomBuilder.GEOM._objref_GEOM_Object)): FaceID = Face.GetSubShapeIndices()[0] else: FaceID = Face @@ -2533,7 +2625,7 @@ class Mesh: # @return True if succeed else raises an exception # @ingroup l2_modif_add def SetNodeInVolume(self, NodeID, Solid): - if ( isinstance( Solid, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Solid, geomBuilder.GEOM._objref_GEOM_Object)): SolidID = Solid.GetSubShapeIndices()[0] else: SolidID = Solid @@ -2549,7 +2641,7 @@ class Mesh: # @return True if succeed else raises an exception # @ingroup l2_modif_add def SetMeshElementOnShape(self, ElementID, Shape): - if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Shape, geomBuilder.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] else: ShapeID = Shape @@ -2680,14 +2772,14 @@ class Mesh: if isinstance( the2DObject, list ): the2DObject = self.GetIDSource( the2DObject, SMESH.FACE ) # check theDirection - if isinstance( theDirection, geompyDC.GEOM._objref_GEOM_Object): + if isinstance( theDirection, geomBuilder.GEOM._objref_GEOM_Object): theDirection = self.smeshpyD.GetDirStruct( theDirection ) if isinstance( theDirection, list ): theDirection = self.smeshpyD.MakeDirStruct( *theDirection ) # prepare theFace and thePoint theFace = theFaceOrPoint thePoint = PointStruct(0,0,0) - if isinstance( theFaceOrPoint, geompyDC.GEOM._objref_GEOM_Object): + if isinstance( theFaceOrPoint, geomBuilder.GEOM._objref_GEOM_Object): thePoint = self.smeshpyD.GetPointStruct( theFaceOrPoint ) theFace = -1 if isinstance( theFaceOrPoint, list ): @@ -2799,7 +2891,7 @@ class Mesh: # @param method flags passing splitting method: Hex_5Tet, Hex_6Tet, Hex_24Tet # Hex_5Tet - split the hexahedron into 5 tetrahedrons, etc # @ingroup l2_modif_cutquadr - def SplitVolumesIntoTetra(self, elemIDs, method=Hex_5Tet ): + def SplitVolumesIntoTetra(self, elemIDs, method=smeshBuilder.Hex_5Tet ): if isinstance( elemIDs, Mesh ): elemIDs = elemIDs.GetMesh() if ( isinstance( elemIDs, list )): @@ -3128,7 +3220,7 @@ class Mesh: MakeGroups=False, TotalAngle=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): Axis = self.smeshpyD.GetAxisStruct(Axis) AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians) NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance) @@ -3158,7 +3250,7 @@ class Mesh: MakeGroups=False, TotalAngle=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): Axis = self.smeshpyD.GetAxisStruct(Axis) AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians) NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance) @@ -3188,7 +3280,7 @@ class Mesh: MakeGroups=False, TotalAngle=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): Axis = self.smeshpyD.GetAxisStruct(Axis) AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians) NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance) @@ -3218,7 +3310,7 @@ class Mesh: MakeGroups=False, TotalAngle=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): Axis = self.smeshpyD.GetAxisStruct(Axis) AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians) NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance) @@ -3245,7 +3337,7 @@ class Mesh: def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object): + if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object): StepVector = self.smeshpyD.GetDirStruct(StepVector) if isinstance( StepVector, list ): StepVector = self.smeshpyD.MakeDirStruct(*StepVector) @@ -3277,7 +3369,7 @@ class Mesh: # @ingroup l2_modif_extrurev def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance, MakeGroups=False): - if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)): StepVector = self.smeshpyD.GetDirStruct(StepVector) if isinstance( StepVector, list ): StepVector = self.smeshpyD.MakeDirStruct(*StepVector) @@ -3302,7 +3394,7 @@ class Mesh: def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False, IsNodes=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)): StepVector = self.smeshpyD.GetDirStruct(StepVector) if isinstance( StepVector, list ): StepVector = self.smeshpyD.MakeDirStruct(*StepVector) @@ -3333,7 +3425,7 @@ class Mesh: def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)): StepVector = self.smeshpyD.GetDirStruct(StepVector) if isinstance( StepVector, list ): StepVector = self.smeshpyD.MakeDirStruct(*StepVector) @@ -3358,7 +3450,7 @@ class Mesh: def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)): StepVector = self.smeshpyD.GetDirStruct(StepVector) if isinstance( StepVector, list ): StepVector = self.smeshpyD.MakeDirStruct(*StepVector) @@ -3393,7 +3485,7 @@ class Mesh: def ExtrusionAlongPathX(self, Base, Path, NodeStart, HasAngles, Angles, LinearVariation, HasRefPoint, RefPoint, MakeGroups, ElemType): - if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): RefPoint = self.smeshpyD.GetPointStruct(RefPoint) pass Angles,AnglesParameters,hasVars = ParseAngles(Angles) @@ -3442,7 +3534,7 @@ class Mesh: MakeGroups=False, LinearVariation=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): RefPoint = self.smeshpyD.GetPointStruct(RefPoint) pass if ( isinstance( PathMesh, Mesh )): @@ -3484,7 +3576,7 @@ class Mesh: MakeGroups=False, LinearVariation=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): RefPoint = self.smeshpyD.GetPointStruct(RefPoint) if ( isinstance( PathMesh, Mesh )): PathMesh = PathMesh.GetMesh() @@ -3526,7 +3618,7 @@ class Mesh: MakeGroups=False, LinearVariation=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): RefPoint = self.smeshpyD.GetPointStruct(RefPoint) if ( isinstance( PathMesh, Mesh )): PathMesh = PathMesh.GetMesh() @@ -3568,7 +3660,7 @@ class Mesh: MakeGroups=False, LinearVariation=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): RefPoint = self.smeshpyD.GetPointStruct(RefPoint) if ( isinstance( PathMesh, Mesh )): PathMesh = PathMesh.GetMesh() @@ -3598,7 +3690,7 @@ class Mesh: def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Mirror, geomBuilder.GEOM._objref_GEOM_Object)): Mirror = self.smeshpyD.GetAxisStruct(Mirror) self.mesh.SetParameters(Mirror.parameters) if Copy and MakeGroups: @@ -3618,7 +3710,7 @@ class Mesh: def MirrorMakeMesh(self, IDsOfElements, Mirror, theMirrorType, MakeGroups=0, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Mirror, geomBuilder.GEOM._objref_GEOM_Object)): Mirror = self.smeshpyD.GetAxisStruct(Mirror) self.mesh.SetParameters(Mirror.parameters) mesh = self.editor.MirrorMakeMesh(IDsOfElements, Mirror, theMirrorType, @@ -3637,7 +3729,7 @@ class Mesh: def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Mirror, geomBuilder.GEOM._objref_GEOM_Object)): Mirror = self.smeshpyD.GetAxisStruct(Mirror) self.mesh.SetParameters(Mirror.parameters) if Copy and MakeGroups: @@ -3657,7 +3749,7 @@ class Mesh: def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if (isinstance(Mirror, geompyDC.GEOM._objref_GEOM_Object)): + if (isinstance(Mirror, geomBuilder.GEOM._objref_GEOM_Object)): Mirror = self.smeshpyD.GetAxisStruct(Mirror) self.mesh.SetParameters(Mirror.parameters) mesh = self.editor.MirrorObjectMakeMesh(theObject, Mirror, theMirrorType, @@ -3674,7 +3766,7 @@ class Mesh: def Translate(self, IDsOfElements, Vector, Copy, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)): Vector = self.smeshpyD.GetDirStruct(Vector) if isinstance( Vector, list ): Vector = self.smeshpyD.MakeDirStruct(*Vector) @@ -3694,7 +3786,7 @@ class Mesh: def TranslateMakeMesh(self, IDsOfElements, Vector, MakeGroups=False, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)): Vector = self.smeshpyD.GetDirStruct(Vector) if isinstance( Vector, list ): Vector = self.smeshpyD.MakeDirStruct(*Vector) @@ -3712,7 +3804,7 @@ class Mesh: def TranslateObject(self, theObject, Vector, Copy, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object)): Vector = self.smeshpyD.GetDirStruct(Vector) if isinstance( Vector, list ): Vector = self.smeshpyD.MakeDirStruct(*Vector) @@ -3732,7 +3824,7 @@ class Mesh: def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""): if isinstance( theObject, Mesh ): theObject = theObject.GetMesh() - if isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object ): + if isinstance( Vector, geomBuilder.GEOM._objref_GEOM_Object ): Vector = self.smeshpyD.GetDirStruct(Vector) if isinstance( Vector, list ): Vector = self.smeshpyD.MakeDirStruct(*Vector) @@ -3803,7 +3895,7 @@ class Mesh: def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): Axis = self.smeshpyD.GetAxisStruct(Axis) AngleInRadians,Parameters,hasVars = ParseAngles(AngleInRadians) Parameters = Axis.parameters + var_separator + Parameters @@ -3824,7 +3916,7 @@ class Mesh: def RotateMakeMesh (self, IDsOfElements, Axis, AngleInRadians, MakeGroups=0, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)): + if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): Axis = self.smeshpyD.GetAxisStruct(Axis) AngleInRadians,Parameters,hasVars = ParseAngles(AngleInRadians) Parameters = Axis.parameters + var_separator + Parameters @@ -3844,7 +3936,7 @@ class Mesh: def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False): if (isinstance(theObject, Mesh)): theObject = theObject.GetMesh() - if (isinstance(Axis, geompyDC.GEOM._objref_GEOM_Object)): + if (isinstance(Axis, geomBuilder.GEOM._objref_GEOM_Object)): Axis = self.smeshpyD.GetAxisStruct(Axis) AngleInRadians,Parameters,hasVars = ParseAngles(AngleInRadians) Parameters = Axis.parameters + ":" + Parameters @@ -3865,7 +3957,7 @@ class Mesh: def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""): if (isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if (isinstance(Axis, geompyDC.GEOM._objref_GEOM_Object)): + if (isinstance(Axis, geomBuilder.GEOM._objref_GEOM_Object)): Axis = self.smeshpyD.GetAxisStruct(Axis) AngleInRadians,Parameters,hasVars = ParseAngles(AngleInRadians) Parameters = Axis.parameters + ":" + Parameters @@ -4299,7 +4391,7 @@ class algoCreator: def __call__(self,algo="",geom=0,*args): algoType = self.defaultAlgoType for arg in args + (algo,geom): - if isinstance( arg, geompyDC.GEOM._objref_GEOM_Object ): + if isinstance( arg, geomBuilder.GEOM._objref_GEOM_Object ): geom = arg if isinstance( arg, str ) and arg: algoType = arg @@ -4340,3 +4432,32 @@ class hypMethodWrapper: raise ValueError, detail # wrong variable name return result + +for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ): + # + #print "pluginName: ", pluginName + pluginBuilderName = pluginName + "Builder" + try: + exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName)) + except Exception, e: + print "Exception while loading %s: %s" % ( pluginBuilderName, e ) + continue + exec( "from salome.%s import %s" % (pluginName, pluginBuilderName)) + plugin = eval( pluginBuilderName ) + #print " plugin:" , str(plugin) + + # add methods creating algorithms to Mesh + for k in dir( plugin ): + if k[0] == '_': continue + algo = getattr( plugin, k ) + #print " algo:", str(algo) + if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ): + #print " meshMethod:" , str(algo.meshMethod) + if not hasattr( Mesh, algo.meshMethod ): + setattr( Mesh, algo.meshMethod, algoCreator() ) + pass + getattr( Mesh, algo.meshMethod ).add( algo ) + pass + pass + pass +del pluginName diff --git a/src/SMESH_SWIG/smesh_algorithm.py b/src/SMESH_SWIG/smesh_algorithm.py index eda19fea4..e72a81f8e 100644 --- a/src/SMESH_SWIG/smesh_algorithm.py +++ b/src/SMESH_SWIG/smesh_algorithm.py @@ -22,7 +22,7 @@ # This package is a part of SALOME %Mesh module Python API import salome -import geompyDC +from salome.geom import geomBuilder import SMESH ## The base class to define meshing algorithms @@ -32,8 +32,8 @@ import SMESH # # For each meshing algorithm, a python class inheriting from class %Mesh_Algorithm # should be defined. This descendant class should have two attributes defining the way -# it is created by class Mesh (see e.g. class @ref StdMeshersDC.StdMeshersDC_Segment "StdMeshersDC_Segment" -# in StdMeshersDC package): +# it is created by class Mesh (see e.g. class @ref StdMeshersBuilder.StdMeshersBuilder_Segment "StdMeshersBuilder_Segment" +# in StdMeshersBuilder package): # - @c meshMethod attribute defines name of method of class smesh.Mesh by calling which the # python class of algorithm is created; this method is dynamically added to the smesh.Mesh class # in runtime. For example, if in @c class MyPlugin_Algorithm this attribute is defined as @@ -167,7 +167,7 @@ class Mesh_Algorithm: ## Gets the name of the algorithm def GetName(self): - from smesh import GetName + from salome.smesh.smeshBuilder import GetName return GetName(self.algo) ## Sets the name to the algorithm @@ -191,7 +191,7 @@ class Mesh_Algorithm: ## Private method def Assign(self, algo, mesh, geom): - from smesh import AssureGeomPublished, TreatHypoStatus, GetName + from salome.smesh.smeshBuilder import AssureGeomPublished, TreatHypoStatus, GetName if geom is None: raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape" self.mesh = mesh @@ -222,7 +222,7 @@ class Mesh_Algorithm: ## Private method def Hypothesis (self, hyp, args=[], so="libStdMeshersEngine.so", UseExisting=0, CompareMethod=""): - from smesh import TreatHypoStatus, GetName + from salome.smesh.smeshBuilder import TreatHypoStatus, GetName hypo = None if UseExisting: if CompareMethod == "": CompareMethod = self.CompareHyp @@ -234,7 +234,7 @@ class Mesh_Algorithm: s = "=" for arg in args: argStr = str(arg) - if isinstance( arg, geompyDC.GEOM._objref_GEOM_Object ): + if isinstance( arg, geomBuilder.GEOM._objref_GEOM_Object ): argStr = arg.GetStudyEntry() if not argStr: argStr = "GEOM_Obj_%s", arg.GetEntry() if len( argStr ) > 10: @@ -274,7 +274,7 @@ class Mesh_Algorithm: raise TypeError, "ViscousLayers are supported by 3D algorithms only" if not "ViscousLayers" in self.GetCompatibleHypothesis(): raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName() - if ignoreFaces and isinstance( ignoreFaces[0], geompyDC.GEOM._objref_GEOM_Object ): + if ignoreFaces and isinstance( ignoreFaces[0], geomBuilder.GEOM._objref_GEOM_Object ): ignoreFaces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreFaces ] hyp = self.Hypothesis("ViscousLayers", [thickness, numberOfLayers, stretchFactor, ignoreFaces]) @@ -297,7 +297,7 @@ class Mesh_Algorithm: raise TypeError, "ViscousLayers2D are supported by 2D algorithms only" if not "ViscousLayers2D" in self.GetCompatibleHypothesis(): raise TypeError, "ViscousLayers2D are not supported by %s"%self.algo.GetName() - if ignoreEdges and isinstance( ignoreEdges[0], geompyDC.GEOM._objref_GEOM_Object ): + if ignoreEdges and isinstance( ignoreEdges[0], geomBuilder.GEOM._objref_GEOM_Object ): ignoreEdges = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreEdges ] hyp = self.Hypothesis("ViscousLayers2D", [thickness, numberOfLayers, stretchFactor, ignoreEdges]) @@ -311,30 +311,30 @@ class Mesh_Algorithm: # into a list acceptable to SetReversedEdges() of some 1D hypotheses # @ingroup l3_hypos_1dhyps def ReversedEdgeIndices(self, reverseList): - from smesh import FirstVertexOnCurve + from salome.smesh.smeshBuilder import FirstVertexOnCurve resList = [] geompy = self.mesh.geompyD for i in reverseList: if isinstance( i, int ): s = geompy.SubShapes(self.mesh.geom, [i])[0] - if s.GetShapeType() != geompyDC.GEOM.EDGE: + if s.GetShapeType() != geomBuilder.GEOM.EDGE: raise TypeError, "Not EDGE index given" resList.append( i ) - elif isinstance( i, geompyDC.GEOM._objref_GEOM_Object ): - if i.GetShapeType() != geompyDC.GEOM.EDGE: + elif isinstance( i, geomBuilder.GEOM._objref_GEOM_Object ): + if i.GetShapeType() != geomBuilder.GEOM.EDGE: raise TypeError, "Not an EDGE given" resList.append( geompy.GetSubShapeID(self.mesh.geom, i )) elif len( i ) > 1: e = i[0] v = i[1] - if not isinstance( e, geompyDC.GEOM._objref_GEOM_Object ) or \ - not isinstance( v, geompyDC.GEOM._objref_GEOM_Object ): + if not isinstance( e, geomBuilder.GEOM._objref_GEOM_Object ) or \ + not isinstance( v, geomBuilder.GEOM._objref_GEOM_Object ): raise TypeError, "A list item must be a tuple (edge, 1st_vertex_of_edge)" - if v.GetShapeType() == geompyDC.GEOM.EDGE and \ - e.GetShapeType() == geompyDC.GEOM.VERTEX: + if v.GetShapeType() == geomBuilder.GEOM.EDGE and \ + e.GetShapeType() == geomBuilder.GEOM.VERTEX: v,e = e,v - if e.GetShapeType() != geompyDC.GEOM.EDGE or \ - v.GetShapeType() != geompyDC.GEOM.VERTEX: + if e.GetShapeType() != geomBuilder.GEOM.EDGE or \ + v.GetShapeType() != geomBuilder.GEOM.VERTEX: raise TypeError, "A list item must be a tuple (edge, 1st_vertex_of_edge)" vFirst = FirstVertexOnCurve( e ) tol = geompy.Tolerance( vFirst )[-1] -- 2.39.2