]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESH_SWIG/SMESH_box.py
Salome HOME
PAL10872. Image for aspect ratio of a quadrangle
[modules/smesh.git] / src / SMESH_SWIG / SMESH_box.py
1 #==============================================================================
2 #  Info.
3 #  Bug (from script, bug)   : box.py, PAL5223
4 #  Modified                 : 25/11/2004
5 #  Author                   : Kovaltchuk Alexey
6 #  Project                  : PAL/SALOME
7 #==============================================================================
8 #
9 # Salome geometry and meshing for a box
10 #
11 import salome
12 from salome import sg
13 import geompy
14
15 import StdMeshers
16
17 # ---- launch GEOM
18
19 geom          = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
20 meshgenerator = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
21
22 ###geom.GetCurrentStudy(salome.myStudy._get_StudyId())
23 meshgenerator.SetCurrentStudy(salome.myStudy)
24
25 # Plate
26
27 box    = geompy.MakeBox(0.,0.,0.,1.,1.,1.)
28 boxId  = geompy.addToStudy(box,"box")
29
30 # ---- launch SMESH
31
32 smeshgui = salome.ImportComponentGUI("SMESH")
33 smeshgui.Init(salome.myStudyId)
34 # meshgenerator=smeshpy.smeshpy()
35
36
37 # Hypothesis
38
39 hypL1=meshgenerator.CreateHypothesis("LocalLength","libStdMeshersEngine.so")
40 hypL1.SetLength(0.25)
41 hypL1Id = salome.ObjectToID(hypL1) 
42 smeshgui.SetName(hypL1Id, "LocalLength")
43
44 # Algorithm
45
46 alg1D=meshgenerator.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
47 alg1DId = salome.ObjectToID(alg1D) 
48 smeshgui.SetName(alg1DId, "algo1D")
49
50 alg2D=meshgenerator.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
51 alg2DId = salome.ObjectToID(alg2D) 
52 smeshgui.SetName(alg2DId, "algo2D")
53
54 alg3D=meshgenerator.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
55 alg3DId = salome.ObjectToID(alg3D) 
56 smeshgui.SetName(alg3DId, "algo3D")
57  
58 # ---- init a Mesh
59
60 box_mesh=meshgenerator.CreateMesh(box)
61 box_meshId = salome.ObjectToID(box_mesh)
62 smeshgui.SetName(box_meshId, "box_mesh")
63
64 # ---- set Hypothesis & Algorithm
65
66 box_mesh.AddHypothesis(box,alg1D)
67 box_mesh.AddHypothesis(box,alg2D)
68 box_mesh.AddHypothesis(box,alg3D)
69 box_mesh.AddHypothesis(box,hypL1)
70
71 meshgenerator.Compute(box_mesh,box)
72
73 sg.updateObjBrowser(1)