Python scripting - Objects

CENPyOlpWaitForResourcePortEvent

 

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 wait for 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":

      waitPortEvent.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 = waitPortEvent.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 wait for.

When this event is executed in simulation it will wait until all the ports that were added reach their designated values.

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

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

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

 

[Example]

if (portComment == "Gripper Closed"):

   waitPortEvent.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")):

   waitPortEvent.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 wait for.

When this event is executed in simulation it will wait until all the ports that were added reach their designated values.

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

If the port is not an integer output 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_OUTPORTS)):

   waitPortEvent.AddResourcePortInt(port, 12)

 


   

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

   waitPortEvent.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 wait for.

When this event is executed in simulation it will wait until all the ports that were added reach their designated values.

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

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

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

 

[Example]

if (portComment == "Joint3 Value Output")):

   waitPortEvent.AddResourcePortFloat(port, 51.2)

 


 


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