1 # This library is free software; you can redistribute it and/or
2 # modify it under the terms of the GNU Lesser General Public
3 # License as published by the Free Software Foundation; either
4 # version 2.1 of the License, or (at your option) any later version.
6 # This library is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 # Lesser General Public License for more details.
11 # You should have received a copy of the GNU Lesser General Public
12 # License along with this library; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 from GeomAlgoAPI import GeomAlgoAPI_CanonicalRecognition
20 class CanonicalRecognition:
21 "The class provides recognition of canonical shapes"
23 def isPlane(self, shape, tolerance, normal = [], origin = []):
25 Check if shape is planar
27 > CR.isPlane(shape, tolerance, normal, origin)
29 return GeomAlgoAPI_CanonicalRecognition.isPlane(shape, tolerance, normal, origin)
31 def isSphere(self, shape, tolerance, origin = [], radius = 0.0):
33 Check if shape is spherical
35 > CR.isSphere(shape, tolerance, origin, radius)
37 return GeomAlgoAPI_CanonicalRecognition.isSphere(shape, tolerance, origin, radius)
39 def isCone(self, shape, tolerance, axis = [], apex = [], halfAngle = 0.0):
41 Check if shape is conical
43 > CR.isCone(shape, tolerance, axis, apex, halfAngle)
45 return GeomAlgoAPI_CanonicalRecognition.isCone(shape, tolerance, axis, apex, halfAngle)
47 def isCylinder(self, shape, tolerance, axis = [], origin = [], radius = 0.0):
49 Check if shape is cylinder
51 > CR.isCylinder(shape, tolerance, axis, origin, radius)
53 return GeomAlgoAPI_CanonicalRecognition.isCylinder(shape, tolerance, axis, origin, radius)
55 def isLine(self, edge, tolerance, direction = [], origin = []):
57 Check if edge/wire is line
59 > CR.isLine(edge, tolerance, direction, origin)
61 return GeomAlgoAPI_CanonicalRecognition.isLine(edge, tolerance, direction, origin)
63 def isCircle(self, edge, tolerance, normal = [], origin = [], radius = 0.0):
65 Check if edge/wire is circle
67 > CR.isCircle(edge, tolerance, normal, origin, radius)
69 return GeomAlgoAPI_CanonicalRecognition.isCircle(edge, tolerance, normal, origin, radius)
71 def isEllipse(self, edge, tolerance, normal = [], dirX = [], origin = [], majorRadius = 0.0, minorRadius = 0.0):
73 Check if edge/wire is ellipse
75 > CR.isEllipse(edge, tolerance, normal, dirX, origin, majorRadius, minorRadius)
77 return GeomAlgoAPI_CanonicalRecognition.isEllipse(edge, tolerance, normal, dirX, origin, majorRadius, minorRadius)
79 def isImplemented(self):
81 Check if the CanonicalRecognition is implemented (built with appropriate OCCT version)
85 return GeomAlgoAPI_CanonicalRecognition.isImplemented()