1 # creer des geometries, en selectionner une
8 #import SMESH_BasicHypothesis_idl
12 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry")
13 myBuilder = salome.myStudy.NewBuilder()
16 ShapeTypeCompSolid = 1
26 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
27 idb = geompy.addToStudy(box,"box")
29 # ---- add first face of box in study
31 subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
33 name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
35 idf=geompy.addToStudyInFather(box,face,name)
37 # ---- add shell from box in study
39 subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
40 shell = subShellList[0]
41 name = geompy.SubShapeName( shell._get_Name(), box._get_Name() )
43 ids=geompy.addToStudyInFather(box,shell,name)
45 # ---- add first edge of face in study
47 edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
49 name = geompy.SubShapeName( edge._get_Name(), face._get_Name() )
51 ide=geompy.addToStudyInFather(face,edge,name)
53 # ---- launch SMESH, init a Mesh with the box
57 # ---- create Hypothesis
59 print "-------------------------- create Hypothesis"
60 print "-------------------------- LocalLength"
61 hyp1=gen.CreateHypothesis("LocalLength")
64 hypo1 = hyp1._narrow(SMESH.SMESH_LocalLength)
65 print hypo1.GetLength()
67 print hypo1.GetLength()
69 print "-------------------------- bidon"
70 hyp3=gen.CreateHypothesis("bidon")
72 print "-------------------------- NumberOfSegments"
73 hyp3=gen.CreateHypothesis("NumberOfSegments")
74 hypo3=hyp3._narrow(SMESH.SMESH_NumberOfSegments)
75 hypo3.SetNumberOfSegments(7)
77 print hypo3.GetNumberOfSegments()
80 print "-------------------------- MaxElementArea"
81 hyp4=gen.CreateHypothesis("MaxElementArea")
82 hypo4=hyp4._narrow(SMESH.SMESH_MaxElementArea)
83 hypo4.SetMaxElementArea(5000)
85 print hypo4.GetMaxElementArea()
88 print "-------------------------- Regular_1D"
89 alg1=gen.CreateHypothesis("Regular_1D")
92 algo1=alg1._narrow(SMESH.SMESH_Algo)
93 listHyp=algo1.GetCompatibleHypothesis()
97 algo_1=alg1._narrow(SMESH.SMESH_Regular_1D)
100 print "-------------------------- MEFISTO_2D"
101 alg2=gen.CreateHypothesis("MEFISTO_2D")
104 algo2=alg2._narrow(SMESH.SMESH_Algo)
105 listHyp=algo2.GetCompatibleHypothesis()
108 algo_2=alg2._narrow(SMESH.SMESH_MEFISTO_2D)
111 # ---- add hypothesis to edge
113 print "-------------------------- add hypothesis to edge"
114 edge=salome.IDToObject(ide)
115 submesh=mesh.GetElementsOnShape(edge)
116 ret=mesh.AddHypothesis(edge,algo_1)
118 ret=mesh.AddHypothesis(edge,hypo1)
123 ##print "-------------------------- compute edge"
124 ##ret=gen.Compute(mesh,ide)
126 ##log=mesh.GetLog(1);
130 # ---- add hypothesis to box
132 print "-------------------------- add hypothesis to box"
133 box=salome.IDToObject(idb)
134 submesh=mesh.GetElementsOnShape(box)
135 ret=mesh.AddHypothesis(box,algo_1)
137 ret=mesh.AddHypothesis(box,hypo1)
139 ret=mesh.AddHypothesis(box,algo_2)
141 ret=mesh.AddHypothesis(box,hypo4)
146 print "-------------------------- compute face"
147 ret=gen.Compute(mesh,idf)
154 comType = a.commandType
156 for i in range(a.number):
165 print "AddNode %i - %g %g %g" % (ind, r1, r2, r3)
167 for i in range(a.number):
174 print "AddEdge %i - %i %i" % (ind, i1, i2)
176 for i in range(a.number):
185 print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)
189 ##print "-------------------------- compute box"
190 ##ret=gen.Compute(mesh,idb)
192 ##log=mesh.GetLog(1);
195 ##shell=salome.IDToObject(ids)
196 ##submesh=mesh.GetElementsOnShape(shell)
197 ##ret=mesh.AddHypothesis(shell,algo_1)
199 ##ret=mesh.AddHypothesis(shell,hypo1)
201 ##ret=gen.Compute(mesh,ids)