Salome HOME
0d5c132dab8abe096caf282e938e48f4a1ddfb03
[modules/hexablock.git] / src / TEST_PY / test_unit / test_shapes.py
1 # -*- coding: latin-1 -*-
2 # Copyright (C) 2009-2023  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 # Francis KLOSS : 2011-2013 : CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France
22 # =============================================================================================
23
24 import math
25 import hexablock
26 geompy = hexablock.geompy
27
28 # Construire le modèle de bloc
29 # ============================
30
31 doc = hexablock.addDocument("bielle")
32
33 # Charger la géométrie
34 # ====================
35
36 bielle = geompy.ImportSTEP("bielle.stp")
37 shape  = doc.addShape (bielle, "bielle")
38
39
40 # Sélectionner des sous-parties de la géométrie
41 # ---------------------------------------------
42
43 sommets = geompy.SubShapeAllIDs (bielle, geompy.ShapeType["VERTEX"])
44 aretes  = geompy.SubShapeAllIDs (bielle, geompy.ShapeType["EDGE"])
45
46 print(" ... Aretes  = ", aretes)
47 print(" ... Sommets = ", sommets)
48
49 nbfaces  = shape.countFace ()
50 nbedges  = shape.countEdge ()
51 nbvertex = shape.countVertex ()
52
53 for n in range (nbfaces) :
54     print(" Face nro %d = %s" % (n , shape.getNameFace (n)))
55 print()
56
57 for n in range (nbedges) :
58     print(" Edge nro %d = %s" % (n , shape.getNameEdge (n)))
59 print()
60
61 for n in range (nbvertex) :
62     print(" Vertex nro %d = %s" % (n , shape.getNameVertex (n)))
63
64
65