3 \page tui_defining_hypotheses_page Defining Hypotheses and Algorithms
5 <h2>Defining 1D Hypotheses</h2>
8 \anchor tui_1d_arithmetic
16 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
17 geompy.addToStudy(box, "Box")
19 # create a hexahedral mesh on the box
20 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
22 # create a Regular 1D algorithm for edges
23 algo1D = hexa.Segment()
25 # define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length
26 algo1D.Arithmetic1D(1, 4)
28 # create a quadrangle 2D algorithm for faces
31 # create a hexahedron 3D algorithm for solids
39 \anchor tui_deflection_1d
40 <h3>Deflection 1D and Number of Segments</h3>
46 # create a face from arc and straight segment
47 px = geompy.MakeVertex(100., 0. , 0. )
48 py = geompy.MakeVertex(0. , 100., 0. )
49 pz = geompy.MakeVertex(0. , 0. , 100.)
51 exy = geompy.MakeEdge(px, py)
52 arc = geompy.MakeArc(py, pz, px)
54 wire = geompy.MakeWire([exy, arc])
57 face1 = geompy.MakeFace(wire, isPlanarFace)
58 geompy.addToStudy(face1,"Face1")
60 # get edges from the face
61 e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
62 geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
64 # create hexahedral mesh
65 hexa = smesh.Mesh(face1, "Face : triangle mesh")
67 # define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
68 algo1D = hexa.Segment()
69 algo1D.NumberOfSegments(6)
71 # define "MaxElementArea" hypothesis
72 algo2D = hexa.Triangle()
73 algo2D.MaxElementArea(70.0)
75 # define a local "Deflection1D" hypothesis on the arc
76 algo_local = hexa.Segment(e_arc)
77 algo_local.Deflection1D(1.0)
84 \anchor tui_start_and_end_length
85 <h3>Start and End Length</h3>
92 box = MakeBoxDXDYDZ(10., 10., 10.)
93 addToStudy(box, "Box")
95 # get one edge of the box to put local hypothesis on
96 p5 = MakeVertex(5., 0., 0.)
97 EdgeX = GetEdgeNearPoint(box, p5)
98 addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
100 # create a hexahedral mesh on the box
101 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
104 algo1D = hexa.Segment()
108 # define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
109 algo1D.NumberOfSegments(4)
111 # create a local hypothesis
112 algo_local = hexa.Segment(EdgeX)
114 # define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
115 algo_local.StartEndLength(1, 6)
117 # define "Propagation" hypothesis that propagates all other hypothesis
118 # on all edges on the opposite side in case of quadrangular faces
119 algo_local.Propagation()
126 \anchor tui_average_length
127 <h3>Average Length</h3>
134 box = MakeBoxDXDYDZ(10., 10., 10.)
135 addToStudy(box, "Box")
137 # get one edge of the box to put local hypothesis on
138 p5 = MakeVertex(5., 0., 0.)
139 EdgeX = GetEdgeNearPoint(box, p5)
140 addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
142 # create a hexahedral mesh on the box
143 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
146 algo1D = hexa.Segment()
150 # define "NumberOfSegments" hypothesis to cut all edges in a fixed number of segments
151 algo1D.NumberOfSegments(4)
154 algo_local = hexa.Segment(EdgeX)
156 # define "LocalLength" hypothesis to cut an edge in several segments with the same length
157 algo_local.LocalLength(2.)
159 # define "Propagation" hypothesis that propagates all other hypothesis
160 # on all edges on the opposite side in case of quadrangular faces
161 algo_local.Propagation()
167 <br><h2>Defining 2D and 3D hypotheses</h2>
170 \anchor tui_max_element_area
171 <h3>Maximum Element Area</h3>
179 px = geompy.MakeVertex(100., 0. , 0. )
180 py = geompy.MakeVertex(0. , 100., 0. )
181 pz = geompy.MakeVertex(0. , 0. , 100.)
183 vxy = geompy.MakeVector(px, py)
184 arc = geompy.MakeArc(py, pz, px)
185 wire = geompy.MakeWire([vxy, arc])
188 face = geompy.MakeFace(wire, isPlanarFace)
190 # add the face in the study
191 id_face = geompy.addToStudy(face, "Face to be meshed")
194 tria_mesh = smesh.Mesh(face, "Face : triangulation")
197 algo = tria_mesh.Segment()
198 algo.NumberOfSegments(20)
202 # assign triangulation algorithm
203 algo = tria_mesh.Triangle()
205 # apply "Max Element Area" hypothesis to each triangle
206 algo.MaxElementArea(100)
213 \anchor tui_max_element_volume
214 <h3>Maximum Element Volume</h3>
221 cyl = geompy.MakeCylinderRH(30., 50.)
222 geompy.addToStudy(cyl, "cyl")
224 # create a mesh on the cylinder
225 tetra = smesh.Mesh(cyl, "Cylinder : tetrahedrical mesh")
228 algo1D = tetra.Segment()
229 algo2D = tetra.Triangle()
230 algo3D = tetra.Tetrahedron(smesh.NETGEN)
232 # assign 1D and 2D hypotheses
233 algo1D.NumberOfSegments(7)
234 algo2D.MaxElementArea(150.)
236 # assign Max Element Volume hypothesis
237 algo3D.MaxElementVolume(200.)
240 ret = tetra.Compute()
242 print "probleme when computing the mesh"
244 print "Computation succeded"
248 \anchor tui_length_from_edges
249 <h3>Length from Edges</h3>
256 sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
257 sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
259 # create a face from two wires
261 face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
262 geompy.addToStudy(face1, "Face1")
265 tria = smesh.Mesh(face1, "Face : triangle 2D mesh")
268 algo1D = tria.Segment()
269 algo1D.NumberOfSegments(2)
271 # create and assign the algorithm for 2D meshing with triangles
272 algo2D = tria.Triangle()
274 # create and assign "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
275 algo2D.LengthFromEdges()
281 <br><h2>Defining Additional Hypotheses</h2>
284 \anchor tui_propagation
292 box = MakeBoxDXDYDZ(10., 10., 10.)
293 addToStudy(box, "Box")
295 # get one edge of the box to put local hypothesis on
296 p5 = MakeVertex(5., 0., 0.)
297 EdgeX = GetEdgeNearPoint(box, p5)
298 addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
300 # create a hexahedral mesh on the box
301 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
303 # set global algorithms and hypotheses
304 algo1D = hexa.Segment()
307 algo1D.NumberOfSegments(4)
309 # create a sub-mesh with local 1D hypothesis and propagation
310 algo_local = hexa.Segment(EdgeX)
312 # define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
313 algo_local.Arithmetic1D(1, 4)
315 # define "Propagation" hypothesis that propagates all other 1D hypotheses
316 # from all edges on the opposite side of a face in case of quadrangular faces
317 algo_local.Propagation()
324 \anchor tui_defining_meshing_algos
325 <h2>Defining Meshing Algorithms</h2>
332 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
333 geompy.addToStudy(box, "Box")
335 # 1. Create a hexahedral mesh on the box
336 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
338 # create a Regular 1D algorithm for edges
339 algo1D = hexa.Segment()
341 # create a quadrangle 2D algorithm for faces
342 algo2D = hexa.Quadrangle()
344 # create a hexahedron 3D algorithm for solids
345 algo3D = hexa.Hexahedron()
348 algo1D.Arithmetic1D(1, 4)
353 # 2. Create a tetrahedral mesh on the box
354 tetra = smesh.Mesh(box, "Box : tetrahedrical mesh")
356 # create a Regular 1D algorithm for edges
357 algo1D = tetra.Segment()
359 # create a Mefisto 2D algorithm for faces
360 algo2D = tetra.Triangle()
362 # create a Netgen 3D algorithm for solids
363 algo3D = tetra.Tetrahedron(smesh.NETGEN)
366 algo1D.Arithmetic1D(1, 4)
367 algo2D.LengthFromEdges()
372 # 3. Create a tetrahedral mesh on the box with NETGEN_2D3D algorithm
373 tetraN = smesh.Mesh(box, "Box : tetrahedrical mesh by NETGEN_2D3D")
375 # create a Netgen_2D3D algorithm for solids
376 algo3D = tetraN.Tetrahedron(smesh.FULL_NETGEN)
379 n23_params = algo3D.Parameters()