Answered
how to draw a shape Path
hi everybody,
I used the following code to draw the path
DrawShape([100, 100], [100, 250], [200, 200], [200, 100]);
function DrawShape() {
var doc = app.activeDocument;
var y = arguments.length;
var i = 0;
var lineArray = [];
for (i = 0; i < y; i++) {
lineArray[i] = new PathPointInfo;
lineArray[i].kind = PointKind.CORNERPOINT;
lineArray[i].anchor = arguments[i];
lineArray[i].leftDirection = lineArray[i].anchor;
lineArray[i].rightDirection = lineArray[i].anchor;
}
var lineSubPathArray = new SubPathInfo();
lineSubPathArray.closed = true;
lineSubPathArray.operation = ShapeOperation.SHAPEADD;
lineSubPathArray.entireSubPath = lineArray;
var myPathItem = doc.pathItems.add("myPath", [lineSubPathArray]);
var mySolidColor= new SolidColor();
mySolidColor.rgb.hexValue="ff0000";
myPathItem.fillPath(mySolidColor,ColorBlendMode.NORMAL,100,true,0,true,true);
myPathItem.strokePath(ToolType.SHARPEN);
myPathItem.remove();
}
The results are as follows,

but ,i want to getting a shape layer,How do I ?(use PathItem,PathPoint,PathPointInfo......)

