1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 # =======================================
29 from salome.geom import geomBuilder
30 geompy = geomBuilder.New()
32 import SMESH, SALOMEDS
33 from salome.smesh import smeshBuilder
34 smesh = smeshBuilder.New()
39 # A small cube centered and put on a great cube build by primitive geometric functionalities
53 blockPoint111 = geompy.MakeVertex(ox , oy, oz)
54 blockPoint211 = geompy.MakeVertex(ox+arete, oy, oz)
55 blockPoint112 = geompy.MakeVertex(ox , oy, oz+arete)
56 blockPoint212 = geompy.MakeVertex(ox+arete, oy, oz+arete)
61 blockFace1 = geompy.MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112)
63 blockSolid11 = geompy.MakePrismVecH(blockFace1, geompy.MakeVectorDXDYDZ(0, 1, 0), arete)
68 blockSolid21 = geompy.MakeTranslation(blockSolid11, arete, 0, 0)
69 blockSolid31 = geompy.MakeTranslation(blockSolid21, arete, 0, 0)
71 blockSolid12 = geompy.MakeTranslation(blockSolid11, 0, 0, arete)
72 blockSolid22 = geompy.MakeTranslation(blockSolid12, arete, 0, 0)
73 blockSolid32 = geompy.MakeTranslation(blockSolid22, arete, 0, 0)
75 blockSolid13 = geompy.MakeTranslation(blockSolid12, 0, 0, arete)
76 blockSolid23 = geompy.MakeTranslation(blockSolid13, arete, 0, 0)
77 blockSolid33 = geompy.MakeTranslation(blockSolid23, arete, 0, 0)
79 blockSolid111 = geompy.MakeTranslation(blockSolid22, 0, arete, 0)
85 c_l.append(blockSolid11)
86 c_l.append(blockSolid21)
87 c_l.append(blockSolid31)
88 c_l.append(blockSolid12)
89 c_l.append(blockSolid22)
90 c_l.append(blockSolid32)
91 c_l.append(blockSolid13)
92 c_l.append(blockSolid23)
93 c_l.append(blockSolid33)
94 c_l.append(blockSolid111)
96 c_cpd = geompy.MakeCompound(c_l)
98 piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
103 piece_id = geompy.addToStudy(piece, "ex02_cube2primitive")
108 # Create hexahedrical mesh on piece
109 # ---------------------------------
111 hexa = smesh.Mesh(piece, "ex02_cube2primitive:hexa")
113 algo = hexa.Segment()
125 # Update object browser
126 # ---------------------
128 salome.sg.updateObjBrowser()