Get all existing Olp events with the specified name on the given toolpath element.
[Example]
eventHandler = Operator.GetEventHandler()
events = eventHandler.GetEventsByName(tpElement, "LaserOn")
if any(events):
laserOnEvent = events[0]
Get all existing rule-based Olp events with the specified name on the given toolpath element.
[Example]
eventHandler = Operator.GetEventHandler()
program = Operator.GetActiveProgram()
tpesWithCircleEvent = program.GetTpElementsWithEvent("CIRCLE")
for tpElement in tpesWithCircleEvent:
events = eventHandler.GetRuleBasedEventsByName(tpElement, "CIRCLE")
if any(events):
circleEvent = events[0]
radiusValue = circleEvent.GetDouble("Radius")
circleEvent.SetDouble("Radius", radiusValue + 0.0015)
Get all existing Built-in events with the specified type on the given toolpath element.
[Example]
eventHandler = Operator.GetEventHandler()
buildInEvents = eventHandler.GetBuiltInEventsByType(tpElement, EVENT_SPEED)
if any(buildInEvents):
speedEvent = buildInEvents[0]
speedValue = speedEvent.GetSpeed()
speedEvent.SetSpeed(speedValue + 10)
|
|
Toolpath element on which to add a new event
|
|
|
Name of the event to add
|
|
|
Insert position. "Inherit" is not supported because there is no parent event
|
|
|
Object of the CENPyOlpEventObject class
|
Add a new Olp event on the given toolpath element.
[Example]
newEvent = eventHandler.AddEventByName(tpElement, "ArcOnEvent", TPINSERTPOS_INSERTBEFORE)
if newEvent is not None:
newEvent.SetBool("WeaveOnOff", True)
Add a new Built-in event on the given toolpath element.
[Example]
setSignalBoolEvent = eventHandler.AddBuiltInEventByType(tpElement, EVENT_LOGICPORT, TPINSERTPOS_INSERTBEFORE)
if setSignalBoolEvent is not None:
logging.LogInfo("New logic port event was created.")
CENPyOlpPort = controller.GetLogicPortByName("TestOutputBool")
if CENPyOlpPort is not None:
logging.LogInfo("Logic port with the name <"+str(CENPyOlpPort.GetName())+"> was found.")
# Because it is an Output port, it converts the logic port event to event
setSignalBoolEvent.AddLogicPortBool(CENPyOlpPort, True)
waitForSignalBoolEvent = eventHandler.AddBuiltInEventByType(tpElement, EVENT_LOGICPORT, TPINSERTPOS_INSERTAFTER)
if waitForSignalBoolEvent is not None:
logging.LogInfo("New logic port event was created.")
CENPyOlpPort = controller.GetLogicPortByName("TestInputBool")
if CENPyOlpPort is not None:
logging.LogInfo("Logic port with the name <"+str(CENPyOlpPort.GetName())+"> was found.")
# Because it is an Input port, it converts the logic port event to event
waitForSignalBoolEvent.AddLogicPortBool(CENPyOlpPort, True)
|
|
Toolpath element on which to remove an event
|
|
|
Event object to remove
|
Remove the given Olp event from the specified toolpath element.
[Example]
events = eventHandler.GetEventsByName(tpElement, "LaserOn")
if any(events):
eventHandler.RemoveEvent(tpElement, events[0])
•
|
RemoveBuiltInEvent(tpElement: CENPyOlpTpElement, event: one of the Built-in event classes)
|
Remove the given Built-in event from the specified toolpath element.
[Example]
eventHandler = Operator.GetEventHandler()
logicPortEvents = eventHandler.GetBuiltInEventsByType(tpElement, EVENT_LOGICPORT)
if any(logicPortEvents):
eventHandler.RemoveBuiltInEvent(tpElement, logicPortEvents[0])
|