From 1d6c201310b5d960b46d8501a8d214babe74c07f Mon Sep 17 00:00:00 2001 From: prascle Date: Thu, 14 Mar 2013 08:43:02 +0000 Subject: [PATCH] PR: examples adaptation --- .../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 ++++++++----- src/SMESH_SWIG/SMESH_mechanic.py | 10 +++++-- 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 +++++++++---------- 22 files changed, 232 insertions(+), 98 deletions(-) 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/src/SMESH_SWIG/SMESH_mechanic.py b/src/SMESH_SWIG/SMESH_mechanic.py index 5411c8dfd..8db198037 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/ex29_refine.py b/src/SMESH_SWIG/ex29_refine.py index 8363ea81a..34798ab01 100644 --- a/src/SMESH_SWIG/ex29_refine.py +++ b/src/SMESH_SWIG/ex29_refine.py @@ -21,8 +21,15 @@ # ======================================= # Procedure that take a triangulation and split all triangles in 4 others triangles # -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 os @@ -81,10 +88,10 @@ def triangle(m, f, n1, n2, n3): def SplitTrianglesIn4(m): # Get all triangles - triangles = m.GetElementsByType(smesh.FACE) + triangles = m.GetElementsByType(SMESH.FACE) # Remove all edges - m.RemoveElements(m.GetElementsByType(smesh.EDGE)) + m.RemoveElements(m.GetElementsByType(SMESH.EDGE)) # Get the list of nodes (ids) associated with the CAD vertices shape = m.GetShape() @@ -222,4 +229,4 @@ MyMesh.ExportMED(path+str(NbCells4)+"_triangles.med", 0) # Update the object browser # ------------------------- -geompy.salome.sg.updateObjBrowser(1) +salome.sg.updateObjBrowser(1) diff --git a/src/SMESH_SWIG/ex30_groupsOp.py b/src/SMESH_SWIG/ex30_groupsOp.py index 5bab30823..d6443cec4 100755 --- a/src/SMESH_SWIG/ex30_groupsOp.py +++ b/src/SMESH_SWIG/ex30_groupsOp.py @@ -18,18 +18,17 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -import sys import salome -import geompy -import math -import SALOMEDS -import SMESH -import smesh - salome.salome_init() -aStudyId = salome.myStudy._get_StudyId() +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 -geompy.init_geom(salome.myStudy) global Face_1 Face_1 = geompy.MakeFaceHW(100, 100, 1) geompy.addToStudy( Face_1, "Face_1" ) @@ -51,7 +50,7 @@ aListOfElems = [ 52, 53, 54, 55, 56, 57, 72, 73, 74, 75, 76, 77, 82, 83, 84, 85, 86, 87 ] -aRedGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Red" ) +aRedGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Red" ) aRedGroup.Add( aListOfElems ); aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) ) @@ -64,7 +63,7 @@ aListOfElems = [ 55, 56, 57, 58, 59, 115, 116, 117, 118, 119, 125, 126, 127, 128, 129 ] -aGreenGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Green" ) +aGreenGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Green" ) aGreenGroup.Add( aListOfElems ); aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) ) @@ -75,7 +74,7 @@ aListOfElems = [ 63, 64, 65, 66, 67, 68, 103, 104, 105, 106, 107, 108, 113, 114, 115, 116, 117, 118 ] -aBlueGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Blue" ) +aBlueGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Blue" ) aBlueGroup.Add( aListOfElems ); aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) ) diff --git a/src/SMESH_SWIG/ex30_tepal.py b/src/SMESH_SWIG/ex30_tepal.py index ece87736d..379e84268 100644 --- a/src/SMESH_SWIG/ex30_tepal.py +++ b/src/SMESH_SWIG/ex30_tepal.py @@ -22,8 +22,15 @@ # import os -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) # Parameters # ---------- @@ -53,7 +60,7 @@ m = smesh.Mesh(cylinder) # 2D mesh with BLSURF # ------------------- -algo2d = m.Triangle(smesh.BLSURF) +algo2d = m.Triangle(smeshBuilder.BLSURF) algo2d.SetPhysicalMesh(1) algo2d.SetPhySize(5) @@ -63,7 +70,7 @@ algo2d.SetGeometricMesh(0) # 3D mesh with tepal # ------------------ -algo3d = m.Tetrahedron(smesh.GHS3DPRL) +algo3d = m.Tetrahedron(smeshBuilder.GHS3DPRL) algo3d.SetMEDName(results) algo3d.SetNbPart(4) diff --git a/src/SMESH_SWIG/ex31_dimGroup.py b/src/SMESH_SWIG/ex31_dimGroup.py index ae8daeb0c..00764a9b4 100755 --- a/src/SMESH_SWIG/ex31_dimGroup.py +++ b/src/SMESH_SWIG/ex31_dimGroup.py @@ -18,20 +18,17 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -import sys import salome -import geompy -import math -import SALOMEDS -import SMESH -import smesh - salome.salome_init() -aStudyId = salome.myStudy._get_StudyId() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -geompy.init_geom(salome.myStudy) +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import math -geompy.init_geom(salome.myStudy) global Box_1 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) geompy.addToStudy( Box_1, "Box_1" ) @@ -50,18 +47,18 @@ isDone = Mesh_1.Compute() aListOf3d_1=range(721,821) -aGrp3D_1=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 1" ) +aGrp3D_1=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 1" ) aGrp3D_1.Add( aListOf3d_1 ) aListOf3d_2=range(821, 921) -aGrp3D_2=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 2" ) +aGrp3D_2=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 2" ) aGrp3D_2.Add( aListOf3d_2 ) -aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.FACE, "Faces" ) +aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.FACE, "Faces" ) -aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.EDGE, "Edges" ) +aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.EDGE, "Edges" ) -aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.NODE, "Nodes" ) +aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.NODE, "Nodes" ) salome.sg.updateObjBrowser( 1 ) -- 2.39.2