Python scripting - Technology callbacks

PostTechOnAttribChanged

 

The callback PostTechOnAttribChanged(CENPyOlpTech_AttribChangedOperator) is called  from the kernel when a technology attribute has been changed.

 

It can be used to:

- get attribute values

- set attribute values

- output to the log

- access OlpController

 

The callback is defined in the %TechnologyName%.py file that is located in the scripts folder of the plugin.

 

PostTechOnAttribChanged

 

[Example]

 

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)

 


PostTechOnAttribChanged_Ex

 


Previous
Page précédente
Chapter
Page principale du chapitre
Next
Page suivante