2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from model.roots import Interface
9 def addPlane(part, *args):
10 """Add a Plane feature to the Part and return Plane.
12 .. function:: addPartition(part, face, distance)
15 part (ModelAPI_Document): part document
16 face (Selection): plane face
17 distance (double): distance
19 .. function:: addPartition(part, a, b, c, d)
22 part (ModelAPI_Document): part document
23 a (double): general equation parameter
24 b (double): general equation parameter
25 c (double): general equation parameter
26 d (double): general equation parameter
32 feature = part.addFeature("Plane")
33 return Plane(feature, *args)
36 class Plane(Interface):
37 """Interface class for Plane feature.
39 .. function:: Plane(feature)
41 Create interface for the feature without initialization.
43 .. function:: Plane(feature, face, distance)
45 Create interface for the feature and initialize the feature with arguments.
47 .. function:: Plane(feature, a, b, c, d)
49 Create interface for the feature and initialize the feature with arguments.
52 def __init__(self, feature, *args):
53 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
54 Interface.__init__(self, feature)
55 assert(self._feature.getKind() == "Plane")
57 self._CreationMethod = self._feature.data().string("CreationMethod")
58 self._plane_face = self._feature.data().selection("planeFace")
59 self._distance = self._feature.data().real("distance")
60 self._a = self._feature.data().real("A")
61 self._b = self._feature.data().real("B")
62 self._c = self._feature.data().real("C")
63 self._d = self._feature.data().real("D")
65 assert(self._CreationMethod)
66 assert(self._plane_face)
67 assert(self._distance)
76 assert(len(args) in (2, 4))
78 self.setFaceAndDistance(*args)
80 self.setGeneralEquation(*args)
86 self._fillAttribute(self._CreationMethod, "PlaneByFaceAndDistance")
87 self._fillAttribute(self._plane_face, None)
88 self._fillAttribute(self._distance, 0)
89 self._fillAttribute(self._a, 0)
90 self._fillAttribute(self._b, 0)
91 self._fillAttribute(self._c, 0)
92 self._fillAttribute(self._d, 0)
94 def setFaceAndDistance(self, face, distance):
95 """Modify face and distance attribute of the feature.
100 self._fillAttribute(self._CreationMethod, "PlaneByFaceAndDistance")
101 self._fillAttribute(self._plane_face, face)
102 self._fillAttribute(self._distance, distance)
105 def setGeneralEquation(self, a, b, c, d):
106 """Modify GeneralEquation parameters of the feature.
111 self._fillAttribute(self._CreationMethod, "PlaneByGeneralEquation")
112 self._fillAttribute(self._a, a)
113 self._fillAttribute(self._b, b)
114 self._fillAttribute(self._c, c)
115 self._fillAttribute(self._d, d)