Codedesc#

The Codedesc class holds the AI Vision Sensor Color Codes. A Codedesc object can not be created unless two Colordesc objects have already been created. Up to five Color Codes can be stored at once, and each Color Code can have up to five Color Signatures in them.

A Color Code is created by using the following constructor:

Codedesc(index, c1, c2, c3, c4, c5)

This constructor uses six parameters:

Parameter

Description

index

The Codedesc object’s index, from 1 - 5. Note: Creating two Codedesc objects with the same index number will cause the second created object to override the first.

c1

The name of the first Colordesc object in the Color Code.

c2

The name of the second Colordesc object in the Color Code.

c3

Optional. The name of the third Colordesc object in the Color Code.

c4

Optional. The name of the fourth Colordesc object in the Color Code.

c5

Optional. The name of the fifth Colordesc object in the Color Code.

# Create a new Color Signature "red" with the Colordesc class.
red = Colordesc(1, 207, 19, 25, 10.00, 0.20)
# Create a new Color Signature "purple" with the Colordesc class.
purple = Colordesc(2, 98, 18, 227, 10.00, 0.20)
# Create a new Color Code "red_purple" with the Codedesc class.
red_purple = (1, red, purple)

By default, the ALL_CODES tag will return all Codedesc objects with the AI Vision Sensor.