代码描述#

Codedesc 类保存 AI 视觉传感器颜色代码。除非已创建两个 Colordesc 对象,否则无法创建 Codedesc 对象。最多可同时存储五个颜色代码,每个颜色代码最多可包含五个颜色签名。

使用以下构造函数创建颜色代码:

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

此构造函数使用六个参数:

范围

描述

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

颜色代码中第一个 Colordesc 对象的名称。

c2

颜色代码中第二个 Colordesc 对象的名称。

c3

可选。 颜色代码中第三个 Colordesc 对象的名称。

c4

可选。 颜色代码中第四个 Colordesc 对象的名称。

c5

可选。 颜色代码中第五个 Colordesc 对象的名称。

# 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.