Joint use of TUI and GUI
Joint use of TUI and GUI
This sample is known to work on the latest SALOME release.
The compatibility with previous versions of SALOME is not guaranteed,
though the sample can work on old versions also.
Objective
Learn to use GUI dialogs with TUI commands to generate a pipe with different sections, to create a mesh consisting of many parts, to execute calculation with ASTER module and to visualize the results.
Copyright
© EDF R&D 2009.
This tutorial is a part of the EDF internal training course; it does not describe a real use case.
Geometry
-
Launch SALOME.
-
Create a study
-
Launch GEOM module ().
Creation of a pipe with different sections
-
Create a sketch Wire_tmp ("New Entity -> Sketch"):
-
Start Point (0, 0) click Apply
-
Segment, Point, Absolute, (50, 0) click Apply
-
Arc, Direction, Tangent, Radius=100, Angle=90.
-
Sketch Validation.
-
-
Explode Wire_tmp into Edges and Vertexes ("New Entity ->Explode")
-
Type in the python console the following commands enabling the usage of objects created with the GUI:
import salome
Edge_2 = salome.myStudy.FindObjectByPath("/Geometry/Wire_tmp/Edge_2").GetObject()
-
Type in the python console the following commands to build a tangent to Edge_2:
import geompy
Edge_3 = geompy.MakeTangentOnCurve(Edge_2, 1)
geompy.addToStudy( Edge_3, "Edge_3" )
-
Right-click on the tree in the object browser and select Refresh.
- Explode Edge_3 into Vertexes ("New Entity ->Explode")
-
Construct the path of the pipe Wire_1 containing Edge_1, Edge_2 and Edge_3 ("New Entity ->Build->Wire").
-
Construct various interior and exterior sections of the pipe :
-
Circle_1_ext: Circle with centre Vertex_1, normal Edge_1 and radius 15.
-
Circle_1_int: Circle with centre Vertex_1, normal Edge_1 and radius 8.
-
Circle_2_ext: Circle with centre Vertex_2, normal Edge_1 and radius 20.
-
Circle_2_int: Circle with centre Vertex_2, normal Edge_1 and radius 10.
-
Circle_3_ext: Circle with centre Vertex_3, normal Edge_3 and radius 15.
-
Circle_3_int: Circle with centre Vertex_3, normal Edge_3 and radius 8.
-
Ellipse_4_ext: Ellipse with centre Vertex_5, normal Edge_3, and radiuses 15 and 7.
-
Ellipse_4_int: Ellipse with centre Vertex_5, normal Edge_3, and radiuses 10 and 4.5.
-
-
Type in the python console the following commands enabling the usage of objects created with the GUI.
Wire_1=salome.myStudy.FindObjectByPath("/Geometry/Wire_1").GetObject()
Vertex_1=salome.myStudy.FindObjectByPath("/Geometry/Wire_tmp/Vertex_1").GetObject()
Vertex_2=salome.myStudy.FindObjectByPath("/Geometry/Wire_tmp/Vertex_2").GetObject()
Vertex_3=salome.myStudy.FindObjectByPath("/Geometry/Wire_tmp/Vertex_3").GetObject()
Vertex_5=salome.myStudy.FindObjectByPath("/Geometry/Edge_3/Vertex_5").GetObject()
Circle_1_ext=salome.myStudy.FindObjectByPath("/Geometry/Circle_1_ext").GetObject()
Circle_2_ext=salome.myStudy.FindObjectByPath("/Geometry/Circle_2_ext").GetObject()
Circle_3_ext=salome.myStudy.FindObjectByPath("/Geometry/Circle_3_ext").GetObject()
Ellipse_4_ext=salome.myStudy.FindObjectByPath("/Geometry/Ellipse_4_ext").GetObject()
Circle_1_int=salome.myStudy.FindObjectByPath("/Geometry/Circle_1_int").GetObject()
Circle_2_int=salome.myStudy.FindObjectByPath("/Geometry/Circle_2_int").GetObject()
Circle_3_int=salome.myStudy.FindObjectByPath("/Geometry/Circle_3_int").GetObject()
Ellipse_4_int=salome.myStudy.FindObjectByPath("/Geometry/Ellipse_4_int").GetObject()
-
Type in the python console the following commands to create interior and exterior pipes:
pipe_ext_shell_temp = geompy.MakePipeWithDifferentSections([Circle_1_ext,
Circle_2_ext, Circle_3_ext, Ellipse_4_ext], [Vertex_1, Vertex_2, Vertex_3,
Vertex_5], Wire_1, theWithContact=0,theWithCorrection=0)
geompy.addToStudy(pipe_ext_shell_temp,"pipe_ext_shell_temp")
pipe_int_shell_temp = geompy.MakePipeWithDifferentSections([Circle_1_int,
Circle_2_int, Circle_3_int, Ellipse_4_int], [Vertex_1, Vertex_2, Vertex_3,
Vertex_5], Wire_1, theWithContact=0,theWithCorrection=0)
geompy.addToStudy(pipe_int_shell_temp,"pipe_int_shell_temp")
- Right-click on the tree in the object browser and select Refresh.
-
After the exterior and the interior surfaces of the pipe have been created, it is necessary to create faces Disk_1_ext, Disk_1_int, Disk_4_ext and Disk_4_int basing on wires Circle_1_ext, Circle_1_int, Ellipse_4_ext and Ellipse_4_int respectively ("New Entity ->Build->Face").
- Explode compounds pipe_ext_shell_temp and pipe_int_shell_temp on shells ("New Entity->Explode")
-
Build shells from pipe_ext_shell + Disk_1_ext + Disk_4_ext and pipe_int_shell + Disk_1_int + Disk_4_int ("New Entity ->Build->Shell")
-
Build solids pipe_ext and pipe_int ( "New Entity ->Build->Solid")
-
Produce a Cut of pipe_ext with tool pipe_int to get Pipe ("Operations->Boolean->Cut").
Note:
If Instead of:pipe_ext_shell_temp = geompy.MakePipeWithDifferentSections([Circle_1_ext,
Circle_2_ext, Circle_3_ext, Ellipse_4_ext], [Vertex_1, Vertex_2, Vertex_3,
Vertex_5], Wire_1, theWithContact=0,theWithCorrection=0)
pipe_ext_shell_temp = geompy.MakeThruSections([Circle_1_ext, Circle_2_ext,
Circle_3_ext, Ellipse_4_ext], theModeSolid=1, thePreci = 0.0001, theRuled=1)
the pipe would have a broken curvature because function MakeThruSections() saves only C0 continuity.
The pipe with MakePipeWithDifferentSections() is transparent red and the pipe with MakeThruSections() is yellow.
Creation of the pipe support
Now it is necessary to reconstruct the central pipe face to create the pipe support.
-
Extract the central face Face_1 of pipe_ext_shell_temp activating "Select Sub Shapes" checkbox ("New Entity ->Explode").
-
Reconstruct it in the TUI and use function MakeTangentPlaneOnFace( ) :
Face_1 = salome.myStudy.FindObjectByPath("/Geometry/pipe_ext_shell_temp/Face_1").GetObject()
Plan = geompy.BasicOp.MakeTangentPlaneOnFace(Face_1, 0.25, 0.5, 200)
geompy.addToStudy( Plan, "Plan")
Transform this 2D plane into a volume plate with thickness 5. For this, use normal vector (Normale_Plan) to the plane. Normale_Plan can be obtained with the command GetPosition(). This command also provides the central point of the plane (which in this case corresponds to the tangency point of the plane and the pipe, Centre_Plaque), which will be used later.
[Centre_Plaque_x, Centre_Plaque_y, Centre_Plaque_z, Normale_Plan_x, Normale_Plan_y,
Normale_Plan_z, Xx,Xy,Xz] = geompy.GetPosition(Plan)
Normale_Plan = geompy.MakeVectorDXDYDZ(Normale_Plan_x, Normale_Plan_y, Normale_Plan_z)
geompy.addToStudyInFather( Plan, Normale_Plan, "Normale_Plan" )
Centre_Plaque = geompy.MakeVertex(Centre_Plaque_x, Centre_Plaque_y, Centre_Plaque_z)
geompy.addToStudyInFather( Plan, Centre_Plaque, "Centre_Plaque" )
Build extrusion "Plaque" with base Plan, vector Normale_Plan and height 5 ("New Entity->Generation->Extrusion").
The following object is created:
Creation of groups
Create geometric groups corresponding to the round and elliptic faces of the holes in the pipe, outer corners of the plate and volumes of the pipe and the plate to use groups in the mesh.
Create group ("New Entity->Group->Create"):
-
Extrem_1: Shape Type: Face, Main Shape: Pipe, select the round face.
-
Extrem_2: Shape Type: Face, Main Shape: Pipe, select the elliptic face.
-
Coins: Shape Type: Vertex, Main Shape: Plaque, select 4 vertices of the outer face.
In the image below Extrem_1 is green, Extrem_2 is red, Pipe is yellow, Coins are deep blue and Plaque is sky blue / violet:

Mesh
-
Launch SMESH module ().
Creation of mesh on the pipe
-
Create Mesh_Pipe: (menu Mesh/Create Mesh)
-
Geometry: Pipe (the main object, not the group)
-
3D Algorithm : Tetrahedron (Netgen)
-
2D Algorithm : Netgen 1D-2D
-
2D Hypothesis : NETGEN 2D Parameters :
-
Max. Size : 10
-
Second order : no
-
Fineness : Moderate
-
Allow Quadrangles : no
-
Optimize : yes
-
-
No 3D hypotheses and do not define anything in 1D and 0D.
-
-
Compute.
-
Create the following groups (menu Mesh/Create Group):
-
SMESH_Extrem_1: group of face, group on geometry: Extrem_1
-
SMESH_Extrem_2: group of face, group on geometry: Extrem_2
-
SMESH_Pipe: group of volume, group on geometry: Pipe (the group)
-
Creation of mesh on the plate
-
Creation of Mesh_Plaque: (menu Mesh/Create Mesh)
-
Geometry: Plaque (the main object, not the group)
-
3D Algorithm: Tetrahedron (Netgen)
-
2D Algorithm: Netgen 1D-2D
-
2D Hypothesis: NETGEN 2D Parameters (reuse the hypothesis of Mesh_Pipe)
-
No 3D hypotheses and do not define anything in 1D and 0D.
-
-
Create the following groups (menu Mesh/Create Group):
-
SMESH_Coins: group of nodes, group on geometry: Coins
-
SMESH_Plaque: group of volume, group on geometry: Plaque (the group).
-
