Extrude and Join Quadrangles
There are two different methods to build hexahedra from quadrangles:
Extrusion of quadrangles
Join two sets of quadrangles
Extrude a quadrangle or quadrangles
Simple Extrude
To extrude one quad or a set of quads the following data are required:
quad : the quad to be extruded (for one quad extrusion).
quads : the list of quadrangles to be extruded (for multiple quads extrusion).
nbLayers: the number of layers of hexahedra resulting from the extrusion.
One quad extrusion:
elts = doc.extrudeQuadTop(quad, nbLayers)
Extrusion of a set of quads:
elts = doc.extrudeQuadsTop(quads, nbLayers)
GUI command: Simple Extrude
Uniform Extrude
The following data are required:
quad : the quad to be extruded (for one quad extrusion).
quads : the list of quadrangles to be extruded (for multiple quads extrusion).
dir : the direction of the extrusion.
length : the length of hexahedra resulting from the extrusion.
nbLayers: the number of layers of hexahedra resulting from the extrusion.
One quad extrusion:
elts = doc.extrudeQuadUni(quad, dir, length, nbLayers)
Extrusion of a set of quads:
elts = doc.extrudeQuadsUni(quads, dir, length, nbLayers)
GUI command: Uniform Extrude
Custom Extrude
The following data are required:
quad : the quad to be extruded (for one quad extrusion).
quads: the list of quadrangles to be extruded (for multiple quads extrusion).
dir : the direction of the extrusion.
th : a list of heights (in ascendant order because the size is computed from the origin) to specify the size of each layer of extrusion.
One quad extrusion:
elts = doc.extrudeQuad(quad, dir, th)
Extrusion of a set of quads:
elts = doc.extrudeQuads(quads, dir, th)
GUI command: Custom Extrude
Operations on elts: Elements
Example
1# -*- coding: utf-8 -*-
2# Copyright (C) 2009-2026 CEA, EDF
3#
4# This library is free software; you can redistribute it and/or
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
8#
9# This library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12# Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public
15# License along with this library; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17#
18# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19#
20
21####### Test for Extrude Quad ###############
22
23import hexablock
24
25
26doc = hexablock.addDocument("Extrude Quad Test")
27
28dimx = 11
29dimy = 11
30dimz = 2
31
32orig1 = doc.addVertex ( 0,0,0)
33vx = doc.addVector ( 1,0,0)
34vy = doc.addVector ( 0,1,0)
35vz = doc.addVector ( 0,0,1)
36dir1 = doc.addVector ( 1,1,1)
37dir2 = doc.addVector ( 1,1,-1)
38
39dx =1
40dy=1
41dz=1
42
43grid1 = doc.makeCartesianUni (orig1, vx,vy,vz, dx,dy,dz, dimx,dimy,dimz)
44
45mx = dimx/2
46my = dimy/2
47liste1 = []
48liste2 = []
49
50liste1.append(grid1.getQuadIJ (mx, my, dimz))
51liste2.append(grid1.getQuadIJ (mx, my, 0))
52for nx in range(dimx):
53 if nx!=mx:
54 liste1.append(grid1.getQuadIJ (nx, my, dimz))
55 liste2.append(grid1.getQuadIJ (nx, my, 0))
56
57for ny in range(dimy):
58 if ny!=my:
59 liste1.append(grid1.getQuadIJ (mx, ny, dimz))
60 liste2.append(grid1.getQuadIJ (mx, ny, 0))
61
62tlen = []
63dh0 = 1
64dh = 0.02
65lh = 0
66for nro in range(5):
67 dh = 1.5*dh + 1
68 lh += dh
69 tlen.append(lh)
70
71nbiter = 5
72doc.saveVtk ("prisme1.vtk")
73prisme2 = doc.extrudeQuadsUni (liste2, dir2, dh0, nbiter)
74doc.saveVtk ("prisme2.vtk")
75
76prisme1 = doc.extrudeQuads (liste1, dir1, tlen)
77
78doc.saveVtk ("prisme3.vtk")
Join quadrangle or quadrangles
Uniform Join
The following data are required:
quad : the quad to be joined and from which hexahedra will be created (one quad case).
quads : the set of quadrangles to be joined and from which hexahedra will be created (multiple quad case).
quadDest : a quadrangle from the set of targeted quadrangles.
fromPointA: a vertex belonging to the first quadrangle of the set of quadrangles.
toPointA : the target vertex (in the target quadrangle) for fromPointA.
fromPointB: a vertex, consecutive to previous Point a, belonging to the first quadrangle.
toPointB : the target vertex (in the target quadrangle) for fromPointB.
nbLayers : number of layers of hexahedra issued from the operation.
To join one quad to an other use the function joinQuadUni:
elts = doc.joinQuadUni(quad, quadDest, fromPointA, toPointA, fromPointB, toPointB, nbLayers)
To join a set of quads to another quad use the function joinQuadsUni:
elts = doc.joinQuadsUni(quads, quadDest, fromPointA, toPointA, fromPointB, toPointB, nbLayers)
GUI command: Uniform Join Quadrangles
Custom Join
The following data are required:
quad : the quad to be joined and from which hexahedra will be created (one quad case).
quads : the set of quadrangles to be joined and from which hexahedra will be created (multiple quads case).
quadDest : a quadrangle from the set of targeted quadrangles.
fromPointA: a vertex belonging to the first quadrangle of the set of quadrangles.
toPointA : the target vertex (in the target quadrangle) for fromPointA.
fromPointB: a vertex, consecutive to previous Point a, belonging to the first quadrangle.
toPointB : the target vertex (in the target quadrangle) for fromPointB.
th : a list of heights to specify the size of each layer of hexahedra issued from the operation.
To make a custom join of one quad to another use the function joinQuad:
elts = doc.joinQuad(quad, quadDest, fromPointA, toPointA, fromPointB, toPointB, th)
To make a custom join of a set of quads to another quad use the function joinQuads:
elts = doc.joinQuads(quads, quadDest, fromPointA, toPointA, fromPointB, toPointB, th)
GUI command: Custom Join Quadrangles
Operations on elts: Elements
Example
1# -*- coding: utf-8 -*-
2# Copyright (C) 2009-2026 CEA, EDF
3#
4# This library is free software; you can redistribute it and/or
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
8#
9# This library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12# Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public
15# License along with this library; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17#
18# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19#
20
21####### Test for Join Quad ###############
22
23import hexablock
24
25
26
27doc = hexablock.addDocument("Join Quad Test")
28
29dimx = 11
30dimy = 11
31dimz = 2
32
33grid1 = doc.makeCartesianTop (dimx,dimy,dimz)
34
35orig2 = doc.addVertex(dimx/2.0,0,8)
36vectj = doc.addVector (0,1,0);
37vecti = doc.addVector (1,0,0);
38grid2 = doc.makeCylinderUni (orig2, vecti, vectj, 1.0, 2.0, 180.0, 11.0, dimz,dimy,dimx)
39
40mx = dimx/2
41my = dimy/2
42prems = grid1.getQuadIJ (mx, my, dimz)
43cible = grid2.getQuadJK (dimz, mx, my)
44
45va1 = prems.getVertex (0)
46va2 = prems.getVertex (1)
47
48vb1 = cible.getVertex (1)
49vb2 = cible.getVertex (2)
50
51hauteur = 5
52
53liste = []
54
55liste.append(prems)
56for nx in range(mx):
57 if nx!=mx:
58 liste.append(grid1.getQuadIJ(nx, my, dimz))
59
60for ny in range(dimy):
61 if (ny!=my):
62 liste.append(grid1.getQuadIJ (mx, ny, dimz))
63
64doc.saveVtk ("jointQuad1.vtk")
65joint = doc.joinQuadsUni (liste, cible, va1,vb1,va2,vb2, hauteur)
66doc.saveVtk ("jointQuad2.vtk")