Salome HOME
bos #29469: [EDF] (2022-T1) Advanced geometry features: Detect type of shape
[modules/shaper.git] / src / PythonAPI / geom / CanonicalRecognition.py
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.
5 #
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.
10 #
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
14 #
15 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
16 #
17
18 from GeomAlgoAPI import GeomAlgoAPI_CanonicalRecognition
19
20 class CanonicalRecognition:
21     "The class provides recognition of canonical shapes"
22
23     def isPlane(self, shape, tolerance, normal = [], origin = []):
24         """
25         Check if shape is planar
26         Usage:
27         > CR.isPlane(shape, tolerance, normal, origin)
28         """
29         return GeomAlgoAPI_CanonicalRecognition.isPlane(shape, tolerance, normal, origin)
30
31     def isSphere(self, shape, tolerance, origin = [], radius = 0.0):
32         """
33         Check if shape is spherical
34         Usage:
35         > CR.isSphere(shape, tolerance, origin, radius)
36         """
37         return GeomAlgoAPI_CanonicalRecognition.isSphere(shape, tolerance, origin, radius)
38
39     def isCone(self, shape, tolerance, axis = [], apex = [], halfAngle = 0.0):
40         """
41         Check if shape is conical
42         Usage:
43         > CR.isCone(shape, tolerance, axis, apex, halfAngle)
44         """
45         return GeomAlgoAPI_CanonicalRecognition.isCone(shape, tolerance, axis, apex, halfAngle)
46
47     def isCylinder(self, shape, tolerance, axis = [], origin = [], radius = 0.0):
48         """
49         Check if shape is cylinder
50         Usage:
51         > CR.isCylinder(shape, tolerance, axis, origin, radius)
52         """
53         return GeomAlgoAPI_CanonicalRecognition.isCylinder(shape, tolerance, axis, origin, radius)
54
55     def isLine(self, edge, tolerance, direction = [], origin = []):
56         """
57         Check if edge/wire is line
58         Usage:
59         > CR.isLine(edge, tolerance, direction, origin)
60         """
61         return GeomAlgoAPI_CanonicalRecognition.isLine(edge, tolerance, direction, origin)
62
63     def isCircle(self, edge, tolerance, normal = [], origin = [], radius = 0.0):
64         """
65         Check if edge/wire is circle
66         Usage:
67         > CR.isCircle(edge, tolerance, normal, origin, radius)
68         """
69         return GeomAlgoAPI_CanonicalRecognition.isCircle(edge, tolerance, normal, origin, radius)
70
71     def isEllipse(self, edge, tolerance, normal = [], dirX = [], origin = [], majorRadius = 0.0, minorRadius = 0.0):
72         """
73         Check if edge/wire is ellipse
74         Usage:
75         > CR.isEllipse(edge, tolerance, normal, dirX, origin, majorRadius, minorRadius)
76         """
77         return GeomAlgoAPI_CanonicalRecognition.isEllipse(edge, tolerance, normal, dirX, origin, majorRadius, minorRadius)
78
79     def isImplemented(self):
80         """
81         Check if the CanonicalRecognition is implemented (built with appropriate OCCT version)
82         Usage:
83         > CR.isImplemented()
84         """
85         return GeomAlgoAPI_CanonicalRecognition.isImplemented()