Python scripting - Objects

CENPyOlpEventHandler

 

Methods

 

GetEventsByName(tpElement: CENPyOlpTpElement, eventName: string ): list

 

o

tpElement

Toolpath element to check for events

 

o

eventName

Event name to search for

 

o

return

list of CENPyOlpEventObject objects

 

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]

 


 

GetRuleBasedEventsByName(tpElement: CENPyOlpTpElement, eventName: string ): list

 

o

tpElement

Toolpath element to check for events

 

o

eventName

Event name to search for

 

o

return

list of CENPyOlpEventObject objects

 

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)

 


 

GetBuiltInEventsByType(tpElement: CENPyOlpTpElement, eventType: BuiltInEventTypes): list

 

o

tpElement

Toolpath element to check for events

 

o

eventType

Event type to search for

 

o

return

list with objects that can have different Built-in event classes:

CENPyOlpBoolActorEvent

CENPyOlpSpeedEvent

CENPyOlpAccuracyEvent

CENPyOlpToolEvent

CENPyOlpDwellEvent

CENPyOlpAccelerationEvent

CENPyOlpSyncRobotsEvent

CENPyOlpSetResourcePortEvent

CENPyOlpWaitForResourcePortEvent

CENPyOlpLogicPortEvent

 

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)

 


 

AddEventByName(tpElement: CENPyOlpTpElement, eventName: string, insertPos: TPInsertPosition): CENPyOlpEventObject

 

o

tpElement

Toolpath element on which to add a new event

 

o

eventName

Name of the event to add

 

o

insertPos

Insert position. "Inherit" is not supported because there is no parent event

 

o

return

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)

 


 

AddBuiltInEventByType(tpElement: CENPyOlpTpElement, eventType: BuiltInEventTypes, insertPos: TPInsertPosition): One of the Built-in event classes

 

o

tpElement

Toolpath element on which to add a new event

 

o

eventType

Type of the event to add

 

o

insertPos

Insert position. "Inherit" is not supported because there is no parent event

 

o

return

Added event that can be one of the following Built-in event classes:

CENPyOlpBoolActorEvent

CENPyOlpSpeedEvent

CENPyOlpAccuracyEvent

CENPyOlpToolEvent

CENPyOlpDwellEvent

CENPyOlpAccelerationEvent

CENPyOlpSyncRobotsEvent

CENPyOlpSetResourcePortEvent

CENPyOlpWaitForResourcePortEvent

CENPyOlpLogicPortEvent

 

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)

 


 

RemoveEvent(tpElement: CENPyOlpTpElement, event: CENPyOlpEventObject)

 

o

tpElement

Toolpath element on which to remove an event

 

o

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)

 

o

tpElement

Toolpath element on which to remove all events

 

o

event

Event to remove that can be one of the following Built-in event classes:

CENPyOlpBoolActorEvent

CENPyOlpSpeedEvent

CENPyOlpAccuracyEvent

CENPyOlpToolEvent

CENPyOlpDwellEvent

CENPyOlpAccelerationEvent

CENPyOlpSyncRobotsEvent

CENPyOlpSetResourcePortEvent

CENPyOlpWaitForResourcePortEvent

CENPyOlpLogicPortEvent

 

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])

 


 

 


Previous
Previous page
Chapter
Chapter page
Next
Next page