Salome HOME
edad0dbe7cae75586f9ccbd37756ada06cd1a8a9
[modules/smesh.git] / doc / salome / gui / SMESH / input / tui_defining_blsurf_hypotheses.doc
1 /*!
2
3 \page tui_defining_blsurf_hypotheses_page Defining Hypotheses for BLSurf Algorithm
4
5 \anchor tui_blsurf
6 <h2>Construction of Mesh using BLSurf algorithm</h2>
7
8 \code
9 import geompy
10 import smesh
11 import BLSURFPlugin
12
13 # create a box
14 box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
15 geompy.addToStudy(box, "box")
16
17 # get subshapes
18 Face_1   = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
19 Edge_1   = geompy.SubShapeAllSorted(box, geompy.ShapeType["EDGE"])[0]
20 Vertex_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["VERTEX"])[0]
21
22 # create a mesh on the box
23 blsurfMesh = smesh.Mesh(box,"box: BLSurf mesh")
24
25 # create a BLSurf algorithm for faces
26 BLSURF = blsurfMesh.Triangle(algo=smesh.BLSURF)
27
28 # get BLSurf algorithm hypothesis
29 BLSURF_Parameters = BLSURF.Parameters()
30
31 # set physical mesh to 2 = Size Map
32 BLSURF_Parameters.SetPhysicalMesh( 2 )
33
34 # set global mesh size
35 BLSURF_Parameters.SetPhySize( 34.641 )
36
37 # set size on Face_1
38 BLSURF_Parameters.SetSizeMap(Face_1, 'def f(u,v): return 10' )
39 # set size on Edge_1
40 BLSURF_Parameters.SetSizeMap(Edge_1, 'def f(t): return 5' )
41 # set size on Vertex_1
42 BLSURF_Parameters.SetSizeMap(Vertex_1, 'def f(): return 2' )
43
44 # compute the mesh
45 blsurfMesh.Compute()
46
47 # Add enforced vertex for Face_1 on (50, 50, 50)
48 # The projection coordinates will be (50, 50, 0)
49 BLSURF_Parameters.SetEnforcedVertex(Face_1, 50, 50, 50)
50
51 # Add another enforced vertex on (150, 150, 150)
52 BLSURF_Parameters.SetEnforcedVertex(Face_1, 150, 150, 150)
53
54 # Retrieve and print the list of enforced vertices defines on Face_1
55 enfList = BLSURF_Parameters.GetEnforcedVertices(Face_1)
56 print "List of enforced vertices for Face_1: "
57 print enfList
58
59 # compute the mesh
60 blsurfMesh.Compute()
61
62 # Remove an enforced vertex and print the list
63 BLSURF_Parameters.UnsetEnforcedVertex(Face_1, 50, 50, 50)
64 enfList = BLSURF_Parameters.GetEnforcedVertices(Face_1)
65 print "List of enforced vertices for Face_1: "
66 print enfList
67
68 # compute the mesh
69 blsurfMesh.Compute()
70
71 # Remove all enforced vertices defined on Face_1
72 BLSURF_Parameters.UnsetEnforcedVertices(Face_1)
73
74 # compute the mesh
75 blsurfMesh.Compute()
76
77 # End of script
78
79 \endcode
80
81 */