Skip to content

PathItem

app.activeDocument.pathItems[index]

Specifies a path item, which contains PathPoint objects that define its geometry.

The PathItem class gives you complete access to paths in Illustrator.

The setEntirePath method provides an extremely efficient way to create paths comprised of straight lines.


app.activeDocument.pathItems[index].area

The area of this path in square points.

If the area is negative, the path is wound counterclockwise.

Self-intersecting paths can contain sub-areas that cancel each other out, which makes this value zero even though the path has apparent area.

Number (double); read-only.


app.activeDocument.pathItems[index].artworkKnockout

Is this object used to create a knockout, and if so, what kind of knockout.

KnockoutState


app.activeDocument.pathItems[index].blendingMode

The blend mode used when compositing an object.

BlendModes


app.activeDocument.pathItems[index].clipping

If true, this path should be used as a clipping path.

Boolean


app.activeDocument.pathItems[index].closed

If true, this path is closed.

Boolean


app.activeDocument.pathItems[index].controlBounds

The bounds of the object including stroke width and controls.

Array of 4 numbers; read-only.


app.activeDocument.pathItems[index].editable

If true, this item is editable.

Boolean; read-only.


app.activeDocument.pathItems[index].evenodd

If true, the even-odd rule should be used to determine “insideness.”

Boolean


app.activeDocument.pathItems[index].fillColor

The fill color of the path.

Color


app.activeDocument.pathItems[index].filled

If true, the path is filled.

Boolean


app.activeDocument.pathItems[index].fillOverprint

If true, the art beneath a filled object should be overprinted.

Boolean


app.activeDocument.pathItems[index].geometricBounds

The bounds of the object excluding stroke width.

Array of 4 numbers; read-only.


app.activeDocument.pathItems[index].guides

If true, this path is a guide object.

Boolean


app.activeDocument.pathItems[index].height

The height of the group item.

Number (double)


app.activeDocument.pathItems[index].hidden

If true, this item is hidden.

Boolean


app.activeDocument.pathItems[index].isIsolated

If true, this object is isolated.

Boolean


app.activeDocument.pathItems[index].layer

The layer to which this item belongs.

Layer; read-only.


app.activeDocument.pathItems[index].left

The position of the left side of the item (in points, measured from the left side of the page).

Number (double)


app.activeDocument.pathItems[index].length

The length of this path in points.

Number (double)


app.activeDocument.pathItems[index].locked

If true, this item is locked.

Boolean


app.activeDocument.pathItems[index].name

The name of this item.

String


app.activeDocument.pathItems[index].note

The note assigned to this item.

String


app.activeDocument.pathItems[index].opacity

The opacity of the object.

Range: 0.0 to 100.0

Number (double)


app.activeDocument.pathItems[index].parent

The parent of this object.

Layer or GroupItem


app.activeDocument.pathItems[index].pathPoints

The path points contained in this path item.

PathPoints; read-only.


app.activeDocument.pathItems[index].pixelAligned

true if this item is aligned to the pixel grid.

Boolean


app.activeDocument.pathItems[index].polarity

The polarity of the path.

PolarityValues


app.activeDocument.pathItems[index].position

The position (in points) of the top left corner of the pluginItem object in the format [x, y]. Does not include stroke weight.

Array of 2 numbers; read-only.


app.activeDocument.pathItems[index].resolution

The resolution of the path in dots per inch (dpi).

Number (double)


app.activeDocument.pathItems[index].selected

If true, this item is selected.

Boolean


app.activeDocument.pathItems[index].selectedPathPoints

All of the selected path points in the path.

PathPoints; read-only.


app.activeDocument.pathItems[index].sliced

If true, the item sliced.

Default: false

Boolean


app.activeDocument.pathItems[index].strokeCap

The type of line capping.

StrokeCap


app.activeDocument.pathItems[index].strokeColor

The stroke color for the path.

Color


app.activeDocument.pathItems[index].stroked

If true, the path should be stroked.

Boolean


app.activeDocument.pathItems[index].strokeDashes

Dash lengths. Set to an empty object, {}, for a solid line.

Object


app.activeDocument.pathItems[index].strokeDashOffset

The default distance into the dash pattern at which the pattern should be started.

Number (double)


app.activeDocument.pathItems[index].strokeJoin

Type of joints for the path.

StrokeJoin


app.activeDocument.pathItems[index].strokeMiterLimit

When a default stroke join is set to mitered, this property specifies when the join will be converted to beveled (squared-off ) by default. The default miter limit of 4 means that when the length of the point reaches four times the stroke weight, the join switches from a miter join to a bevel join. A value of 1 specifies a bevel join.

Range: 1 to 500.

Default: 4

Number (double)


app.activeDocument.pathItems[index].strokeOverprint

If true, the art beneath a stroked object should be overprinted.

Boolean


app.activeDocument.pathItems[index].strokeWidth

The width of the stroke (in points).

Number (double)


app.activeDocument.pathItems[index].tags

The tags contained in this item.

Tags; read-only.


app.activeDocument.pathItems[index].top

The position of the top of the item (in points, measured from the bottom of the page).

Number (double)


app.activeDocument.pathItems[index].typename

The class name of the referenced object.

String; read-only.


app.activeDocument.pathItems[index].uRL

The value of the Adobe URL tag assigned to this item.

String


app.activeDocument.pathItems[index].visibilityVariable

The visibility variable bound to the item.

Variable


app.activeDocument.pathItems[index].visibleBounds

The visible bounds of the item including stroke width.

Array of 4 numbers; read-only.


app.activeDocument.pathItems[index].width

The width of the item.

Number (double)


app.activeDocument.pathItems[index].wrapInside

If true, the text frame object should be wrapped inside this object.

Boolean


app.activeDocument.pathItems[index].wrapOffset

The offset to use when wrapping text around this object.

Number (double)


app.activeDocument.pathItems[index].wrapped

If true, wrap text frame objects around this object (text frame must be above the object).

Boolean


app.activeDocument.pathItems[index].zOrderPosition

The position of this item within the stacking order of the group or layer (parent) that contains the item.

Number; read-only.


app.activeDocument.pathItems[index].duplicate([relativeObject][, insertionLocation])

Creates a duplicate of the selected object.

ParameterTypeDescription
relativeObjectObject, optionalObject to duplicate to
insertionLocationElementPlacement, optionalLocation to insert element

PathItem


app.activeDocument.pathItems[index].move(relativeObject, insertionLocation)

Moves the object.

ParameterTypeDescription
relativeObjectObjectObject to move element within
insertionLocationElementPlacement, optionalLocation to move element to

PathItem


app.activeDocument.pathItems[index].remove()

Deletes this object.

Nothing.


app.activeDocument.pathItems[index].resize(
scaleX,
scaleY
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout]
)

Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 = 100%.

ParameterTypeDescription
scaleXNumber (double)Horizontal scaling factor
scaleYNumber (double)Vertical scaling factor
changePositionsBoolean, optionalWhether to effect art object positions and orientations
changeFillPatternsBoolean, optionalWhether to transform fill patterns
changeFillGradientsBoolean, optionalWhether to transform fill gradients
changeStrokePatternBoolean, optionalWhether to transform stroke patterns
changeLineWidthsNumber (double), optionalThe amount to scale line widths
scaleAboutTransformation, optionalThe point to use as anchor, to transform about

Nothing.


app.activeDocument.pathItems[index].rotate(
angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout]
)

Rotates the art item relative to the current rotation.

The object is rotated counter-clockwise if the angle value is positive, clockwise if the value is negative.

ParameterTypeDescription
angleNumber (double)The angle amount to rotate the element
changePositionsBoolean, optionalWhether to effect art object positions and orientations
changeFillPatternsBoolean, optionalWhether to transform fill patterns
changeFillGradientsBoolean, optionalWhether to transform fill gradients
changeStrokePatternBoolean, optionalWhether to transform stroke patterns
rotateAboutTransformation, optionalThe point to use as anchor, to transform about

Nothing.


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

Sets the path using an array of [x, y] coordinate pairs.

ParameterTypeDescription
pathPointsArray of [x, y] coordinate pairsArray of point coordinates to set

Nothing.


app.activeDocument.pathItems[index].transform(
transformationMatrix
[, changePositions]
[, changeFillPatterns]
[, changeFillGradients]
[, changeStrokePattern]
[, changeLineWidths]
[, transformAbout]
)

Transforms the art item by applying a transformation matrix.

ParameterTypeDescription
transformationMatrixMatrixTransformation matrix to apply
changePositionsBoolean, optionalWhether to change Positions
changeFillPatternsBoolean, optionalWhether to change Fill Patterns
changeFillGradientsBoolean, optionalWhether to change Fill Gradients
changeStrokePatternBoolean, optionalWhether to change Stroke Pattern
changeLineWidthsNumber (double), optionalThe amount to scale line widths
transformAboutTransformation, optionalThe point to use as anchor, to transform about

Nothing.


app.activeDocument.pathItems[index].translate(
[deltaX]
[, deltaY]
[, transformObjects]
[, transformFillPatterns]
[, transformFillGradients]
[, transformStrokePatterns]
)

Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical offset.

ParameterTypeDescription
deltaXNumber (double), optionalHorizontal offset
deltaYNumber (double), optionalVertical offset
transformObjectsBoolean, optionalWhether to transform Objects
transformFillPatternsBoolean, optionalWhether to transform Fill Patterns
transformFillGradientsBoolean, optionalWhether to transform Fill Gradients
transformStrokePatternsBoolean, optionalWhether to transform Stroke Patterns

Nothing.


app.activeDocument.pathItems[index].zOrder(zOrderCmd)

Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.

ParameterTypeDescription
zOrderCmdZOrderMethodStacking order arrangement method

Nothing.


// Sets the stroke and fill of a path item to colors of a randomly selected swatch
if (app.documents.length > 0 && app.activeDocument.pathItems.length > 0) {
var doc = app.activeDocument;
for (var i = 0; i < doc.pathItems.length; i++) {
var pathRef = doc.pathItems[i];
pathRef.filled = true;
pathRef.stroked = true;
var swatchIndex = Math.round(Math.random() * (doc.swatches.length - 1));
pathRef.fillColor = doc.swatches[swatchIndex].color;
pathRef.strokeColor = doc.swatches[swatchIndex].color;
}
}

// This script illustrates the use of the setEntirePath method.
// Creates a new open path consisting of 10 straight lines
if (app.documents.length > 0) {
var lineList = [];
for (i = 0; i < lineList.length; i++) {
lineList.push([i * 10 + 50, ((i - 5) ^ 2) * 5 + 50];
}
app.defaultStroked = true;
newPath = app.activeDocument.pathItems.add();
newPath.setEntirePath(lineList);
}