PostTechOnAttribChanged
The callback PostTechOnAttribChanged (CENPyOlpTech_AttribChangedOperator) is called from the kernel when a technology attribute has been changed.
Il peut être utilisé pour :
-
obtenir des valeurs d’attribut
-
Définir les valeurs des attributs
-
sortie au journal
-
accéder à OlpController
The callback is defined in the %TechnologyName%.py file that is located in the scripts folder of the plugin.
def PostTechInitAttributes(Operator):
attribCreator = Operator.GetAttribCreator()
attribCreator.AddDouble(testDouble, 0.0, 0.0, 256.0, 0.1, USER_ATTRIBUTE | PROCESS_ATTRIBUTE | GLOBAL_ATTRIBUTE, ATTRIB_STANDARD, testDouble)
attribCreator.AddInteger(testInt, 0, 0, 256, USER_ATTRIBUTE | PROCESS_ATTRIBUTE | GLOBAL_ATTRIBUTE, testInt)
def PostTechOnAttribChanged(Operator):
changedAttribute = Operator.GetChangedAttribute()
changedAttributeName = changedAttribute.GetName()
if changedAttributeName == testDouble:
attribGetter = Operator.GetAttribGetter()
attribSetter = Operator.GetAttribSetter()
testDoubleValue = attribGetter.GetDouble(testDouble)
testDoubleValueRound = round(testDoubleValue)
attribSetter.SetInteger(testInt, testDoubleValueRound)Was this page helpful?