Python scripting OLP - Objects

CENPyOlpSetResourcePortEvent

 

Methods

 

SetResource(resource: CENPyOlpResource)

 

 

o

resource

The resource that should be assigned to this event.

 

Assigns a resource to this event. The event can only set ports of the one resource that is currently assigned.

Please note! In order to add resource ports and set their values, the resource must be set to a port event.

 

[Example]

controller = Operator.GetController()

resources = controller.GetResources(FSITEMTYPE_PRODUCTION, SUBITEM_NONE)

for r in range(0, len(resources)):

   olpResource = resources[r]

   if olpResource.GetName() == "ArcMate100iC_wDV":

      setPortEvent.SetResource(olpResource)

 


 

GetResource(): CENPyOlpResource

 

 

o

return

The resource that is currently assigned to this event.

 

Returns the resource that is currently assigned to this event.

 

[Example]

olpResource = setPortEvent.GetResource()

 


 

AddResourcePortBool(port: CENPyOlpPort, value: bool)

 

 

o

port

The port to be added

 

o

value

The value for the port

 

Adds a port and a bool value for the port that this event should set.

When the event is executed in simulation it will set the designated values to the ports that were added.

If the port does not belong to the assigned resource it will not be added.

If the port is not a bool input port it will not be added.

If the port is already added its current value will be overwritten.

 

[Example]

if (portComment == "Close Gripper"):

   setPortEvent.AddResourcePortBool(port, True)

 


 

AddResourcePortByte(port: CENPyOlpPort, value: unsigned char)

 

 

o

port

The port to be added

 

o

value

The value for the port. An unsigned char is an unsigned byte value (0 to 255). You may be thinking of char in terms of being a "character" but it is actually a numerical value.

 

Adds a port and a byte value for the port that this event should set.

When the event is executed in simulation it will set the designated values to the ports that were added.

If the port does not belong to the assigned resource it will not be added.

If the port is not a byte input port it will not be added.

If the port is already added its current value will be overwritten.

 

[Example]

if (portComment == "ByteInput")):

   setPortEvent.AddResourcePortByte(port, 101)

 


 

AddResourcePortInt(port: CENPyOlpPort, value: int)

 

 

o

port

The port to be added

 

o

value

The value for the port

 

Adds a port and an integer value for the port that this event should set.

When the event is executed in simulation it will set the designated values to the ports that were added.

If the port does not belong to the assigned resource it will not be added.

If the port is not a 32-bit integer port it will not be added.

If the port is already added its current value will be overwritten.

 

[Example]

if ((portValueType == VALUETYPE_INT) and (portDirection == RES_INPORTS)):

   setPortEvent.AddResourcePortInt(port, 8)

 


 

AddResourcePortInt16(port: CENPyOlpPort, value: short)

 

 

o

port

The port to be added

 

o

value

The value for the port

 

Adds a port and an integer value for the port that this event should set.

When the event is executed in simulation it will set the designated values to the ports that were added.

If the port does not belong to the assigned resource it will not be added.

If the port is not a 16-bit integer input port it will not be added.

If the port is already added its current value will be overwritten.

 

[Example]

if ((portValueType == VALUETYPE_INT16) and (portDirection == RES_INPORTS)):

   setPortEvent.AddResourcePortInt(port, 4)

 


 

AddResourcePortFloat(port: CENPyOlpPort, value: float)

 

 

o

port

The port to be added

 

o

value

The value for the port

 

Adds a port and a floating point value for the port that this event should set.

When the event is executed in simulation it will set the designated values to the ports that were added.

If the port does not belong to the assigned resource it will not be added.

If the port is not a float input port it will not be added.

If the port is already added its current value will be overwritten.

 

[Example]

if (portComment == "Joint1 Value Input")):

   setPortEvent.AddResourcePortFloat(port, 28.6)

 


 


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