mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 09:50:34 +05:00
PR: examples adaptation to geomBuilder
This commit is contained in:
parent
96551e154e
commit
f9343acc3c
@ -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----------------------------------------
|
||||||
@ -55,7 +61,6 @@ Id_face1 = geompy.addToStudy(face1,"Face1")
|
|||||||
|
|
||||||
|
|
||||||
#-----------------------------SMESH-------------------------------------------
|
#-----------------------------SMESH-------------------------------------------
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# -- Init mesh --
|
# -- Init mesh --
|
||||||
plane_mesh = salome.IDToObject( Id_face1)
|
plane_mesh = salome.IDToObject( Id_face1)
|
||||||
|
@ -26,8 +26,14 @@
|
|||||||
# Description : Create meshes to test extrusion of mesh elements along path
|
# Description : Create meshes to test extrusion of mesh elements along path
|
||||||
#
|
#
|
||||||
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
|
||||||
@ -53,7 +59,6 @@ id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2")
|
|||||||
|
|
||||||
|
|
||||||
#---------------------------------SMESH
|
#---------------------------------SMESH
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# create the path mesh
|
# create the path mesh
|
||||||
mesh1 = smesh.Mesh(ellipse1, "Path Mesh")
|
mesh1 = smesh.Mesh(ellipse1, "Path Mesh")
|
||||||
|
@ -26,8 +26,14 @@
|
|||||||
# Description : Create meshes to test extrusion of mesh elements along path
|
# Description : Create meshes to test extrusion of mesh elements along path
|
||||||
#
|
#
|
||||||
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 points to build two circles
|
# create points to build two circles
|
||||||
@ -51,8 +57,6 @@ idcircle = geompy.addToStudy(circle, "Circle")
|
|||||||
idface = geompy.addToStudy(face, "Circular face")
|
idface = geompy.addToStudy(face, "Circular face")
|
||||||
|
|
||||||
|
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# init a Mesh with the circular face
|
# init a Mesh with the circular face
|
||||||
mesh1 = smesh.Mesh(face, "Mesh on circular face")
|
mesh1 = smesh.Mesh(face, "Mesh on circular face")
|
||||||
|
|
||||||
|
@ -22,10 +22,16 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
import smesh
|
|
||||||
import math
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
import math
|
||||||
|
|
||||||
def GetNewNodes(mesh,Elems,OldNodes):
|
def GetNewNodes(mesh,Elems,OldNodes):
|
||||||
"""
|
"""
|
||||||
@ -55,7 +61,6 @@ def GetNewNodes(mesh,Elems,OldNodes):
|
|||||||
pass
|
pass
|
||||||
return newnodes
|
return newnodes
|
||||||
|
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# create empty mesh
|
# create empty mesh
|
||||||
mesh = smesh.Mesh()
|
mesh = smesh.Mesh()
|
||||||
@ -67,13 +72,13 @@ tol = 0.001
|
|||||||
n1 = mesh.AddNode(55,-5,0)
|
n1 = mesh.AddNode(55,-5,0)
|
||||||
n2 = mesh.AddNode(55,5,0)
|
n2 = mesh.AddNode(55,5,0)
|
||||||
e1 = mesh.AddEdge([n1,n2])
|
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)
|
mesh.ExtrusionSweep([e1],dir1,11)
|
||||||
# 2. create second edge and make extrusion along 0y
|
# 2. create second edge and make extrusion along 0y
|
||||||
n3 = mesh.AddNode(-5,-55,0)
|
n3 = mesh.AddNode(-5,-55,0)
|
||||||
n4 = mesh.AddNode(5,-55,0)
|
n4 = mesh.AddNode(5,-55,0)
|
||||||
e2 = mesh.AddEdge([n3,n4])
|
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)
|
mesh.ExtrusionSweep([e2],dir2,11)
|
||||||
|
|
||||||
# since result has coincident nodes and faces
|
# since result has coincident nodes and faces
|
||||||
@ -83,12 +88,12 @@ mesh.MergeNodes(nodes)
|
|||||||
mesh.MergeEqualElements()
|
mesh.MergeEqualElements()
|
||||||
|
|
||||||
# make extrusion faces along 0z
|
# make extrusion faces along 0z
|
||||||
faces = mesh.GetElementsByType(smesh.FACE)
|
faces = mesh.GetElementsByType(SMESH.FACE)
|
||||||
nbf = len(faces)
|
nbf = len(faces)
|
||||||
maxang = 2.0
|
maxang = 2.0
|
||||||
zstep = 5
|
zstep = 5
|
||||||
nbzsteps = 50
|
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
|
newfaces = [] # list for keeping created top faces
|
||||||
# during extrusion
|
# during extrusion
|
||||||
|
|
||||||
@ -121,7 +126,7 @@ for i in range(0,nbzsteps):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# rotate faces from newfaces
|
# 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):
|
for i in range(0,nbzsteps):
|
||||||
ang = maxang*(1-math.cos((i+1)*math.pi/nbzsteps))
|
ang = maxang*(1-math.cos((i+1)*math.pi/nbzsteps))
|
||||||
mesh.Rotate(newfaces[i],axisr1,ang,0)
|
mesh.Rotate(newfaces[i],axisr1,ang,0)
|
||||||
@ -135,7 +140,7 @@ n6 = mesh.AddNode(67.5,0,0)
|
|||||||
n7 = mesh.AddNode(70,0,0)
|
n7 = mesh.AddNode(70,0,0)
|
||||||
e56 = mesh.AddEdge([n5,n6])
|
e56 = mesh.AddEdge([n5,n6])
|
||||||
e67 = mesh.AddEdge([n6,n7])
|
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)
|
mesh.RotationSweep([e56,e67],axisr2, math.pi/6, 12, tol)
|
||||||
res = mesh.GetLastCreatedElems()
|
res = mesh.GetLastCreatedElems()
|
||||||
faces1 = []
|
faces1 = []
|
||||||
@ -152,7 +157,7 @@ n9 = mesh.AddNode(-67.5,0,0)
|
|||||||
n10 = mesh.AddNode(-70,0,0)
|
n10 = mesh.AddNode(-70,0,0)
|
||||||
e8 = mesh.AddEdge([n8,n9])
|
e8 = mesh.AddEdge([n8,n9])
|
||||||
e9 = mesh.AddEdge([n9,n10])
|
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)
|
mesh.RotationSweep([e8,e9],axisr3, math.pi/6, 12, tol)
|
||||||
res = mesh.GetLastCreatedElems()
|
res = mesh.GetLastCreatedElems()
|
||||||
faces2 = []
|
faces2 = []
|
||||||
@ -212,4 +217,4 @@ for i in range(0,nbrs):
|
|||||||
oldnodes = newnodes
|
oldnodes = newnodes
|
||||||
pass
|
pass
|
||||||
|
|
||||||
smesh.salome.sg.updateObjBrowser(1)
|
salome.sg.updateObjBrowser(1)
|
||||||
|
@ -25,7 +25,6 @@ from SMESH_test1 import *
|
|||||||
|
|
||||||
## Old style
|
## Old style
|
||||||
def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theElemType):
|
def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theElemType):
|
||||||
import geompy
|
|
||||||
if theShape != theSubShape:
|
if theShape != theSubShape:
|
||||||
aName = str(theSubShape)
|
aName = str(theSubShape)
|
||||||
geompy.addToStudyInFather(theShape,theSubShape,aName)
|
geompy.addToStudyInFather(theShape,theSubShape,aName)
|
||||||
@ -45,25 +44,23 @@ def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theEl
|
|||||||
|
|
||||||
## Current style
|
## Current style
|
||||||
def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType):
|
def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType):
|
||||||
import geompy
|
|
||||||
import smesh
|
|
||||||
if theShape != theSubShape:
|
if theShape != theSubShape:
|
||||||
aName = str(theSubShape)
|
aName = str(theSubShape)
|
||||||
geompy.addToStudyInFather(theShape,theSubShape,aName)
|
geompy.addToStudyInFather(theShape,theSubShape,aName)
|
||||||
|
|
||||||
theMesh.Compute()
|
theMesh.Compute()
|
||||||
aFilter = smesh.GetFilter(theElemType, smesh.FT_BelongToGeom, theSubShape)
|
aFilter = smesh.GetFilter(theElemType, SMESH.FT_BelongToGeom, theSubShape)
|
||||||
return aFilter.GetElementsId(theMesh.GetMesh())
|
return aFilter.GetElementsId(theMesh.GetMesh())
|
||||||
|
|
||||||
|
|
||||||
anElemType = smesh.FACE;
|
anElemType = SMESH.FACE;
|
||||||
print "anElemType =", anElemType
|
print "anElemType =", anElemType
|
||||||
#anIds = CheckBelongToGeomFilter(mesh,box,subShapeList[1],anElemType)
|
#anIds = CheckBelongToGeomFilter(mesh,box,subShapeList[1],anElemType)
|
||||||
anIds = CheckBelongToGeomFilter(mesh,box,box,anElemType)
|
anIds = CheckBelongToGeomFilter(mesh,box,box,anElemType)
|
||||||
print "Number of ids = ", len(anIds)
|
print "Number of ids = ", len(anIds)
|
||||||
print "anIds = ", anIds
|
print "anIds = ", anIds
|
||||||
## Check old version
|
## Check old version
|
||||||
#anIds = CheckBelongToGeomFilterOld(smesh.smesh,mesh.GetMesh(),box,box,anElemType)
|
#anIds = CheckBelongToGeomFilterOld(smesh,mesh.GetMesh(),box,box,anElemType)
|
||||||
#print "anIds = ", anIds
|
#print "anIds = ", anIds
|
||||||
|
|
||||||
salome.sg.updateObjBrowser(1);
|
salome.sg.updateObjBrowser(1);
|
||||||
|
@ -28,8 +28,14 @@
|
|||||||
# ! documentation generation to identify certain places of this file
|
# ! documentation generation to identify certain places of this file
|
||||||
#
|
#
|
||||||
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 a bottom box
|
## create a bottom box
|
||||||
Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.)
|
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, Fsup2, "Fsup")
|
||||||
geompy.addToStudyInFather(Box_sup, Finf2, "Finf")
|
geompy.addToStudyInFather(Box_sup, Finf2, "Finf")
|
||||||
|
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
## create a bottom mesh
|
## create a bottom mesh
|
||||||
Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf")
|
Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf")
|
||||||
@ -91,10 +96,10 @@ Ginf2=Mesh_sup.Group(Finf2, "Inf")
|
|||||||
## create compounds
|
## create compounds
|
||||||
# create a compound of two meshes with renaming groups with the same names and
|
# create a compound of two meshes with renaming groups with the same names and
|
||||||
# merging of elements with the given tolerance
|
# 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')
|
smesh.SetName(Compound1, 'Compound_with_RenamedGrps_and_MergeElems')
|
||||||
# create a compound of two meshes with uniting groups with the same names and
|
# create a compound of two meshes with uniting groups with the same names and
|
||||||
# creating groups of all elements
|
# 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')
|
smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
|
||||||
#end
|
#end
|
||||||
|
@ -50,11 +50,11 @@ geompy.AddObject(aGeomGroup2, 10)
|
|||||||
geompy.addToStudy(aGeomGroup1, "Group on Faces")
|
geompy.addToStudy(aGeomGroup1, "Group on Faces")
|
||||||
geompy.addToStudy(aGeomGroup2, "Group on Edges")
|
geompy.addToStudy(aGeomGroup2, "Group on Edges")
|
||||||
|
|
||||||
aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", smesh.FACE)
|
aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE)
|
||||||
aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", smesh.EDGE)
|
aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE)
|
||||||
|
|
||||||
print "Create aGroupOnShell - a group linked to a shell"
|
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 type =", aGroupOnShell.GetType()
|
||||||
print "aGroupOnShell size =", aGroupOnShell.Size()
|
print "aGroupOnShell size =", aGroupOnShell.Size()
|
||||||
print "aGroupOnShell ids :", aGroupOnShell.GetListOfID()
|
print "aGroupOnShell ids :", aGroupOnShell.GetListOfID()
|
||||||
|
@ -21,13 +21,8 @@
|
|||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# 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):
|
def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
|
||||||
aFilterMgr = smesh.smesh.CreateFilterManager()
|
aFilterMgr = smesh.CreateFilterManager()
|
||||||
aFilter = aFilterMgr.CreateFilter()
|
aFilter = aFilterMgr.CreateFilter()
|
||||||
|
|
||||||
aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
|
aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
|
||||||
@ -47,9 +42,9 @@ from SMESH_test1 import *
|
|||||||
mesh.Compute()
|
mesh.Compute()
|
||||||
|
|
||||||
# First way
|
# 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
|
# 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);
|
salome.sg.updateObjBrowser(1);
|
||||||
|
@ -26,9 +26,16 @@
|
|||||||
#Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey
|
#Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey
|
||||||
#####################################################################
|
#####################################################################
|
||||||
#
|
#
|
||||||
import geompy
|
|
||||||
import salome
|
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 os
|
||||||
import math
|
import math
|
||||||
|
|
||||||
@ -98,8 +105,6 @@ Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1")
|
|||||||
|
|
||||||
#Mesh creation
|
#Mesh creation
|
||||||
|
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# -- Init --
|
# -- Init --
|
||||||
shape_mesh = salome.IDToObject( Cut_1_ID )
|
shape_mesh = salome.IDToObject( Cut_1_ID )
|
||||||
|
|
||||||
@ -117,7 +122,7 @@ smesh.SetName(hAvLength, "AverageLength_"+str(theAverageLength))
|
|||||||
|
|
||||||
print "-------------------------- MaxElementArea"
|
print "-------------------------- MaxElementArea"
|
||||||
theMaxElementArea = 20
|
theMaxElementArea = 20
|
||||||
algoMef = mesh.Triangle(smesh.MEFISTO)
|
algoMef = mesh.Triangle(smeshBuilder.MEFISTO)
|
||||||
hArea = algoMef.MaxElementArea( theMaxElementArea )
|
hArea = algoMef.MaxElementArea( theMaxElementArea )
|
||||||
print hArea.GetName()
|
print hArea.GetName()
|
||||||
print hArea.GetId()
|
print hArea.GetId()
|
||||||
@ -126,7 +131,7 @@ smesh.SetName(hArea, "MaxElementArea_"+str(theMaxElementArea))
|
|||||||
|
|
||||||
print "-------------------------- MaxElementVolume"
|
print "-------------------------- MaxElementVolume"
|
||||||
theMaxElementVolume = 150
|
theMaxElementVolume = 150
|
||||||
algoNg = mesh.Tetrahedron(smesh.NETGEN)
|
algoNg = mesh.Tetrahedron(smeshBuilder.NETGEN)
|
||||||
hVolume = algoNg.MaxElementVolume( theMaxElementVolume )
|
hVolume = algoNg.MaxElementVolume( theMaxElementVolume )
|
||||||
print hVolume.GetName()
|
print hVolume.GetName()
|
||||||
print hVolume.GetId()
|
print hVolume.GetId()
|
||||||
|
@ -26,8 +26,15 @@
|
|||||||
# -- Rayon de la bariere
|
# -- Rayon de la bariere
|
||||||
#
|
#
|
||||||
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)
|
||||||
|
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
|
|
||||||
|
|
||||||
@ -119,8 +126,6 @@ print "number of Edges in alveole : ", len(subEdgeList)
|
|||||||
status = geompy.CheckShape(alveole)
|
status = geompy.CheckShape(alveole)
|
||||||
print " check status ", status
|
print " check status ", status
|
||||||
|
|
||||||
# ---- launch SMESH
|
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# ---- init a Mesh with the alveole
|
# ---- init a Mesh with the alveole
|
||||||
shape_mesh = salome.IDToObject( idalveole )
|
shape_mesh = salome.IDToObject( idalveole )
|
||||||
@ -155,7 +160,7 @@ print "-------------------------- MaxElementVolume"
|
|||||||
|
|
||||||
maxElementVolume = 0.5
|
maxElementVolume = 0.5
|
||||||
|
|
||||||
netgen3D = mesh.Tetrahedron(smesh.NETGEN)
|
netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
|
||||||
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
||||||
print hypVolume.GetName()
|
print hypVolume.GetName()
|
||||||
print hypVolume.GetId()
|
print hypVolume.GetId()
|
||||||
|
@ -27,10 +27,17 @@
|
|||||||
# Module : GEOM
|
# Module : GEOM
|
||||||
# $Header:
|
# $Header:
|
||||||
#
|
#
|
||||||
from geompy import *
|
import salome
|
||||||
from math import *
|
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.
|
# It is an example of creating a hexahedrical mesh on a sphere.
|
||||||
#
|
#
|
||||||
@ -42,20 +49,20 @@ import smesh
|
|||||||
Radius = 100.
|
Radius = 100.
|
||||||
Dist = Radius / 2.
|
Dist = Radius / 2.
|
||||||
Factor = 2.5
|
Factor = 2.5
|
||||||
Angle90 = pi / 2.
|
Angle90 = math.pi / 2.
|
||||||
NbSeg = 10
|
NbSeg = 10
|
||||||
|
|
||||||
PointsList = []
|
PointsList = []
|
||||||
ShapesList = []
|
ShapesList = []
|
||||||
|
|
||||||
#Basic Elements
|
#Basic Elements
|
||||||
P0 = MakeVertex(0., 0., 0.)
|
P0 = geompy.MakeVertex(0., 0., 0.)
|
||||||
P1 = MakeVertex(-Dist, -Dist, -Dist)
|
P1 = geompy.MakeVertex(-Dist, -Dist, -Dist)
|
||||||
P2 = MakeVertex(-Dist, -Dist, Dist)
|
P2 = geompy.MakeVertex(-Dist, -Dist, Dist)
|
||||||
P3 = MakeVertex(-Dist, Dist, Dist)
|
P3 = geompy.MakeVertex(-Dist, Dist, Dist)
|
||||||
P4 = MakeVertex(-Dist, Dist, -Dist)
|
P4 = geompy.MakeVertex(-Dist, Dist, -Dist)
|
||||||
|
|
||||||
VZ = MakeVectorDXDYDZ(0., 0., 1.)
|
VZ = geompy.MakeVectorDXDYDZ(0., 0., 1.)
|
||||||
|
|
||||||
#Construction Elements
|
#Construction Elements
|
||||||
PointsList.append(P1)
|
PointsList.append(P1)
|
||||||
@ -64,47 +71,46 @@ PointsList.append(P3)
|
|||||||
PointsList.append(P4)
|
PointsList.append(P4)
|
||||||
PointsList.append(P1)
|
PointsList.append(P1)
|
||||||
|
|
||||||
PolyLine = MakePolyline(PointsList)
|
PolyLine = geompy.MakePolyline(PointsList)
|
||||||
|
|
||||||
Face1 = MakeFace(PolyLine, 1)
|
Face1 = geompy.MakeFace(PolyLine, 1)
|
||||||
Face2 = MakeScaleTransform(Face1, P0, Factor)
|
Face2 = geompy.MakeScaleTransform(Face1, P0, Factor)
|
||||||
Face3 = MakeScaleTransform(Face1, P0, -1.)
|
Face3 = geompy.MakeScaleTransform(Face1, P0, -1.)
|
||||||
|
|
||||||
#Models
|
#Models
|
||||||
Sphere = MakeSphereR(Radius)
|
Sphere = geompy.MakeSphereR(Radius)
|
||||||
|
|
||||||
Block = MakeHexa2Faces(Face1, Face2)
|
Block = geompy.MakeHexa2Faces(Face1, Face2)
|
||||||
Cube = MakeHexa2Faces(Face1, Face3)
|
Cube = geompy.MakeHexa2Faces(Face1, Face3)
|
||||||
|
|
||||||
Common1 = MakeBoolean(Sphere, Block, 1)
|
Common1 = geompy.MakeBoolean(Sphere, Block, 1)
|
||||||
Common2 = MakeRotation(Common1, VZ, Angle90)
|
Common2 = geompy.MakeRotation(Common1, VZ, Angle90)
|
||||||
|
|
||||||
MultiBlock1 = MakeMultiTransformation1D(Common1, 20, -1, 3)
|
MultiBlock1 = geompy.MakeMultiTransformation1D(Common1, 20, -1, 3)
|
||||||
MultiBlock2 = MakeMultiTransformation1D(Common2, 30, -1, 3)
|
MultiBlock2 = geompy.MakeMultiTransformation1D(Common2, 30, -1, 3)
|
||||||
|
|
||||||
#Reconstruct sphere from several blocks
|
#Reconstruct sphere from several blocks
|
||||||
ShapesList.append(Cube)
|
ShapesList.append(Cube)
|
||||||
ShapesList.append(MultiBlock1)
|
ShapesList.append(MultiBlock1)
|
||||||
ShapesList.append(MultiBlock2)
|
ShapesList.append(MultiBlock2)
|
||||||
Compound = MakeCompound(ShapesList)
|
Compound = geompy.MakeCompound(ShapesList)
|
||||||
|
|
||||||
Result = MakeGlueFaces(Compound, 0.1)
|
Result = geompy.MakeGlueFaces(Compound, 0.1)
|
||||||
|
|
||||||
#addToStudy
|
#addToStudy
|
||||||
Id_Sphere = addToStudy(Sphere, "Sphere")
|
Id_Sphere = geompy.addToStudy(Sphere, "Sphere")
|
||||||
Id_Cube = addToStudy(Cube, "Cube")
|
Id_Cube = geompy.addToStudy(Cube, "Cube")
|
||||||
|
|
||||||
Id_Common1 = addToStudy(Common1, "Common1")
|
Id_Common1 = geompy.addToStudy(Common1, "Common1")
|
||||||
Id_Common2 = addToStudy(Common2, "Common2")
|
Id_Common2 = geompy.addToStudy(Common2, "Common2")
|
||||||
|
|
||||||
Id_MultiBlock1 = addToStudy(MultiBlock1, "MultiBlock1")
|
Id_MultiBlock1 = geompy.addToStudy(MultiBlock1, "MultiBlock1")
|
||||||
Id_MultiBlock2 = addToStudy(MultiBlock2, "MultiBlock2")
|
Id_MultiBlock2 = geompy.addToStudy(MultiBlock2, "MultiBlock2")
|
||||||
|
|
||||||
Id_Result = addToStudy(Result, "Result")
|
Id_Result = geompy.addToStudy(Result, "Result")
|
||||||
|
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
#Meshing
|
#Meshing
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
my_hexa = smesh.Mesh(Result, "Sphere_Mesh")
|
my_hexa = smesh.Mesh(Result, "Sphere_Mesh")
|
||||||
algo = my_hexa.Segment()
|
algo = my_hexa.Segment()
|
||||||
algo.NumberOfSegments(NbSeg)
|
algo.NumberOfSegments(NbSeg)
|
||||||
|
@ -28,17 +28,22 @@
|
|||||||
# $Header$
|
# $Header$
|
||||||
#
|
#
|
||||||
import salome
|
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 math
|
||||||
import smesh
|
|
||||||
|
|
||||||
import GEOM_Spanner
|
import GEOM_Spanner
|
||||||
|
|
||||||
isBlocksTest = 0 # False
|
isBlocksTest = 0 # False
|
||||||
isMeshTest = 1 # True
|
isMeshTest = 1 # True
|
||||||
|
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
GEOM_Spanner.MakeSpanner(geompy, math, isBlocksTest, isMeshTest, smesh)
|
GEOM_Spanner.MakeSpanner(geompy, math, isBlocksTest, isMeshTest, smesh)
|
||||||
|
|
||||||
salome.sg.updateObjBrowser(1);
|
salome.sg.updateObjBrowser(1);
|
||||||
|
@ -31,16 +31,16 @@
|
|||||||
# Salome geometry and meshing for a box
|
# Salome geometry and meshing for a box
|
||||||
#
|
#
|
||||||
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)
|
||||||
|
|
||||||
from salome import sg
|
from salome import sg
|
||||||
import geompy
|
|
||||||
import smesh
|
|
||||||
|
|
||||||
|
|
||||||
# ---- launch GEOM
|
|
||||||
|
|
||||||
geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
|
|
||||||
|
|
||||||
###geom.GetCurrentStudy(salome.myStudy._get_StudyId())
|
|
||||||
|
|
||||||
# Plate
|
# Plate
|
||||||
|
|
||||||
@ -48,7 +48,6 @@ box = geompy.MakeBox(0.,0.,0.,1.,1.,1.)
|
|||||||
boxId = geompy.addToStudy(box,"box")
|
boxId = geompy.addToStudy(box,"box")
|
||||||
|
|
||||||
# ---- SMESH
|
# ---- SMESH
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# ---- init a Mesh
|
# ---- init a Mesh
|
||||||
|
|
||||||
|
@ -25,8 +25,14 @@
|
|||||||
# Hypothesis and algorithms for the mesh generation are global
|
# Hypothesis and algorithms for the mesh generation are global
|
||||||
#
|
#
|
||||||
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 2 boxes box1 and box2
|
# ---- define 2 boxes box1 and box2
|
||||||
@ -74,7 +80,6 @@ print "number of Edges in shell : ", len(subEdgeList)
|
|||||||
|
|
||||||
|
|
||||||
### ---------------------------- SMESH --------------------------------------
|
### ---------------------------- SMESH --------------------------------------
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# ---- init a Mesh with the shell
|
# ---- init a Mesh with the shell
|
||||||
|
|
||||||
@ -109,7 +114,7 @@ print "-------------------------- MaxElementVolume"
|
|||||||
|
|
||||||
maxElementVolume = 500
|
maxElementVolume = 500
|
||||||
|
|
||||||
netgen3D = mesh.Tetrahedron(smesh.NETGEN)
|
netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
|
||||||
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
||||||
print hypVolume.GetName()
|
print hypVolume.GetName()
|
||||||
print hypVolume.GetId()
|
print hypVolume.GetId()
|
||||||
|
@ -26,9 +26,14 @@
|
|||||||
# Hypothesis and algorithms for the mesh generation are global
|
# Hypothesis and algorithms for the mesh generation are global
|
||||||
#
|
#
|
||||||
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 3 boxes box1, box2 and box3
|
# ---- define 3 boxes box1, box2 and box3
|
||||||
|
|
||||||
@ -85,7 +90,6 @@ print "number of Edges in shell : ", len(subEdgeList)
|
|||||||
|
|
||||||
|
|
||||||
### ---------------------------- SMESH --------------------------------------
|
### ---------------------------- SMESH --------------------------------------
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# ---- init a Mesh with the shell
|
# ---- init a Mesh with the shell
|
||||||
|
|
||||||
@ -120,7 +124,7 @@ print "-------------------------- MaxElementVolume"
|
|||||||
|
|
||||||
maxElementVolume = 500
|
maxElementVolume = 500
|
||||||
|
|
||||||
netgen3D = mesh.Tetrahedron(smesh.NETGEN)
|
netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
|
||||||
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
||||||
print hypVolume.GetName()
|
print hypVolume.GetName()
|
||||||
print hypVolume.GetId()
|
print hypVolume.GetId()
|
||||||
|
@ -25,9 +25,14 @@
|
|||||||
# the mesh generation are global
|
# the mesh generation are global
|
||||||
#
|
#
|
||||||
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 boxe
|
# ---- define a boxe
|
||||||
|
|
||||||
@ -46,7 +51,6 @@ print "number of Edges in box : ", len(subEdgeList)
|
|||||||
|
|
||||||
|
|
||||||
### ---------------------------- SMESH --------------------------------------
|
### ---------------------------- SMESH --------------------------------------
|
||||||
smesh.SetCurrentStudy(salome.myStudy)
|
|
||||||
|
|
||||||
# ---- init a Mesh with the boxe
|
# ---- init a Mesh with the boxe
|
||||||
|
|
||||||
@ -79,7 +83,7 @@ print "-------------------------- MaxElementVolume"
|
|||||||
|
|
||||||
maxElementVolume = 500
|
maxElementVolume = 500
|
||||||
|
|
||||||
netgen3D = mesh.Tetrahedron(smesh.NETGEN)
|
netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
|
||||||
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
|
||||||
print hypVolume.GetName()
|
print hypVolume.GetName()
|
||||||
print hypVolume.GetId()
|
print hypVolume.GetId()
|
||||||
|
@ -66,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")
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user