1 """Abstract root classes of user-defined Python features producing a Body
2 Author: Daniel Brunier-Coulin
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
8 class Feature(ModelAPI.ModelAPI_Feature):
9 """Base class of user-defined Python features."""
12 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
13 ModelAPI.ModelAPI_Feature.__init__(self)
15 def addRealInput(self, inputid):
16 """F.addRealInput(str) -- add real attribute"""
17 self.data().addAttribute(inputid,
18 ModelAPI.ModelAPI_AttributeDouble_typeId())
20 def getRealInput(self, inputid):
21 """F.getRealInput(str) -- get real value of the attribute"""
22 return self.data().real(inputid).value()
24 def getTextInput(self, inputid):
25 """F.getTextInput(str) -- get text value of the attribute"""
26 return self.data().real(inputid).text()
28 def addResult(self, result):
29 """F.addResult(ModelAPI_Result) -- add ModelAPI_Result shape as a result"""
30 shape = result.shape()
31 body = self.document().createBody(self.data())