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 Pass all args to Plane __init__ function.
14 feature = part.addFeature("Plane")
15 return Plane(feature, *args)
18 class Plane(Interface):
19 """Interface class for Plane feature.
21 Plane(feature) -> feature interface without initialization
22 Plane(feature, face, distance) ->
23 feature interface initialized from arguments:
25 - distance -- distance
26 Plane(feature, a, b, c, d) ->
27 feature interface initialized from arguments:
28 - A, B, C, D -- GeneralEquation parameters
31 def __init__(self, feature, *args):
32 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
33 Interface.__init__(self, feature)
34 assert(self._feature.getKind() == "Plane")
36 self._CreationMethod = self._feature.data().string("CreationMethod")
37 self._plane_face = self._feature.data().selection("planeFace")
38 self._distance = self._feature.data().real("distance")
39 self._a = self._feature.data().real("A")
40 self._b = self._feature.data().real("B")
41 self._c = self._feature.data().real("C")
42 self._d = self._feature.data().real("D")
44 assert(self._CreationMethod)
45 assert(self._plane_face)
46 assert(self._distance)
55 assert(len(args) in (2, 4))
57 self.setFaceAndDistance(*args)
59 self.setGeneralEquation(*args)
65 self._fill_attribute(self._CreationMethod, "PlaneByFaceAndDistance")
66 self._fill_attribute(self._plane_face, None)
67 self._fill_attribute(self._distance, 0)
68 self._fill_attribute(self._a, 0)
69 self._fill_attribute(self._b, 0)
70 self._fill_attribute(self._c, 0)
71 self._fill_attribute(self._d, 0)
73 def setFaceAndDistance(self, face, distance):
74 """Modify face and distance attribute of the feature.
79 self._fill_attribute(self._CreationMethod, "PlaneByFaceAndDistance")
80 self._fill_attribute(self._plane_face, face)
81 self._fill_attribute(self._distance, distance)
84 def setGeneralEquation(self, a, b, c, d):
85 """Modify GeneralEquation parameters of the feature.
90 self._fill_attribute(self._CreationMethod, "PlaneByGeneralEquation")
91 self._fill_attribute(self._a, a)
92 self._fill_attribute(self._b, b)
93 self._fill_attribute(self._c, c)
94 self._fill_attribute(self._d, d)