Code:
# -*- coding: iso-8859-1 -*-###
### This file is generated automatically by SALOME v6.5.0 with dump python functionality
###
import sys
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.notebook
sys.path.insert( 0, r'/home/dirk/salome/projects')
###
### GEOM component
###
import GEOM
import geompy
import math
import SALOMEDS
geompy.init_geom(theStudy)
Cylinder_1 = geompy.MakeCylinderRH(100, 300)
[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True)
[Shell_1] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["SHELL"], True)
listSubShapeIDs = geompy.SubShapeAllIDs(Face_1, geompy.ShapeType["FACE"])
listSubShapeIDs = geompy.SubShapeAllIDs(Face_2, geompy.ShapeType["FACE"])
listSubShapeIDs = geompy.SubShapeAllIDs(Face_3, geompy.ShapeType["FACE"])
inlet = geompy.CreateGroup(Face_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(inlet, [1])
wall = geompy.CreateGroup(Face_2, geompy.ShapeType["FACE"])
geompy.UnionIDs(wall, [1])
outlet = geompy.CreateGroup(Face_3, geompy.ShapeType["FACE"])
geompy.UnionIDs(outlet, [1])
Vertex_1 = geompy.MakeVertex(0, 0, 150)
Vertex_2 = geompy.MakeVertex(0, 0, 0)
Vector_1 = geompy.MakeVector(Vertex_2, Vertex_1)
Vector_1_vertex_3 = geompy.GetSubShape(Vector_1, [3])
Plane_1 = geompy.MakePlane(Vector_1_vertex_3, Vector_1, 2000)
Partition_1 = geompy.MakePartition([Cylinder_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
[Face_4,Face_5,Face_6,Face_7,Face_8] = geompy.ExtractShapes(Partition_1, geompy.ShapeType["FACE"], True)
listSubShapeIDs = geompy.SubShapeAllIDs(Face_4, geompy.ShapeType["FACE"])
listSubShapeIDs = geompy.SubShapeAllIDs(Face_5, geompy.ShapeType["FACE"])
listSubShapeIDs = geompy.SubShapeAllIDs(Face_6, geompy.ShapeType["FACE"])
listSubShapeIDs = geompy.SubShapeAllIDs(Face_7, geompy.ShapeType["FACE"])
listSubShapeIDs = geompy.SubShapeAllIDs(Face_8, geompy.ShapeType["FACE"])
bottom = geompy.CreateGroup(Face_4, geompy.ShapeType["FACE"])
geompy.UnionIDs(bottom, [1])
wall_lower = geompy.CreateGroup(Face_5, geompy.ShapeType["FACE"])
geompy.UnionIDs(wall_lower, [1])
intersection = geompy.CreateGroup(Face_6, geompy.ShapeType["FACE"])
geompy.UnionIDs(intersection, [1])
wall_upper = geompy.CreateGroup(Face_7, geompy.ShapeType["FACE"])
geompy.UnionIDs(wall_upper, [1])
top = geompy.CreateGroup(Face_8, geompy.ShapeType["FACE"])
geompy.UnionIDs(top, [1])
geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
geompy.addToStudyInFather( Cylinder_1, Face_1, 'Face_1' )
geompy.addToStudyInFather( Cylinder_1, Face_2, 'Face_2' )
geompy.addToStudyInFather( Cylinder_1, Face_3, 'Face_3' )
geompy.addToStudyInFather( Cylinder_1, Shell_1, 'Shell_1' )
geompy.addToStudyInFather( Face_1, inlet, 'inlet' )
geompy.addToStudyInFather( Face_2, wall, 'wall' )
geompy.addToStudyInFather( Face_3, outlet, 'outlet' )
geompy.addToStudy( Vertex_1, 'Vertex_1' )
geompy.addToStudy( Vertex_2, 'Vertex_2' )
geompy.addToStudy( Vector_1, 'Vector_1' )
geompy.addToStudyInFather( Vector_1, Vector_1_vertex_3, 'Vector_1:vertex_3' )
geompy.addToStudy( Plane_1, 'Plane_1' )
geompy.addToStudy( Partition_1, 'Partition_1' )
geompy.addToStudyInFather( Partition_1, Face_4, 'Face_4' )
geompy.addToStudyInFather( Partition_1, Face_5, 'Face_5' )
geompy.addToStudyInFather( Partition_1, Face_6, 'Face_6' )
geompy.addToStudyInFather( Partition_1, Face_7, 'Face_7' )
geompy.addToStudyInFather( Partition_1, Face_8, 'Face_8' )
geompy.addToStudyInFather( Face_4, bottom, 'bottom' )
geompy.addToStudyInFather( Face_5, wall_lower, 'wall_lower' )
geompy.addToStudyInFather( Face_6, intersection, 'intersection' )
geompy.addToStudyInFather( Face_7, wall_upper, 'wall_upper' )
geompy.addToStudyInFather( Face_8, top, 'top' )
###
### SMESH component
###
import smesh, SMESH, SALOMEDS
smesh.SetCurrentStudy(theStudy)
import StdMeshers
import NETGENPlugin
NETGEN_2D3D = smesh.CreateHypothesis('NETGEN_2D3D', 'NETGENEngine')
NETGEN_2D_ONLY = smesh.CreateHypothesis('NETGEN_2D_ONLY', 'NETGENEngine')
Mesh_Partition = smesh.Mesh(Partition_1)
Regular_1D = Mesh_Partition.Segment()
Nb_Segments_1 = smesh.CreateHypothesis('NumberOfSegments')
Nb_Segments_1.SetNumberOfSegments( 10 )
Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = smesh.CreateHypothesis('Quadrangle_2D')
Hexa_3D = smesh.CreateHypothesis('Hexa_3D')
Max_Size_1 = Regular_1D.MaxSize(41.2329)
MEFISTO_2D = Mesh_Partition.Triangle(algo=smesh.MEFISTO)
NETGEN_3D = Mesh_Partition.Tetrahedron()
NETGEN_2D = smesh.CreateHypothesis('NETGEN_2D', 'libNETGENEngine.so')
wall_lower_1 = Mesh_Partition.GroupOnGeom(wall_lower,'wall_lower',SMESH.FACE)
wall_upper_1 = Mesh_Partition.GroupOnGeom(wall_upper,'wall_upper',SMESH.FACE)
wall_lower_1.SetColor( SALOMEDS.Color( 0, 0.666667, 1 ))
wall_upper_1.SetColor( SALOMEDS.Color( 0, 0.666667, 1 ))
top_1 = Mesh_Partition.GroupOnGeom(top,'top',SMESH.FACE)
top_1.SetColor( SALOMEDS.Color( 0, 0.666667, 1 ))
bottom_1 = Mesh_Partition.GroupOnGeom(bottom,'bottom',SMESH.FACE)
bottom_1.SetColor( SALOMEDS.Color( 0, 0.666667, 1 ))
interior = Mesh_Partition.GroupOnGeom(Partition_1,'interior',SMESH.VOLUME)
interior.SetColor( SALOMEDS.Color( 0, 0.666667, 1 ))
intersection_1 = Mesh_Partition.GroupOnGeom(intersection,'intersection',SMESH.FACE)
intersection_1.SetColor( SALOMEDS.Color( 0, 0.666667, 1 ))
isDone = Mesh_Partition.Compute()
#Mesh_Partition.GetMesh().RemoveSubMesh( smeshObj_1 ) ### smeshObj_1 has not been yet created
## some objects were removed
aStudyBuilder = theStudy.NewBuilder()
## set object names
smesh.SetName(NETGEN_2D3D, 'NETGEN_2D3D')
smesh.SetName(NETGEN_2D_ONLY, 'NETGEN_2D_ONLY')
smesh.SetName(Mesh_Partition.GetMesh(), 'Mesh_Partition')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Quadrangle_2D, 'Quadrangle_2D')
smesh.SetName(Hexa_3D, 'Hexa_3D')
smesh.SetName(Max_Size_1, 'Max Size_1')
smesh.SetName(MEFISTO_2D.GetAlgorithm(), 'MEFISTO_2D')
smesh.SetName(NETGEN_3D.GetAlgorithm(), 'NETGEN_3D')
smesh.SetName(NETGEN_2D, 'NETGEN_2D')
smesh.SetName(wall_lower_1, 'wall_lower')
smesh.SetName(wall_upper_1, 'wall_upper')
smesh.SetName(top_1, 'top')
smesh.SetName(bottom_1, 'bottom')
smesh.SetName(interior, 'interior')
smesh.SetName(intersection_1, 'intersection')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)