1 #==============================================================================
3 # Bug (from script, bug) : hexaedre_modified.py, PAL6194, PAL7153
4 # Modified : 25/11/2004
5 # Author : Kovaltchuk Alexey
7 #==============================================================================
16 # -----------------------------------------------------------------------------
18 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
19 myBuilder = salome.myStudy.NewBuilder()
20 gg = salome.ImportComponentGUI("GEOM")
23 ShapeTypeCompSolid = 1
36 p0 = geompy.MakeVertex(0., 0., 0.)
37 px = geompy.MakeVertex(100., 0., 0.)
38 py = geompy.MakeVertex(0., 100., 0.)
39 pz = geompy.MakeVertex(0., 0., 100.)
40 vx = geompy.MakeVector(p0, px)
41 vy = geompy.MakeVector(p0, py)
42 vz = geompy.MakeVector(p0, pz)
44 sphereExt = geompy.MakeSphere( 0., 0., 0., 400.)
45 sphereInt = geompy.MakeSphere( 0.,-50., 0., 350.)
46 sphereA = geompy.MakeSphere( -400., 50., 50., 400.)
47 sphereB = geompy.MakeSphere( 350.,-50.,-50., 350.)
48 ptcyle = geompy.MakeVertex(0., -300., -450.)
49 cylindre = geompy.MakeCylinder(ptcyle,vz,500.,900.)
51 vol1=geompy.MakeCut(sphereExt,sphereA)
52 vol2=geompy.MakeCut(vol1,sphereB)
53 vol3=geompy.MakeCut(vol2,cylindre)
54 blob=geompy.MakeCut(vol3,sphereInt)
56 idblob = geompy.addToStudy(blob,"blob")
59 aretes = geompy.SubShapeAllSorted(blob, ShapeTypeEdge)
62 # -------------------------------
63 # --- numerotation des aretes
65 ## edname="arete%d"%eid
66 ## idedge=geompy.addToStudy(edge,edname)
69 salome.sg.updateObjBrowser(1)
71 # --- epaisseur 0 2 8 10
72 # --- hauteur 1 3 9 11
75 # -----------------------------------------------------------------------------
77 print "-------------------------- mesh"
81 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
82 smesh.SetCurrentStudy(salome.myStudy)
84 # ---- create Hypothesis
85 print "-------------------------- create Hypothesis"
87 hypNbSegA=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
88 hypNbSegA.SetNumberOfSegments(numberOfSegments)
90 hypNbSegB=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
91 hypNbSegB.SetNumberOfSegments(numberOfSegments)
93 hypNbSegC=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
94 hypNbSegC.SetNumberOfSegments(numberOfSegments)
96 # ---- create Algorithms
97 print "-------------------------- create Algorithms"
98 regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
99 quad2D=smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
100 hexa3D=smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
102 # ---- init a Mesh with the geom shape
104 myMesh=smesh.CreateMesh(shape_mesh)
106 # ---- add hypothesis and algorithms to mesh
107 print "-------------------------- add hypothesis to mesh"
108 myMesh.AddHypothesis(shape_mesh,regular1D)
109 myMesh.AddHypothesis(shape_mesh,quad2D)
110 myMesh.AddHypothesis(shape_mesh,hexa3D)
112 #myMesh.AddHypothesis(shape_mesh,hypNbSeg)
114 myMesh.AddHypothesis(aretes[0],hypNbSegA)
115 myMesh.AddHypothesis(aretes[2],hypNbSegA)
116 myMesh.AddHypothesis(aretes[8],hypNbSegA)
117 myMesh.AddHypothesis(aretes[10],hypNbSegA)
119 myMesh.AddHypothesis(aretes[1],hypNbSegC)
120 myMesh.AddHypothesis(aretes[3],hypNbSegC)
121 myMesh.AddHypothesis(aretes[9],hypNbSegC)
122 myMesh.AddHypothesis(aretes[11],hypNbSegC)
124 myMesh.AddHypothesis(aretes[4],hypNbSegB)
125 myMesh.AddHypothesis(aretes[5],hypNbSegB)
126 myMesh.AddHypothesis(aretes[6],hypNbSegB)
127 myMesh.AddHypothesis(aretes[7],hypNbSegB)
131 print "-------------------------- compute mesh"
132 ret=smesh.Compute(myMesh, shape_mesh)
135 #log=myMesh.GetLog(0) # no erase trace
138 print "Information about the Mesh:"
139 print "Number of nodes : ", myMesh.NbNodes()
140 print "Number of edges : ", myMesh.NbEdges()
141 print "Number of faces : ", myMesh.NbFaces()
142 print "Number of quadrangles : ", myMesh.NbQuadrangles()
143 print "Number of volumes : ", myMesh.NbVolumes()
144 print "Number of hexahedrons : ", myMesh.NbHexas()
146 print "problem when Computing the mesh"
148 salome.sg.updateObjBrowser(1)