3 \page tui_defining_blsurf_hypotheses_page Defining Hypotheses for BLSurf Algorithm
6 <h2>Construction of Mesh using BLSurf algorithm</h2>
14 box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
15 geompy.addToStudy(box, "box")
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]
22 Face_2 = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[5]
23 Wire_1 = geompy.SubShapeAllSorted(Face_2, geompy.ShapeType["WIRE"])[0]
25 # /!\ Geom object with sizemaps on them must be published in study
26 geompy.addToStudyInFather(box,Face_1, "Face_1")
27 geompy.addToStudyInFather(box,Edge_1, "Edge_1")
28 geompy.addToStudyInFather(box,Vertex_1, "Vertex_1")
30 geompy.addToStudyInFather(box ,Face_2, "Face_2")
31 geompy.addToStudyInFather(Face_2,Wire_1, "Wire_1")
33 # create a mesh on the box
34 blsurfMesh = smesh.Mesh(box,"box: BLSurf mesh")
36 # create a BLSurf algorithm for faces
37 algo2d = blsurfMesh.Triangle(algo=smesh.BLSURF)
39 # optional - set physical mesh to 2 = Size Map
40 algo2d.SetPhysicalMesh( 2 )
42 # optional - set global mesh size
43 algo2d.SetPhySize( 34.641 )
46 algo2d.SetSizeMap(Face_1, 'def f(u,v): return 10' )
48 algo2d.SetSizeMap(Edge_1, 'def f(t): return 5' )
49 # set size on Vertex_1
50 algo2d.SetSizeMap(Vertex_1, 'def f(): return 2' )
55 # Add enforced vertex for Face_1 on (50, 50, 50)
56 # The projection coordinates will be (50, 50, 0)
57 algo2d.SetEnforcedVertex(Face_1, 50, 50, 50)
59 # Add another enforced vertex on (150, 150, 150)
60 algo2d.SetEnforcedVertex(Face_1, 150, 150, 150)
62 # Retrieve and print the list of enforced vertices defines on Face_1
63 enfList = algo2d.GetEnforcedVertices(Face_1)
64 print "List of enforced vertices for Face_1: "
70 # Remove an enforced vertex and print the list
71 algo2d.UnsetEnforcedVertex(Face_1, 50, 50, 50)
72 enfList = algo2d.GetEnforcedVertices(Face_1)
73 print "List of enforced vertices for Face_1: "
79 # Remove all enforced vertices defined on Face_1
80 algo2d.UnsetEnforcedVertices(Face_1)
86 # Add an attractor on Face_2, which shape is Wire_1
88 # The size on Wire_1 is 1 and will grow until a maximum of 36.641 (physical size set above)
89 # The influence distance of the attractor is 20
90 # The size is kept constant until a distance of 10
91 algo2d.SetAttractorGeom(Face_2, Wire_1, 1, 36.641, 20, 10)
93 # In order to let the attractor control the growing of the mesh let set
94 # the gradation to its maximum
95 algo2d.SetGradation( 2.5 )