Salome HOME
Merge from V5_1_main branch 24/11/2010
[modules/smesh.git] / doc / salome / gui / SMESH / input / tui_defining_hypotheses.doc
1 /*!
2
3 \page tui_defining_hypotheses_page Defining Hypotheses and Algorithms
4
5 <h2>Defining 1D Hypotheses</h2>
6
7 <br>
8 \anchor tui_1d_arithmetic
9 <h3>1D Arithmetic</h3>
10
11 \code
12 import geompy
13 import smesh
14
15 # create a box
16 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
17 geompy.addToStudy(box, "Box")
18
19 # create a hexahedral mesh on the box
20 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
21
22 # create a Regular 1D algorithm for edges
23 algo1D = hexa.Segment()
24
25 # optionally reverse node distribution on certain edges
26 allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"])
27 reversedEdges = [ allEdges[0], allEdges[4] ]
28
29 # define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length 
30 algo1D.Arithmetic1D(1, 4, reversedEdges)
31
32 # create a quadrangle 2D algorithm for faces
33 hexa.Quadrangle()
34
35 # create a hexahedron 3D algorithm for solids
36 hexa.Hexahedron()
37
38 # compute the mesh
39 hexa.Compute()
40 \endcode
41
42 <br>
43 \anchor tui_deflection_1d
44 <h3>Deflection 1D and Number of Segments</h3>
45
46 \code
47 import geompy
48 import smesh
49
50 # create a face from arc and straight segment
51 px = geompy.MakeVertex(100., 0.  , 0.  )
52 py = geompy.MakeVertex(0.  , 100., 0.  )
53 pz = geompy.MakeVertex(0.  , 0.  , 100.)
54
55 exy = geompy.MakeEdge(px, py)
56 arc = geompy.MakeArc(py, pz, px)
57
58 wire = geompy.MakeWire([exy, arc])
59
60 isPlanarFace = 1
61 face1 = geompy.MakeFace(wire, isPlanarFace)
62 geompy.addToStudy(face1,"Face1")
63
64 # get edges from the face
65 e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
66 geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
67
68 # create hexahedral mesh
69 hexa = smesh.Mesh(face1, "Face : triangle mesh")
70
71 # define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
72 algo1D = hexa.Segment()
73 algo1D.NumberOfSegments(6)
74
75 # define "MaxElementArea" hypothesis
76 algo2D = hexa.Triangle()
77 algo2D.MaxElementArea(70.0)
78
79 # define a local "Deflection1D" hypothesis on the arc
80 algo_local = hexa.Segment(e_arc)
81 algo_local.Deflection1D(1.0)
82
83 # compute the mesh
84 hexa.Compute()
85 \endcode
86
87 <br>
88 \anchor tui_start_and_end_length
89 <h3>Start and End Length</h3>
90
91 \code
92 from geompy import *
93 import smesh
94
95 # create a box
96 box = MakeBoxDXDYDZ(10., 10., 10.)
97 addToStudy(box, "Box")
98
99 # get one edge of the box to put local hypothesis on
100 p5 = MakeVertex(5., 0., 0.)
101 EdgeX = GetEdgeNearPoint(box, p5)
102 addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
103
104 # create a hexahedral mesh on the box
105 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
106
107 # set algorithms
108 algo1D = hexa.Segment()
109 hexa.Quadrangle()
110 hexa.Hexahedron()
111
112 # define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
113 algo1D.NumberOfSegments(4)
114
115 # create a local hypothesis
116 algo_local = hexa.Segment(EdgeX)
117
118 # define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
119 algo_local.StartEndLength(1, 6)
120
121 # define "Propagation" hypothesis that propagates all other hypothesis
122 # on all edges on the opposite side in case of quadrangular faces
123 algo_local.Propagation()
124
125 # compute the mesh
126 hexa.Compute()
127 \endcode
128
129 <br>
130 \anchor tui_average_length
131 <h3>Local Length</h3>
132
133 \code
134 from geompy import *
135 import smesh
136
137 # create a box
138 box = MakeBoxDXDYDZ(10., 10., 10.)
139 addToStudy(box, "Box")
140
141 # get one edge of the box to put local hypothesis on
142 p5 = MakeVertex(5., 0., 0.)
143 EdgeX = GetEdgeNearPoint(box, p5)
144 addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
145
146 # create a hexahedral mesh on the box
147 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
148
149 # set algorithms
150 algo1D = hexa.Segment()
151 hexa.Quadrangle()
152 hexa.Hexahedron()
153
154 # define "NumberOfSegments" hypothesis to cut all edges in a fixed number of segments
155 algo1D.NumberOfSegments(4)
156
157 # create a sub-mesh
158 algo_local = hexa.Segment(EdgeX)
159
160 # define "LocalLength" hypothesis to cut an edge in several segments with the same length
161 algo_local.LocalLength(2.)
162
163 # define "Propagation" hypothesis that propagates all other hypothesis
164 # on all edges on the opposite side in case of quadrangular faces
165 algo_local.Propagation()
166
167 # compute the mesh
168 hexa.Compute()
169 \endcode
170
171 <br><h2>Defining 2D and 3D hypotheses</h2>
172
173 <br>
174 \anchor tui_max_element_area
175 <h3>Maximum Element Area</h3>
176
177 \code
178 import geompy
179 import smesh
180 import salome 
181
182 # create a face
183 px   = geompy.MakeVertex(100., 0.  , 0.  )
184 py   = geompy.MakeVertex(0.  , 100., 0.  )
185 pz   = geompy.MakeVertex(0.  , 0.  , 100.)
186
187 vxy = geompy.MakeVector(px, py)
188 arc = geompy.MakeArc(py, pz, px)
189 wire = geompy.MakeWire([vxy, arc])
190
191 isPlanarFace = 1
192 face = geompy.MakeFace(wire, isPlanarFace)
193
194 # add the face in the study
195 id_face = geompy.addToStudy(face, "Face to be meshed")
196
197 # create a mesh
198 tria_mesh = smesh.Mesh(face, "Face : triangulation")
199
200 # define 1D meshing:
201 algo = tria_mesh.Segment()
202 algo.NumberOfSegments(20)
203
204 # define 2D meshing:
205
206 # assign triangulation algorithm
207 algo = tria_mesh.Triangle()
208
209 # apply "Max Element Area" hypothesis to each triangle
210 algo.MaxElementArea(100)
211
212 # compute the mesh
213 tria_mesh.Compute()
214 \endcode
215
216 <br>
217 \anchor tui_max_element_volume
218 <h3>Maximum Element Volume</h3>
219
220 \code
221 import geompy
222 import smesh
223
224 # create a cylinder
225 cyl = geompy.MakeCylinderRH(30., 50.)
226 geompy.addToStudy(cyl, "cyl")
227
228 # create a mesh on the cylinder
229 tetra = smesh.Mesh(cyl, "Cylinder : tetrahedrical mesh")
230
231 # assign algorithms
232 algo1D = tetra.Segment()
233 algo2D = tetra.Triangle()
234 algo3D = tetra.Tetrahedron(smesh.NETGEN)
235
236 # assign 1D and 2D hypotheses
237 algo1D.NumberOfSegments(7)
238 algo2D.MaxElementArea(150.)
239
240 # assign Max Element Volume hypothesis
241 algo3D.MaxElementVolume(200.)
242
243 # compute the mesh
244 ret = tetra.Compute()
245 if ret == 0:
246     print "probleme when computing the mesh"
247 else:
248     print "Computation succeded"
249 \endcode
250
251 <br>
252 \anchor tui_length_from_edges
253 <h3>Length from Edges</h3>
254
255 \code
256 import geompy
257 import smesh
258
259 # create sketchers
260 sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
261 sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
262
263 # create a face from two wires
264 isPlanarFace = 1
265 face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
266 geompy.addToStudy(face1, "Face1")
267
268 # create a mesh
269 tria = smesh.Mesh(face1, "Face : triangle 2D mesh")
270
271 # Define 1D meshing
272 algo1D = tria.Segment()
273 algo1D.NumberOfSegments(2)
274
275 # create and assign the algorithm for 2D meshing with triangles
276 algo2D = tria.Triangle()
277
278 # create and assign "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
279 algo2D.LengthFromEdges()
280
281 # compute the mesh
282 tria.Compute()
283 \endcode
284
285 <br><h2>Defining Additional Hypotheses</h2>
286
287 <br>
288 \anchor tui_propagation
289 <h3>Propagation</h3>
290
291 \code
292 from geompy import *
293 import smesh
294
295 # create a box
296 box = MakeBoxDXDYDZ(10., 10., 10.)
297 addToStudy(box, "Box")
298
299 # get one edge of the box to put local hypothesis on
300 p5 = MakeVertex(5., 0., 0.)
301 EdgeX = GetEdgeNearPoint(box, p5)
302 addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
303
304 # create a hexahedral mesh on the box
305 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
306
307 # set global algorithms and hypotheses
308 algo1D = hexa.Segment()
309 hexa.Quadrangle()
310 hexa.Hexahedron()
311 algo1D.NumberOfSegments(4)
312
313 # create a sub-mesh with local 1D hypothesis and propagation
314 algo_local = hexa.Segment(EdgeX)
315
316 # define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
317 algo_local.Arithmetic1D(1, 4)
318
319 # define "Propagation" hypothesis that propagates all other 1D hypotheses
320 # from all edges on the opposite side of a face in case of quadrangular faces
321 algo_local.Propagation()
322
323 # compute the mesh
324 hexa.Compute()
325 \endcode
326
327 <br>
328 \anchor tui_defining_meshing_algos
329 <h2>Defining Meshing Algorithms</h2>
330
331 \code
332 import geompy
333 import smesh
334
335 # create a box
336 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
337 geompy.addToStudy(box, "Box")
338
339 # 1. Create a hexahedral mesh on the box
340 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
341
342 # create a Regular 1D algorithm for edges
343 algo1D = hexa.Segment()
344
345 # create a quadrangle 2D algorithm for faces
346 algo2D = hexa.Quadrangle()
347
348 # create a hexahedron 3D algorithm for solids
349 algo3D = hexa.Hexahedron()
350
351 # define hypotheses
352 algo1D.Arithmetic1D(1, 4)
353
354 # compute the mesh
355 hexa.Compute()
356
357 # 2. Create a tetrahedral mesh on the box
358 tetra = smesh.Mesh(box, "Box : tetrahedrical mesh")
359
360 # create a Regular 1D algorithm for edges
361 algo1D = tetra.Segment()
362
363 # create a Mefisto 2D algorithm for faces
364 algo2D = tetra.Triangle()
365
366 # create a Netgen 3D algorithm for solids
367 algo3D = tetra.Tetrahedron(smesh.NETGEN)
368
369 # define hypotheses
370 algo1D.Arithmetic1D(1, 4)
371 algo2D.LengthFromEdges()
372
373 # compute the mesh
374 tetra.Compute()
375
376 # 3. Create a tetrahedral mesh on the box with NETGEN_2D3D algorithm
377 tetraN = smesh.Mesh(box, "Box : tetrahedrical mesh by NETGEN_2D3D")
378
379 # create a Netgen_2D3D algorithm for solids
380 algo3D = tetraN.Tetrahedron(smesh.FULL_NETGEN) 
381
382 # define hypotheses
383 n23_params = algo3D.Parameters()
384
385 # compute the mesh
386 tetraN.Compute()
387 \endcode
388
389 <br>
390 \anchor tui_projection
391 <h3>Projection Algorithms</h3>
392
393 \code
394 # Project prisms from one meshed box to another mesh on the same box
395
396 from smesh import *
397
398 # Prepare geometry
399
400 # Create a parallelepiped
401 box = geompy.MakeBoxDXDYDZ(200, 100, 70)
402 geompy.addToStudy( box, "box" )
403
404 # Get geom faces to mesh with triangles in the 1ts and 2nd meshes
405 faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
406 # 2 adjacent faces of the box
407 f1 = faces[2]
408 f2 = faces[0]
409 # face opposite to f2
410 f2opp = faces[1]
411
412 # Get vertices used to specify how to associate sides of faces at projection
413 [v1F1, v2F1] = geompy.SubShapeAll(f1, geompy.ShapeType["VERTEX"])[:2]
414 [v1F2, v2F2] = geompy.SubShapeAll(f2, geompy.ShapeType["VERTEX"])[:2]
415 geompy.addToStudyInFather( box, v1F1, "v1F1" )
416 geompy.addToStudyInFather( box, v2F1, "v2F1" )
417 geompy.addToStudyInFather( box, v1F2, "v1F2" )
418 geompy.addToStudyInFather( box, v2F2, "v2F2" )
419
420 # Make group of 3 edges of f1 and f2
421 edgesF1 = geompy.CreateGroup(f1, geompy.ShapeType["EDGE"])
422 geompy.UnionList( edgesF1, geompy.SubShapeAll(f1, geompy.ShapeType["EDGE"])[:3])
423 edgesF2 = geompy.CreateGroup(f2, geompy.ShapeType["EDGE"])
424 geompy.UnionList( edgesF2, geompy.SubShapeAll(f2, geompy.ShapeType["EDGE"])[:3])
425 geompy.addToStudyInFather( box, edgesF1, "edgesF1" )
426 geompy.addToStudyInFather( box, edgesF2, "edgesF2" )
427
428
429 # Make the source mesh with prisms
430 src_mesh = Mesh(box, "Source mesh")
431 src_mesh.Segment().NumberOfSegments(9,10)
432 src_mesh.Quadrangle()
433 src_mesh.Hexahedron()
434 src_mesh.Triangle(f1) # triangular sumbesh 
435 src_mesh.Compute()
436
437
438 # Mesh the box using projection algoritms
439
440 # Define the same global 1D and 2D hypotheses
441 tgt_mesh = Mesh(box, "Target mesh")
442 tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True)
443 tgt_mesh.Quadrangle()
444
445 # Define Projection 1D algorithm to project 1d mesh elements from group edgesF2 to edgesF1
446 # It is actually not needed, just a demonstration
447 proj1D = tgt_mesh.Projection1D( edgesF1 )
448 # each vertex must be at the end of a connected group of edges (or a sole edge)
449 proj1D.SourceEdge( edgesF2, src_mesh, v2F1, v2F2 )
450
451 # Define 2D hypotheses to project triangles from f1 face of the source mesh to
452 # f2 face in the target mesh. Vertices specify how to associate sides of faces
453 proj2D = tgt_mesh.Projection2D( f2 )
454 proj2D.SourceFace( f1, src_mesh, v1F1, v1F2, v2F1, v2F2 )
455
456 # 2D hypotheses to project triangles from f2 of target mesh to the face opposite to f2.
457 # Association of face sides is default
458 proj2D = tgt_mesh.Projection2D( f2opp )
459 proj2D.SourceFace( f2 )
460
461 # 3D hypotheses to project prisms from the source to the target mesh
462 proj3D = tgt_mesh.Projection3D()
463 proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 )
464 tgt_mesh.Compute()
465
466 # Move the source mesh to visualy compare the two meshes
467 src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
468
469 \endcode
470
471 <br>
472
473 \anchor tui_fixed_points
474
475 <h2>1D Mesh with Fixed Points example</h2>
476
477 \code
478 import salome
479 import geompy
480 import smesh
481 import StdMeshers
482
483 # Create face and explode it on edges
484 face = geompy.MakeFaceHW(100, 100, 1)
485 edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"])
486 geompy.addToStudy( face, "Face" )
487
488 # get the first edge from exploded result
489 edge1 = geompy.GetSubShapeID(face, edges[0])
490
491 # Define Mesh on previously created face
492 Mesh_1 = smesh.Mesh(face)
493
494 # Create Fixed Point 1D hypothesis and define parameters.
495 # Note: values greater than 1.0 and less than 0.0 are not taken into account;
496 # duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0
497 # add added automatically.
498 # The number of segments should correspond to the number of points (NbSeg = NbPnt-1);
499 # extra values of segments splitting parameter are not taken into account,
500 # while missing values are considered to be equal to 1.
501 Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D')
502 Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
503 Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
504 Fixed_points_1D_1.SetReversedEdges( [edge1] )
505
506 # Add hypothesis to mesh and define 2D parameters
507 Mesh_1.AddHypothesis(Fixed_points_1D_1)
508 Regular_1D = Mesh_1.Segment()
509 Quadrangle_2D = Mesh_1.Quadrangle()
510 # Compute mesh
511 Mesh_1.Compute()
512 \endcode
513
514 \anchor tui_radial_quadrangle
515 <h2> Radial Quadrangle 1D2D example </h2>
516 \code
517 from smesh import *
518
519 SetCurrentStudy(salome.myStudy)
520
521 # Create face from the wire and add to study
522 Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
523 geompy.addToStudy(Face,"Face")
524 edges = geompy.SubShapeAllSorted(Face, geompy.ShapeType["EDGE"])
525 circle, radius1, radius2 = edges
526 geompy.addToStudyInFather(Face, radius1,"radius1")
527 geompy.addToStudyInFather(Face, radius2,"radius2")
528 geompy.addToStudyInFather(Face, circle,"circle")
529
530
531 # Define geometry for mesh, and Radial Quadrange algorithm
532 mesh = smesh.Mesh(Face)
533 radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD)
534
535 # The Radial Quadrange algorithm can work without any hypothesis
536 # In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
537 mesh.Compute()
538
539 # The Radial Quadrange uses global or local 1d hypotheses if it does
540 # not have its own hypotheses.
541 # Define global hypotheses to discretize radial edges and a local one for circular edge
542 global_Nb_Segments = mesh.Segment().NumberOfSegments(5)
543 local_Nb_Segments  = mesh.Segment(circle).NumberOfSegments(10)
544 mesh.Compute()
545
546 # Define own parameters of Radial Quadrange algorithm
547 radial_Quad_algo.NumberOfLayers( 4 )
548 mesh.Compute()
549 \endcode
550
551 \anchor tui_quadrangle_parameters
552 <h2>Quadrangle Parameters example 1 (meshing a face with 3 edges) </h2>
553 \code
554 from smesh import *
555 SetCurrentStudy(salome.myStudy)
556
557 # Get 1/4 part from the disk face.
558 Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
559 Disk_1 = geompy.MakeDiskR(100, 1)
560 Common_1 = geompy.MakeCommon(Disk_1, Box_1)
561 geompy.addToStudy( Disk_1, "Disk_1" )
562 geompy.addToStudy( Box_1, "Box_1" )
563 geompy.addToStudy( Common_1, "Common_1" )
564
565 # Set the Geometry for meshing
566 Mesh_1 = smesh.Mesh(Common_1)
567
568
569 # Define 1D hypothesis and compute the mesh
570 Regular_1D = Mesh_1.Segment()
571 Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
572 Nb_Segments_1.SetDistrType( 0 )
573
574 # Create Quadrangle parameters and define the Base Vertex.
575 Quadrangle_2D = Mesh_1.Quadrangle().TriangleVertex( 8 )
576
577 Mesh_1.Compute()
578 \endcode
579
580 <h2>Quadrangle Parameters example 2 (using different types) </h2>
581 \code
582 import geompy
583 import smesh
584 import StdMeshers
585
586 # Make quadrangle face and explode it on edges.
587 Vertex_1 = geompy.MakeVertex(0, 0, 0)
588 Vertex_2 = geompy.MakeVertex(40, 0, 0)
589 Vertex_3 = geompy.MakeVertex(40, 30, 0)
590 Vertex_4 = geompy.MakeVertex(0, 30, 0)
591 Quadrangle_Face_1 = geompy.MakeQuad4Vertices(Vertex_1, Vertex_4, Vertex_3, Vertex_2)
592 [Edge_1,Edge_2,Edge_3,Edge_4] = geompy.SubShapeAllSorted(Quadrangle_Face_1, geompy.ShapeType["EDGE"])
593 geompy.addToStudy( Vertex_1, "Vertex_1" )
594 geompy.addToStudy( Vertex_2, "Vertex_2" )
595 geompy.addToStudy( Vertex_3, "Vertex_3" )
596 geompy.addToStudy( Vertex_4, "Vertex_4" )
597 geompy.addToStudy( Quadrangle_Face_1, "Quadrangle Face_1" )
598 geompy.addToStudyInFather( Quadrangle_Face_1, Edge_2, "Edge_2" )
599
600 # Set the Geometry for meshing
601 Mesh_1 = smesh.Mesh(Quadrangle_Face_1)
602
603 # Create Quadrangle parameters and
604 # define the Type as Quadrangle Preference
605 Quadrangle_Parameters_1 = smesh.CreateHypothesis('QuadrangleParams')
606 Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_QUADRANGLE_PREF )
607
608 # Define other hypotheses and algorithms
609 Regular_1D = Mesh_1.Segment()
610 Nb_Segments_1 = Regular_1D.NumberOfSegments(4)
611 Nb_Segments_1.SetDistrType( 0 )
612 status = Mesh_1.AddHypothesis(Quadrangle_Parameters_1)
613 Quadrangle_2D = Mesh_1.Quadrangle()
614
615 # Define submesh on one edge to provide different number of segments
616 Regular_1D_1 = Mesh_1.Segment(geom=Edge_2)
617 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(10)
618 Nb_Segments_2.SetDistrType( 0 )
619 SubMesh_1 = Regular_1D_1.GetSubMesh()
620
621 # Compute mesh (with Quadrangle Preference type)
622 isDone = Mesh_1.Compute()
623
624 # Change type to Reduced and compute again
625 Quadrangle_Parameters_1.SetQuadType( StdMeshers.QUAD_REDUCED )
626 isDone = Mesh_1.Compute()
627 \endcode
628
629 \anchor tui_import
630 <h2>"Use Existing Elements" example </h2>
631 \code
632
633 from smesh import *
634 SetCurrentStudy(salome.myStudy)
635
636 # Make a patritioned box
637
638 box = geompy.MakeBoxDXDYDZ(100,100,100)
639
640 N = geompy.MakeVectorDXDYDZ( 1,0,0 )
641 O = geompy.MakeVertex( 50,0,0 )
642 plane = geompy.MakePlane( O, N, 200 ) # plane YOZ
643
644 shape2boxes = geompy.MakeHalfPartition( box, plane )
645 boxes = geompy.SubShapeAllSorted(shape2boxes, geompy.ShapeType["SOLID"])
646
647 geompy.addToStudy( boxes[0], "boxes[0]")
648 geompy.addToStudy( boxes[1], "boxes[1]")
649 midFace0 = geompy.SubShapeAllSorted(boxes[0], geompy.ShapeType["FACE"])[5]
650 geompy.addToStudyInFather( boxes[0], midFace0, "middle Face")
651 midFace1 = geompy.SubShapeAllSorted(boxes[1], geompy.ShapeType["FACE"])[0]
652 geompy.addToStudyInFather( boxes[1], midFace1, "middle Face")
653
654 # Mesh one of boxes with quadrangles. It is a source mesh
655
656 srcMesh = Mesh(boxes[0], "source mesh") # box coloser to CS origin
657 nSeg1 = srcMesh.Segment().NumberOfSegments(4)
658 srcMesh.Quadrangle()
659 srcMesh.Compute()
660 srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", FACE )
661
662 # Import faces from midFace0 to the target mesh
663
664 tgtMesh = Mesh(boxes[1], "target mesh")
665 importAlgo = tgtMesh.UseExisting2DElements(midFace1)
666 import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
667 tgtMesh.Segment().NumberOfSegments(3)
668 tgtMesh.Quadrangle()
669 tgtMesh.Compute()
670
671 # Import the whole source mesh with groups
672 import2hyp.SetCopySourceMesh(True,True)
673 tgtMesh.Compute()
674 \endcode
675
676 \n Other meshing algorithms:
677
678 <ul>
679 <li>\subpage tui_defining_blsurf_hypotheses_page</li>
680 <li>\subpage tui_defining_ghs3d_hypotheses_page</li>
681 </ul>
682 */