跳转到内容

PathPoints

app.activeDocument.pathItems[index].pathPoints

特定路径中的 PathPoint 对象集合。

元素没有名称;必须通过索引访问它们。


app.activeDocument.pathItems[index].pathPoints.length

集合中的元素数量。

数字;只读。


app.activeDocument.pathItems[index].pathPoints.parent

对象的容器。

对象;只读。


app.activeDocument.pathItems[index].pathPoints.typename

对象的类名。

字符串;只读。


app.activeDocument.pathItems[index].pathPoints.add()

创建一个新对象。

PathPoint


app.activeDocument.pathItems[index].pathPoints.index(itemKey)

从集合中获取一个元素。

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

PathPoint


app.activeDocument.pathItems[index].pathPoints.removeAll()

删除集合中的所有元素。

无。


// 向现有路径追加一个新的 PathPoint
// 并初始化其锚点和控制点。
if (app.documents.length > 0) {
var doc = app.activeDocument;
var line = doc.pathItems.add();
line.stroked = true;
line.setEntirePath(Array(Array(220, 475), Array(375, 300)));
// 向线条追加另一个点
var newPoint = doc.pathItems[0].pathPoints.add();
newPoint.anchor = Array(220, 300);
newPoint.leftDirection = newPoint.anchor;
newPoint.rightDirection = newPoint.anchor;
newPoint.pointType = PointType.CORNER;
}