The callback PostWmInitEvents(CENPyOlpWM_EventInitOperator) is called just after the kernel initializes the workmethod events.
It can be used to:
- initialize workmethod events
- access OlpController
- output to the log
The callback is defined in the %WORKMETHOD_NAME%.py file that is located in the scripts folder of the plugin.
[Example]
from centypes import *
def PostWmInitAttributes(wmAttribInitOperator):
pass
def PostWmInitEvents(WmEventInitOperator):
wmEventInitOperator.RegisterPyTechnologyEvent('ZAxisEvent.py')
olpController = wmEventInitOperator.GetController()
contName = olpController.GetName()
contManufacturer = olpController.GetManufacturer()
logOperator = wmEventInitOperator.GetLoggerOperator()
logOperator.LogDebug('Controller name = ' + contName)
logOperator.LogDebug('Controller Manufacturer = ' + contManufacturer)
def PostWmInitRules(WmRuleInitOperator):
pass
[Example]
File: Samples\JenoptikPluginUpdated\Plugin\TechnologyPackages\LaserCuttingTechnology\Jenoptik\ZAxisEvent.py
from centypes import *
ZAXIS_TYPE = "ZAxisType"
ZAXIS_TYPE_LIST = ["Off", "RegPierce", "RegContour", "ProgPosContour", "ProgPosStandBy", "AutoCalib"]
ZAXIS_OFFSET = "ZAxisOffset"
def GetEventName():
return "ZAxisEvent"
def GetEventUuId():
return "A6E3CD41-05AB-4433-807D-63C186C522DD"
def GetIconName():
return "ZAxisEvent"
def GetExplodeCycle():
return 0
def GetMultipleCreationIsPossible():
return 1
def PostInitAttributes(EventAttribInitOperator):
attribCreator = EventAttribInitOperator.GetAttribCreator()
# ZAxis type
attribCreator.AddEnum(ZAXIS_TYPE, ZAXIS_TYPE_LIST, ZAXIS_TYPE_LIST[0], USER_ATTRIBUTE | PROCESS_ATTRIBUTE, ZAXIS_TYPE)
# ZAxis offset
attribCreator.AddDouble(ZAXIS_OFFSET,0.0,0.0,1000.0, 1.0, USER_ATTRIBUTE | PROCESS_ATTRIBUTE, ATTRIB_LENGTH, ZAXIS_OFFSET)
def PostProcessAttributes(CENPyOlpEvent_PEOperator):
pass
|