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