Personal tools
You are here: Home User Section Tutorials EDF Exercise 9

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 2014.
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 Sketch_1 ("New Entity -> Basic -> 2D Sketch"):

    • Start Point (0, 0) click Apply

    • Segment(first radio button in group Element Type), Point, Absolute, (50, 0) click Apply

    • Arc(second radio button in group Element Type), Direction, Tangent, Radius=100, Angle=90, click Apply

    • Close.

  • Explode Sketch_1 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
salome.salome_init()
Edge_2 = salome.myStudy.FindObjectByPath("/Geometry/Sketch_1/Edge_2").GetObject()
  • Type in the python console the following commands to build a tangent to Edge_2:

import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
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 ("New Entity -> Basic -> Circle/Ellipse"):

    • Circle_1_ext: Circle with centre Vertex_1, normal vector Edge_1 and radius 15.
    • Circle_1_int: Circle with centre Vertex_1, normal vector Edge_1 and radius 8.

    • Circle_2_ext: Circle with centre Vertex_2, normal vector Edge_1 and radius 20.

    • Circle_2_int: Circle with centre Vertex_2, normal vector Edge_1 and radius 10.

    • Circle_3_ext: Circle with centre Vertex_3, normal vector Edge_3 and radius 15.

    • Circle_3_int: Circle with centre Vertex_3, normal vector Edge_3 and radius 8.

    • Ellipse_4_ext: Ellipse with centre Vertex_5, normal vector Edge_3, and radiuses 15 and 7.

    • Ellipse_4_int: Ellipse with centre Vertex_5, normal vector Edge_3, and radiuses 10 and 4.5.

EDF10_screen1
  • 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/Sketch_1/Vertex_1").GetObject()
Vertex_2=salome.myStudy.FindObjectByPath("/Geometry/Sketch_1/Vertex_2").GetObject()
Vertex_3=salome.myStudy.FindObjectByPath("/Geometry/Sketch_1/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.
EDF10_screen2
  • 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").

  • Build pipe_ext_shell_tmp  + Disk_1_ext + Disk_4_ext with name pipe_ext and pipe_int_shell + Disk_1_int + Disk_4_int with name pipe_int ("New Entity ->Build->Shell")

  • Build shells pipe_ext and pipe_int ( "New Entity ->Build->Solid")  as Solid_1

  • Produce a Cut of pipe_ext with tool pipe_int to get Pipe ("Operations->Boolean->Cut").

EDF10_screen3

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)
we have used:
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)

and instead of:

- Build pipe_ext_shell_tmp + Disk_1_ext + Disk_4_ext with name pipe_ext and pipe_int_shell +
Disk_1_int
+ Disk_4_int with name pipe_int ("New Entity ->Build->Shell")

we have used:
- Explode pipe_ext_shell_tmp into Shells("New Entity -> Explode"). This command creates
a new shell Shell_1
- Build Shell_1 + Disk_1_ext + Disk_4_ext with name pipe_ext and pipe_int_shell +
Disk_1_int
+ Disk_4_int with name pipe_int ("New Entity ->Build->Shell")

the pipe would have a broken curvature because function MakeThruSections() saves only C0 continuity.

EDF10_screen4

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:

EDF10_screen5

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 Group"):

  • Extrem_1: Shape Type: Face (third radio button), Main Shape: Pipe, select the round face, click Add, click Apply.

  • Extrem_2: Shape Type: Face (third radio button), Main Shape: Pipe, select the elliptic face, click Add, click Apply.

  • Coins: Shape Type: Vertex (first radio button), Main Shape: Plaque, select 4 vertices of the outer face, click Add, click Apply and Close.

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:

EDF10_groupscolors

Mesh

  • Launch SMESH module ().

Creation of mesh on the pipe

  • Create Mesh_Pipe: (menu Mesh/Create Mesh)

    • Geometry: Pipe

    • 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 Algorithm and do not define anything in 1D and 0D.

  • Compute.

EDF10_screen7
  • Create the following groups (menu Mesh/Create Group):

    • SMESH_Extrem_1: Mesh-Mesh_Pipe, group of face, group on geometry (Direct geometry selection): Extrem_1

    • SMESH_Extrem_2: Mesh-Mesh_Pipe, group of face, group on geometry (Direct geometry selection): Extrem_2

Creation of mesh on the plate

  • Creation of Mesh_Plaque: (menu Mesh/Create Mesh)
    • Geometry: Plaque

    • 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.

  • Compute.
 EDF10_screen8

  • Create the following group (menu Mesh/Create Group):

              SMESH_Coins: Mesh - Mesh_Plaque, group of nodes, group on geometry (Direct geometry selection): Coins

Document Actions