Python scripting - Technology callbacks

PostTechInitEvents

 

The callback PostTechInitEvents(CENPyOlpTech_EventInitOperator) is called just after the kernel initializes the technology events.

 

It can be used to:

- initialize technology events

- output to the log

 

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

 

PostTechInitEvents

 

[Example]

 

def PostTechInitEvents(TechEventInitOperator):

   TechEventInitOperator.RegisterPyTechnologyEvent('GasEvent.py')  # Register event from the file 'GasEvent.py' (Listed below)

   TechEventInitOperator.RegisterPyTechnologyEvent('GetSensorEvent.py')

   TechEventInitOperator.RegisterPyTechnologyEvent('LaserEvent.py')

   TechEventInitOperator.RegisterPyTechnologyEvent('SetActorEvent.py')

   TechEventInitOperator.RegisterPyTechnologyEvent('ZAxisEvent.py')

   TechEventInitOperator.RegisterPyTechnologyEvent('ChangeRecipeEvent.py')

 

[Example]

File: Samples\JenoptikPluginUpdated\Plugin\TechnologyPackages\LaserCuttingTechnology\Jenoptik\GasEvent.py

 

from centypes import *

GAS_TYPE = "GasType"

GAS_TYPE_LIST = ["Off", "StandBy", "OnPierce", "OnContour"]

GAS_OFFSET = "GasOffset"

 

def GetEventName():

   return "GasEvent"   

def GetEventUuId():

   return "0B446ABF-6F16-4C28-A145-17B085959D09"   

def GetIconName():

   return "GasEvent"   

def GetExplodeCycle():

   return 0   

def GetMultipleCreationIsPossible():

   return 1   

def PostInitAttributes(eo):

   attribCreator = eo.GetAttribCreator()

   # Gas type

   attribCreator.AddEnum(GAS_TYPE, GAS_TYPE_LIST, GAS_TYPE_LIST[0], USER_ATTRIBUTE | PROCESS_ATTRIBUTE, GAS_TYPE)

   # Gas offset

   attribCreator.AddDouble(GAS_OFFSET, 0.99,0.0,1000.0, 1.0, USER_ATTRIBUTE | PROCESS_ATTRIBUTE, ATTRIB_LENGTH, GAS_OFFSET)

def PostProcessAttributes(CENPyOlpEvent_PEOperator):

   pass

 

As a result, new events appear on the user interface:

 

CENPyOlpTech_EventInitOperator_Result

 


PostTechInitEvents_Ex

 


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