Edit in GitHubLog an issue

Path Point Info

Used to create a PathPoint, which represents the anchor and control-handle endpoints for a path segment. Each point (the anchor point, left-direction point, and right-direction point) is an array containing X and Y position coordinates.

  • Use the JavaScript new operator to create these objects, and store them in the SubPathInfo.entireSubPath property before using that object to create a path item with PathItems.add()

  • The resulting SubPathItem object contains the resulting PathPoint objects. Use the PathPoint object to retrieve information about the points that describe existing path segments. The properties are read-only.

For paths that are straight segments (not curved), the coordinates of all three points are the same. For curved segments, the coordinates are different. The difference between the anchor point and the left or right direction points determines the arc of the curve. Use the left direction point to bend the curve "outward" or make it convex; or use the right direction point to bend the curve "inward" or make it concave.

PathPointInfo sample script

Copied to your clipboard
1 function drawLine(doc: Document, start: number[], stop: number[]) {
2 const startPoint = new PathPointInfo();
3 startPoint.anchor = start;
4 startPoint.leftDirection = start;
5 startPoint.rightDirection = start;
6 startPoint.kind = Constants.PointKind.CORNERPOINT;
7
8 const stopPoint = new PathPointInfo();
9 stopPoint.anchor = stop;
10 stopPoint.leftDirection = stop;
11 stopPoint.rightDirection = stop;
12 stopPoint.kind = Constants.PointKind.CORNERPOINT;
13
14 const spi = new SubPathInfo();
15 spi.closed = false;
16 spi.operation = Constants.ShapeOperation.SHAPEXOR;
17 spi.entireSubPath = [startPoint, stopPoint];
18
19 const line = doc.pathItems.add("Line", [spi]);
20 line.strokePath(Constants.ToolType.PENCIL);
21 line.remove();
22 }
23
24 drawLine(app.activeDocument, [100,100], [200,200]);

Properties

NameTypeAccessMin VersionDescription
anchor
number[]
R W
23.3
The X and Y coordinates of the anchor point of the curve.
kind
R W
23.3
The role (corner or smooth) this point plays in the containing path segment.
leftDirection
number[]
R W
23.3
The location of the left-direction endpoint('in' position).
rightDirection
number[]
R W
23.3
The location of the right-direction endpoint('out' position).
typename
string
R
23.3
The class name of the referenced object: "PathPointInfo".
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.