From 682bea02c02b73b9d4ed325262b7a81340777ca0 Mon Sep 17 00:00:00 2001 From: prascle Date: Wed, 13 Mar 2013 20:34:41 +0000 Subject: [PATCH] PR: examples adaptation --- doc/salome/examples/3dmesh.py | 37 ++++++----- 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 +++++--- src/OBJECT/SMESH_SVTKActor.cxx | 4 +- src/SMESH_SWIG/smeshBuilder.py | 48 +++++++++++--- 11 files changed, 180 insertions(+), 90 deletions(-) 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/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/src/OBJECT/SMESH_SVTKActor.cxx b/src/OBJECT/SMESH_SVTKActor.cxx index 48ad86910..977e7987b 100644 --- a/src/OBJECT/SMESH_SVTKActor.cxx +++ b/src/OBJECT/SMESH_SVTKActor.cxx @@ -164,8 +164,8 @@ SMESH_SVTKActor ::Initialize() { Superclass::Initialize(); - my0DActor->SetInput(my0DGrid); - myBallActor->SetInput(myBallGrid); + my0DActor->SetInputData(my0DGrid); + myBallActor->SetInputData(myBallGrid); } diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 9e31ea0e8..70f3721bb 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -277,7 +277,7 @@ def AssureGeomPublished(mesh, geom, name=''): ## Return the first vertex of a geometrical edge by ignoring orientation def FirstVertexOnCurve(edge): - vv = geomBuilder.SubShapeAll( edge, geomBuilder.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] @@ -303,6 +303,9 @@ 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): def __new__(cls): @@ -409,7 +412,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): # @return SMESH.DirStruct # @ingroup l1_auxiliary def GetDirStruct(self,theVector): - vertices = self.geompyD.SubShapeAll( theVector, geomBuilder.ShapeType["VERTEX"] ) + vertices = self.geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] ) if(len(vertices) != 2): print "Error: vector object is incorrect." return None @@ -432,10 +435,10 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): # @return SMESH.AxisStruct # @ingroup l1_auxiliary def GetAxisStruct(self,theObj): - edges = self.geompyD.SubShapeAll( theObj, geomBuilder.ShapeType["EDGE"] ) + edges = self.geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] ) if len(edges) > 1: - vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.ShapeType["VERTEX"] ) - vertex3, vertex4 = self.geompyD.SubShapeAll( edges[1], geomBuilder.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) @@ -446,7 +449,7 @@ class smeshBuilder(object, 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], geomBuilder.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]) @@ -1003,8 +1006,37 @@ import omniORB #Registering the new proxy for SMESH_Gen 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 @@ -1173,7 +1205,7 @@ class Mesh: # @ingroup l1_auxiliary def MeshDimension(self): if self.mesh.HasShapeToMesh(): - shells = self.geompyD.SubShapeAllIDs( self.geom, geomBuilder.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 : @@ -1636,7 +1668,7 @@ class Mesh: elif tgeo == "SOLID" or tgeo == "COMPSOLID": typ = VOLUME elif tgeo == "COMPOUND": - sub = self.geompyD.SubShapeAll( shape, geomBuilder.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] ) -- 2.39.2