Skip to content

PathPoints

app.activeDocument.pathItems[index].pathPoints

A collection of PathPoint objects in a specific path.

The elements are not named; you must access them by index.


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

Number of elements in the collection.

Number; read-only.


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

The object’s container.

Object; read-only.


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

The class name of the object.

String; read-only.


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

Creates a new object.

PathPoint


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

Gets an element from the collection.

ParameterTypeDescription
itemKeyString, NumberString or number key

PathPoint


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

Deletes all elements in the collection.

Nothing.


// Appends a new PathPoint to an existing path
// and initializes its anchor and handle points.
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)));
// Append another point to the line
var newPoint = doc.pathItems[0].pathPoints.add();
newPoint.anchor = Array(220, 300);
newPoint.leftDirection = newPoint.anchor;
newPoint.rightDirection = newPoint.anchor;
newPoint.pointType = PointType.CORNER;
}