Salome HOME
Statistics of the operation
[plugins/canrecplugin.git] / doc / salome / examples / canrecplugindemo.py
1 # Canonical Recognition
2 import os
3 import salome
4 salome.salome_init()
5 from salome.geom import geomBuilder
6 import GEOM
7 geompy = geomBuilder.New( salome.myStudy )
8
9 # Import Shape
10 path = os.path.join(os.getenv("DATA_DIR"), "Shapes/Iges/geom.igs")
11 shape_igs = geompy.ImportIGES(path)
12
13 # Build Canonical Recognition
14 shape_cr = geompy.MakeCanonicalRecognition(shape_igs, True, True, 0.01)
15
16 # Get the number of canonical faces
17 init_nb_f = geompy.GetNbCanonicalFaces(shape_igs)
18 res_nb_f = geompy.GetNbCanonicalFaces(shape_cr)
19
20 print "Number of canonical faces in the initial shape: %s" % init_nb_f
21 print "Number of canonical faces in the result shape: %s" % res_nb_f
22
23 # Publish in the study
24 geompy.addToStudy( shape_igs, 'Import from IGS' )
25 geompy.addToStudy( shape_cr, 'Canonical Recognition' )
26
27 # Print what is information
28 print "========================================================="
29 print "Information about original shape:"
30 print geompy.WhatIs(shape_igs)
31 print "========================================================="
32 print "Information about converted shape:"
33 print geompy.WhatIs(shape_cr)