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.
15 feature = part.addFeature("Plane")
16 return Plane(feature, *args)
19 class Plane(Interface):
20 """Interface class for Plane feature.
22 Plane(feature) -> feature interface without initialization
23 Plane(feature, face, distance) ->
24 feature interface initialized from arguments:
26 - distance -- distance
27 Plane(feature, a, b, c, d) ->
28 feature interface initialized from arguments:
29 - A, B, C, D -- GeneralEquation parameters
32 def __init__(self, feature, *args):
33 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
34 Interface.__init__(self, feature)
35 assert(self._feature.getKind() == "Plane")
37 self._CreationMethod = self._feature.data().string("CreationMethod")
38 self._plane_face = self._feature.data().selection("planeFace")
39 self._distance = self._feature.data().real("distance")
40 self._a = self._feature.data().real("A")
41 self._b = self._feature.data().real("B")
42 self._c = self._feature.data().real("C")
43 self._d = self._feature.data().real("D")
45 assert(self._CreationMethod)
46 assert(self._plane_face)
47 assert(self._distance)
56 assert(len(args) in (2, 4))
58 self.setFaceAndDistance(*args)
60 self.setGeneralEquation(*args)
66 self._fillAttribute(self._CreationMethod, "PlaneByFaceAndDistance")
67 self._fillAttribute(self._plane_face, None)
68 self._fillAttribute(self._distance, 0)
69 self._fillAttribute(self._a, 0)
70 self._fillAttribute(self._b, 0)
71 self._fillAttribute(self._c, 0)
72 self._fillAttribute(self._d, 0)
74 def setFaceAndDistance(self, face, distance):
75 """Modify face and distance attribute of the feature.
80 self._fillAttribute(self._CreationMethod, "PlaneByFaceAndDistance")
81 self._fillAttribute(self._plane_face, face)
82 self._fillAttribute(self._distance, distance)
85 def setGeneralEquation(self, a, b, c, d):
86 """Modify GeneralEquation parameters of the feature.
91 self._fillAttribute(self._CreationMethod, "PlaneByGeneralEquation")
92 self._fillAttribute(self._a, a)
93 self._fillAttribute(self._b, b)
94 self._fillAttribute(self._c, c)
95 self._fillAttribute(self._d, d)