跳转到内容

图案

app.activeDocument.patterns

文档中的 Pattern 对象集合。


app.activeDocument.patterns.length

集合中的元素数量。

数字;只读。


app.activeDocument.patterns.parent

对象的容器。

对象;只读。


app.activeDocument.patterns.typename

对象的类名。

字符串;只读。


app.activeDocument.patterns.add()

创建一个新对象。

Pattern


app.activeDocument.patterns.getByName(name)

获取集合中具有指定名称的第一个元素。

参数类型描述
name字符串要获取的元素的名称

Pattern


app.activeDocument.patterns.index(itemKey)

从集合中获取一个元素。

参数类型描述
itemKey字符串, 数字字符串或数字键

Pattern


app.activeDocument.patterns.removeAll()

删除集合中的所有元素。

无。


// 从当前文档中删除最后一个图案。
if (app.documents.length > 0) {
var lastIndex = app.activeDocument.patterns.length - 1;
var patternToRemove = app.activeDocument.patterns[lastIndex];
var patternName = patternToRemove.name;
patternToRemove.remove();
// 注意:删除 Illustrator 对象后,将引用已删除对象的变量设置为 null,因为它现在无效。
patternToRemove = null;
}