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

名称类型访问最低版本描述
anchornumber[]R W23.3The X and Y coordinates of the anchor point of the curve.
kindPointKindR W23.3The role (corner or smooth) this point plays in the containing path segment.
leftDirectionnumber[]R W23.3The location of the left-direction endpoint('in' position).
rightDirectionnumber[]R W23.3The location of the right-direction endpoint('out' position).
typenamestringR23.3The class name of the referenced object: "PathPointInfo".
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.