mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-05 18:54:18 +05:00
PR: examples adaptation
This commit is contained in:
parent
2e7bfd1664
commit
96551e154e
@ -25,17 +25,16 @@
|
|||||||
# Author : Sergey LITONIN
|
# Author : Sergey LITONIN
|
||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#
|
#
|
||||||
import smesh
|
|
||||||
import SMESH_mechanic
|
import SMESH_mechanic
|
||||||
|
|
||||||
salome = smesh.salome
|
import SMESH, SALOMEDS
|
||||||
mesh = SMESH_mechanic.mesh
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
# ---- Criterion : AREA > 100
|
# ---- Criterion : AREA > 100
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
@ -47,7 +46,7 @@ print "Criterion: Area > 100 Nb = ", len( anIds )
|
|||||||
# ---- Criterion : Taper > 3e-15
|
# ---- Criterion : Taper > 3e-15
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
@ -59,7 +58,7 @@ print "Criterion: Taper > 3e-15 Nb = ", len( anIds )
|
|||||||
# ---- Criterion : ASPECT RATIO > 1.3
|
# ---- Criterion : ASPECT RATIO > 1.3
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
@ -71,7 +70,7 @@ print "Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds )
|
|||||||
# ---- Criterion : MINIMUM ANGLE < 30
|
# ---- Criterion : MINIMUM ANGLE < 30
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
@ -83,7 +82,7 @@ print "Criterion: Minimum Angle < 30 Nb = ", len( anIds )
|
|||||||
# ---- Criterion : Warp > 2e-13
|
# ---- Criterion : Warp > 2e-13
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
@ -95,7 +94,7 @@ print "Criterion: Warp > 2e-13 Nb = ", len( anIds )
|
|||||||
# ---- Criterion : Skew > 18
|
# ---- Criterion : Skew > 18
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
@ -107,7 +106,7 @@ print "Criterion: Skew > 18 Nb = ", len( anIds )
|
|||||||
# Criterion : Length > 10
|
# Criterion : Length > 10
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
@ -119,7 +118,7 @@ print "Criterion: Length > 10 Nb = ", len( anIds )
|
|||||||
# Criterion : Borders at multi-connections = 2
|
# Criterion : Borders at multi-connections = 2
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
@ -131,7 +130,7 @@ print "Criterion: Borders at multi-connections = 2 Nb = ", len( anIds )
|
|||||||
# Criterion : Element Diameter 2D > 10
|
# Criterion : Element Diameter 2D > 10
|
||||||
|
|
||||||
# create group
|
# 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
|
# print result
|
||||||
anIds = aGroup.GetIDs()
|
anIds = aGroup.GetIDs()
|
||||||
|
@ -33,8 +33,14 @@
|
|||||||
# the mesh of some edges is thinner
|
# the mesh of some edges is thinner
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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 math
|
||||||
|
|
||||||
|
@ -27,7 +27,11 @@
|
|||||||
# $Header$
|
# $Header$
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
geompy = geomBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
@ -26,7 +26,10 @@
|
|||||||
# Hypothesis and algorithms for the mesh generation are global
|
# Hypothesis and algorithms for the mesh generation are global
|
||||||
#
|
#
|
||||||
import SMESH_fixation
|
import SMESH_fixation
|
||||||
import smesh
|
|
||||||
|
import SMESH, SALOMEDS
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
compshell = SMESH_fixation.compshell
|
compshell = SMESH_fixation.compshell
|
||||||
idcomp = SMESH_fixation.idcomp
|
idcomp = SMESH_fixation.idcomp
|
||||||
|
@ -26,7 +26,10 @@
|
|||||||
# The new Netgen algorithm is used that discretizes baoundaries itself
|
# The new Netgen algorithm is used that discretizes baoundaries itself
|
||||||
#
|
#
|
||||||
import SMESH_fixation
|
import SMESH_fixation
|
||||||
import smesh
|
|
||||||
|
import SMESH, SALOMEDS
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
compshell = SMESH_fixation.compshell
|
compshell = SMESH_fixation.compshell
|
||||||
idcomp = SMESH_fixation.idcomp
|
idcomp = SMESH_fixation.idcomp
|
||||||
@ -51,10 +54,10 @@ smesh.SetCurrentStudy(salome.myStudy)
|
|||||||
print "-------------------------- create Mesh, algorithm, hypothesis"
|
print "-------------------------- create Mesh, algorithm, hypothesis"
|
||||||
|
|
||||||
mesh = smesh.Mesh(compshell, "MeshcompShel");
|
mesh = smesh.Mesh(compshell, "MeshcompShel");
|
||||||
netgen = mesh.Tetrahedron(smesh.FULL_NETGEN)
|
netgen = mesh.Tetrahedron(smeshBuilder.FULL_NETGEN)
|
||||||
netgen.SetMaxSize( 50 )
|
netgen.SetMaxSize( 50 )
|
||||||
#netgen.SetSecondOrder( 0 )
|
#netgen.SetSecondOrder( 0 )
|
||||||
netgen.SetFineness( smesh.Fine )
|
netgen.SetFineness( smeshBuilder.Fine )
|
||||||
#netgen.SetOptimize( 1 )
|
#netgen.SetOptimize( 1 )
|
||||||
|
|
||||||
salome.sg.updateObjBrowser(1)
|
salome.sg.updateObjBrowser(1)
|
||||||
|
@ -25,8 +25,12 @@
|
|||||||
# SMESH_fixation.py
|
# SMESH_fixation.py
|
||||||
# Hypothesis and algorithms for the mesh generation are global
|
# Hypothesis and algorithms for the mesh generation are global
|
||||||
#
|
#
|
||||||
|
|
||||||
import SMESH_fixation
|
import SMESH_fixation
|
||||||
import smesh
|
|
||||||
|
import SMESH, SALOMEDS
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
compshell = SMESH_fixation.compshell
|
compshell = SMESH_fixation.compshell
|
||||||
idcomp = SMESH_fixation.idcomp
|
idcomp = SMESH_fixation.idcomp
|
||||||
@ -93,7 +97,7 @@ print "-------------------------- MaxElementVolume"
|
|||||||
|
|
||||||
maxElementVolume = 1000
|
maxElementVolume = 1000
|
||||||
|
|
||||||
netgen3D = mesh.Tetrahedron(smesh.NETGEN)
|
netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
|
||||||
netgen3D.SetName("NETGEN_3D")
|
netgen3D.SetName("NETGEN_3D")
|
||||||
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
||||||
print hypVolume.GetName()
|
print hypVolume.GetName()
|
||||||
|
@ -26,8 +26,14 @@
|
|||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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 --------------------------------------
|
# ---------------------------- GEOM --------------------------------------
|
||||||
|
@ -22,8 +22,14 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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
|
# Create box without one plane
|
||||||
@ -58,7 +64,7 @@ mesh.Compute()
|
|||||||
|
|
||||||
# Criterion : Free edges. Create group.
|
# 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)
|
aGroup = mesh.MakeGroupByCriterion("Free edges", aCriterion)
|
||||||
|
|
||||||
|
@ -30,15 +30,19 @@
|
|||||||
#==============================================================================
|
#==============================================================================
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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 math
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
|
|
||||||
myBuilder = salome.myStudy.NewBuilder()
|
|
||||||
gg = salome.ImportComponentGUI("GEOM")
|
gg = salome.ImportComponentGUI("GEOM")
|
||||||
|
|
||||||
ShapeTypeCompSolid = 1
|
ShapeTypeCompSolid = 1
|
||||||
|
@ -28,10 +28,15 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
|
||||||
import smesh
|
|
||||||
|
|
||||||
salome.salome_init()
|
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 --------------------------------------
|
# ---------------------------- GEOM --------------------------------------
|
||||||
|
|
||||||
# ---- define contigous arcs and segment to define a closed wire
|
# ---- 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 )
|
Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
|
||||||
|
|
||||||
# ---------------------------- SMESH --------------------------------------
|
# ---------------------------- SMESH --------------------------------------
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# -- Init --
|
# -- Init --
|
||||||
shape_mesh = salome.IDToObject( Id_mechanic )
|
shape_mesh = salome.IDToObject( Id_mechanic )
|
||||||
@ -194,37 +198,37 @@ mesh.SplitQuadObject(submesh2, 1)
|
|||||||
|
|
||||||
#2 cutting of triangles of the group
|
#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 ]
|
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)
|
GroupTriToQuad = mesh.MakeGroupByIds("Group of faces (quad)", SMESH.FACE, FacesTriToQuad)
|
||||||
mesh.TriToQuadObject(GroupTriToQuad, smesh.FT_AspectRatio , 1.57)
|
mesh.TriToQuadObject(GroupTriToQuad, SMESH.FT_AspectRatio , 1.57)
|
||||||
|
|
||||||
#3 extrusion of the group
|
#3 extrusion of the group
|
||||||
point = smesh.PointStruct(0, 0, 5)
|
point = SMESH.PointStruct(0, 0, 5)
|
||||||
vector = smesh.DirStruct(point)
|
vector = SMESH.DirStruct(point)
|
||||||
mesh.ExtrusionSweepObject(GroupTriToQuad, vector, 5)
|
mesh.ExtrusionSweepObject(GroupTriToQuad, vector, 5)
|
||||||
|
|
||||||
#4 mirror object
|
#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
|
#5 mesh translation
|
||||||
point = smesh.PointStruct(10, 10, 10)
|
point = SMESH.PointStruct(10, 10, 10)
|
||||||
vector = smesh.DirStruct(point)
|
vector = SMESH.DirStruct(point)
|
||||||
mesh.Translate([], vector, 0)
|
mesh.Translate([], vector, 0)
|
||||||
|
|
||||||
#6 mesh rotation
|
#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
|
angle180 = 180*3.141/180
|
||||||
mesh.Rotate([], axisXYZ, angle180, 0)
|
mesh.Rotate([], axisXYZ, angle180, 0)
|
||||||
|
|
||||||
#7 group smoothing
|
#7 group smoothing
|
||||||
FacesSmooth = [864, 933, 941, 950, 1005, 1013]
|
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)
|
mesh.SmoothObject(GroupSmooth, [], 20, 2, SMESH.CENTROIDAL_SMOOTH)
|
||||||
|
|
||||||
#8 rotation sweep object
|
#8 rotation sweep object
|
||||||
FacesRotate = [492, 493, 502, 503]
|
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
|
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)
|
mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5)
|
||||||
|
|
||||||
#9 reorientation of the submesh1
|
#9 reorientation of the submesh1
|
||||||
|
@ -26,11 +26,14 @@
|
|||||||
# The new Netgen algorithm is used that discretizes baoundaries itself
|
# The new Netgen algorithm is used that discretizes baoundaries itself
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
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
|
||||||
import smesh
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
# ---------------------------- GEOM --------------------------------------
|
# ---------------------------- GEOM --------------------------------------
|
||||||
|
|
||||||
@ -105,15 +108,14 @@ print "number of Faces in mechanic : ",len(subFaceList)
|
|||||||
print "number of Edges in mechanic : ",len(subEdgeList)
|
print "number of Edges in mechanic : ",len(subEdgeList)
|
||||||
|
|
||||||
### ---------------------------- SMESH --------------------------------------
|
### ---------------------------- SMESH --------------------------------------
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
print "-------------------------- create Mesh, algorithm, hypothesis"
|
print "-------------------------- create Mesh, algorithm, hypothesis"
|
||||||
|
|
||||||
mesh = smesh.Mesh(mechanic, "Mesh_mechanic");
|
mesh = smesh.Mesh(mechanic, "Mesh_mechanic");
|
||||||
netgen = mesh.Triangle(smesh.NETGEN)
|
netgen = mesh.Triangle(smeshBuilder.NETGEN)
|
||||||
netgen.SetMaxSize( 50 )
|
netgen.SetMaxSize( 50 )
|
||||||
#netgen.SetSecondOrder( 0 )
|
#netgen.SetSecondOrder( 0 )
|
||||||
netgen.SetFineness( smesh.Fine )
|
netgen.SetFineness( smeshBuilder.Fine )
|
||||||
netgen.SetQuadAllowed( 1 )
|
netgen.SetQuadAllowed( 1 )
|
||||||
#netgen.SetOptimize( 1 )
|
#netgen.SetOptimize( 1 )
|
||||||
|
|
||||||
|
@ -27,10 +27,14 @@
|
|||||||
# $Header$
|
# $Header$
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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 --------------------------------------
|
# ---------------------------- GEOM --------------------------------------
|
||||||
|
|
||||||
@ -105,7 +109,6 @@ print "number of Faces in mechanic : ",len(subFaceList)
|
|||||||
print "number of Edges in mechanic : ",len(subEdgeList)
|
print "number of Edges in mechanic : ",len(subEdgeList)
|
||||||
|
|
||||||
### ---------------------------- SMESH --------------------------------------
|
### ---------------------------- SMESH --------------------------------------
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
shape_mesh = salome.IDToObject( Id_mechanic )
|
shape_mesh = salome.IDToObject( Id_mechanic )
|
||||||
|
|
||||||
@ -125,7 +128,7 @@ smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment))
|
|||||||
|
|
||||||
maxElementArea = 20
|
maxElementArea = 20
|
||||||
|
|
||||||
algo2 = mesh.Triangle(smesh.MEFISTO)
|
algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
|
||||||
hypArea = algo2.MaxElementArea(maxElementArea)
|
hypArea = algo2.MaxElementArea(maxElementArea)
|
||||||
print hypArea.GetName()
|
print hypArea.GetName()
|
||||||
print hypArea.GetId()
|
print hypArea.GetId()
|
||||||
@ -135,7 +138,7 @@ smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
|
|||||||
|
|
||||||
maxElementVolume = 20
|
maxElementVolume = 20
|
||||||
|
|
||||||
algo3 = mesh.Tetrahedron(smesh.NETGEN)
|
algo3 = mesh.Tetrahedron(smeshBuilder.NETGEN)
|
||||||
hypVolume = algo3.MaxElementVolume(maxElementVolume)
|
hypVolume = algo3.MaxElementVolume(maxElementVolume)
|
||||||
print hypVolume.GetName()
|
print hypVolume.GetName()
|
||||||
print hypVolume.GetId()
|
print hypVolume.GetId()
|
||||||
|
@ -25,8 +25,14 @@
|
|||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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
|
import StdMeshers
|
||||||
|
|
||||||
|
@ -26,8 +26,14 @@
|
|||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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
|
# ---- define a box
|
||||||
|
|
||||||
@ -69,7 +75,7 @@ print hyp.GetName()
|
|||||||
print hyp.GetId()
|
print hyp.GetId()
|
||||||
print hyp.GetLength()
|
print hyp.GetLength()
|
||||||
|
|
||||||
algo_2 = mesh.Triangle(smesh.MEFISTO, box)
|
algo_2 = mesh.Triangle(smeshBuilder.MEFISTO, box)
|
||||||
hyp = algo_2.MaxElementArea(5000)
|
hyp = algo_2.MaxElementArea(5000)
|
||||||
print hyp.GetName()
|
print hyp.GetName()
|
||||||
print hyp.GetId()
|
print hyp.GetId()
|
||||||
|
@ -25,11 +25,14 @@
|
|||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
from geompy import geom
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
geompy = geomBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
|
import SMESH, SALOMEDS
|
||||||
myBuilder = salome.myStudy.NewBuilder()
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
# ---- define a box
|
# ---- define a box
|
||||||
|
|
||||||
|
@ -25,8 +25,14 @@
|
|||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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
|
# ---- define a box
|
||||||
|
|
||||||
|
@ -25,9 +25,14 @@
|
|||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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
|
# ---- define a box
|
||||||
|
|
||||||
@ -61,8 +66,6 @@ idedge = geompy.addToStudyInFather(face, edge, name)
|
|||||||
|
|
||||||
# ---- SMESH
|
# ---- SMESH
|
||||||
|
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# ---- Init a Mesh with the box
|
# ---- Init a Mesh with the box
|
||||||
|
|
||||||
mesh = smesh.Mesh(box, "Meshbox")
|
mesh = smesh.Mesh(box, "Meshbox")
|
||||||
|
@ -25,8 +25,16 @@
|
|||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#import salome
|
#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 math
|
||||||
import geompy
|
|
||||||
|
|
||||||
pi = math.pi
|
pi = math.pi
|
||||||
|
|
||||||
|
@ -22,8 +22,14 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
salome.salome_init()
|
||||||
import smesh
|
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
|
# ---- GEOM
|
||||||
@ -49,13 +55,13 @@ algo1 = mesh.Segment()
|
|||||||
algo1.NumberOfSegments(10)
|
algo1.NumberOfSegments(10)
|
||||||
|
|
||||||
# Set 2D algorithm/hypotheses to mesh
|
# Set 2D algorithm/hypotheses to mesh
|
||||||
algo2 = mesh.Triangle(smesh.MEFISTO)
|
algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
|
||||||
algo2.MaxElementArea(10)
|
algo2.MaxElementArea(10)
|
||||||
|
|
||||||
# Create submesh on face
|
# Create submesh on face
|
||||||
algo3 = mesh.Segment(face)
|
algo3 = mesh.Segment(face)
|
||||||
algo3.NumberOfSegments(10)
|
algo3.NumberOfSegments(10)
|
||||||
algo4 = mesh.Triangle(smesh.MEFISTO, face)
|
algo4 = mesh.Triangle(smeshBuilder.MEFISTO, face)
|
||||||
algo4.MaxElementArea(100)
|
algo4.MaxElementArea(100)
|
||||||
submesh = algo4.GetSubMesh()
|
submesh = algo4.GetSubMesh()
|
||||||
smesh.SetName(submesh, "SubMeshFace")
|
smesh.SetName(submesh, "SubMeshFace")
|
||||||
@ -63,11 +69,11 @@ smesh.SetName(submesh, "SubMeshFace")
|
|||||||
|
|
||||||
mesh.Compute()
|
mesh.Compute()
|
||||||
|
|
||||||
faces = submesh.GetElementsByType(smesh.FACE)
|
faces = submesh.GetElementsByType(SMESH.FACE)
|
||||||
if len(faces) > 1:
|
if len(faces) > 1:
|
||||||
print len(faces), len(faces)/2
|
print len(faces), len(faces)/2
|
||||||
group1 = mesh.CreateEmptyGroup(smesh.FACE,"Group of faces")
|
group1 = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces")
|
||||||
group2 = mesh.CreateEmptyGroup(smesh.FACE,"Another group of faces")
|
group2 = mesh.CreateEmptyGroup(SMESH.FACE,"Another group of faces")
|
||||||
group1.Add(faces[:int(len(faces)/2)])
|
group1.Add(faces[:int(len(faces)/2)])
|
||||||
group2.Add(faces[int(len(faces)/2):])
|
group2.Add(faces[int(len(faces)/2):])
|
||||||
|
|
||||||
|
@ -25,14 +25,19 @@
|
|||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#
|
#
|
||||||
import salome
|
import salome
|
||||||
import smesh
|
salome.salome_init()
|
||||||
import SALOMEDS
|
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 CORBA
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
def SetSObjName(theSObj,theName) :
|
def SetSObjName(theSObj,theName) :
|
||||||
ok, anAttr = theSObj.FindAttribute("AttributeName")
|
ok, anAttr = theSObj.FindAttribute("AttributeName")
|
||||||
if ok:
|
if ok:
|
||||||
|
Loading…
Reference in New Issue
Block a user