PathPoints
PathPoints
Section titled “PathPoints”app.activeDocument.pathItems[index].pathPoints
特定路径中的 PathPoint 对象集合。
元素没有名称;必须通过索引访问它们。
PathPoints.length
Section titled “PathPoints.length”app.activeDocument.pathItems[index].pathPoints.length
集合中的元素数量。
数字;只读。
PathPoints.parent
Section titled “PathPoints.parent”app.activeDocument.pathItems[index].pathPoints.parent
对象的容器。
对象;只读。
PathPoints.typename
Section titled “PathPoints.typename”app.activeDocument.pathItems[index].pathPoints.typename
对象的类名。
字符串;只读。
PathPoints.add()
Section titled “PathPoints.add()”app.activeDocument.pathItems[index].pathPoints.add()
创建一个新对象。
PathPoints.index()
Section titled “PathPoints.index()”app.activeDocument.pathItems[index].pathPoints.index(itemKey)
从集合中获取一个元素。
参数 | 类型 | 描述 |
---|---|---|
itemKey | 字符串, 数字 | 字符串或数字键 |
PathPoints.removeAll()
Section titled “PathPoints.removeAll()”app.activeDocument.pathItems[index].pathPoints.removeAll()
删除集合中的所有元素。
无。
向路径添加路径点
Section titled “向路径添加路径点”// 向现有路径追加一个新的 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;}