代码描述#

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

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

Codedesc(索引,c1,c2,c3,c4,c5)

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

范围

描述

索引

Codedesc 对象的索引,从 1 到 5。**注意:**创建两个具有相同索引号的 Codedesc 对象将导致第二个创建的对象覆盖第一个。

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)

默认情况下,“ALL_CODES”标签将返回所有带有 AI 视觉传感器的 Codedesc 对象。