# 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()
# ---- 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()
# ---- 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()
# ---- 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()
# ---- 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()
# ---- 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()
# 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()
# 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()
# 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()
# 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
# $Header$
#
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
import math
# -----------------------------------------------------------------------------
# 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
# 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
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)
# 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
maxElementVolume = 1000
-netgen3D = mesh.Tetrahedron(smesh.NETGEN)
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
netgen3D.SetName("NETGEN_3D")
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
print hypVolume.GetName()
#
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 --------------------------------------
#
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
# 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)
#==============================================================================
#
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
# -----------------------------------------------------------------------------
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-myBuilder = salome.myStudy.NewBuilder()
gg = salome.ImportComponentGUI("GEOM")
ShapeTypeCompSolid = 1
#-------------------------------------------------------------------------
#
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
Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
# ---------------------------- SMESH --------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
# -- Init --
shape_mesh = salome.IDToObject( Id_mechanic )
#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)
-mesh.SmoothObject(GroupSmooth, [], 20, 2, smesh.CENTROIDAL_SMOOTH)
+GroupSmooth = mesh.MakeGroupByIds("Group of faces (smooth)", SMESH.FACE, FacesSmooth)
+mesh.SmoothObject(GroupSmooth, [], 20, 2, SMESH.CENTROIDAL_SMOOTH)
#8 rotation sweep object
FacesRotate = [492, 493, 502, 503]
-GroupRotate = mesh.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
# 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 --------------------------------------
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 )
# $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 --------------------------------------
print "number of Edges in mechanic : ",len(subEdgeList)
### ---------------------------- SMESH --------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
shape_mesh = salome.IDToObject( Id_mechanic )
maxElementArea = 20
-algo2 = mesh.Triangle(smesh.MEFISTO)
+algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
hypArea = algo2.MaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
maxElementVolume = 20
-algo3 = mesh.Tetrahedron(smesh.NETGEN)
+algo3 = mesh.Tetrahedron(smeshBuilder.NETGEN)
hypVolume = algo3.MaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
# 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
# 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
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()
# 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
# 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
# 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
# ---- SMESH
-smesh.SetCurrentStudy(salome.myStudy)
-
# ---- Init a Mesh with the box
mesh = smesh.Mesh(box, "Meshbox")
# 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
#
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
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")
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):])
# 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: