• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Photoshop Scripting Shape vs. Path

Explorer ,
Sep 16, 2015 Sep 16, 2015

Copy link to clipboard

Copied

I want to draw a custom shape using scripting.  I can create a path, but how do I make it into a "shape" with a fill?

function make_path_object(points) {

 

var lineArr =[];

for(x=0; x<points.length; x++) {

    lineArr = new PathPointInfo();

    lineArr.kind = PointKind.CORNERPOINT;

    lineArr.anchor = [points[0], points[1]];

    lineArr.leftDirection = lineArr.anchor;

    lineArr.rightDirection = lineArr.anchor;

}

var lineSubPathArray = new Array();

lineSubPathArray[0] = new SubPathInfo();

lineSubPathArray[0].operation = ShapeOperation.SHAPEXOR;

lineSubPathArray[0].closed = true;

lineSubPathArray[0].entireSubPath = lineArr;

var myPathItem = docRef.pathItems.add('a line', lineSubPathArray);

return myPathItem;

}

make_path_object([[0,0],[10,0],[10,10],[0,10]]);

TOPICS
Actions and scripting

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 16, 2015 Sep 16, 2015

There is a scripting forum you should ask in.  When you do ask the question and provide more information on what you trying to do.  Do you want to create a shape layer you would need to add a solid color fill layer and add the path you created to the as a vector mask.  If you want to fill the pat area on the current layer convert the path to a selection and fill the selection.

Photoshop Scripting

You can also define the path as a custom shape then add a the custom shape layer.

I did that in this sc

...

Votes

Translate

Translate
Adobe
Adobe Employee ,
Sep 16, 2015 Sep 16, 2015

Copy link to clipboard

Copied

Moving this thread to :Photoshop Scripting

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2015 Sep 16, 2015

Copy link to clipboard

Copied

There is a scripting forum you should ask in.  When you do ask the question and provide more information on what you trying to do.  Do you want to create a shape layer you would need to add a solid color fill layer and add the path you created to the as a vector mask.  If you want to fill the pat area on the current layer convert the path to a selection and fill the selection.

Photoshop Scripting

You can also define the path as a custom shape then add a the custom shape layer.

I did that in this script http://www.mouseprints.net/old/dpr/potrace.jsx

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 17, 2015 Sep 17, 2015

Copy link to clipboard

Copied

LATEST

Thanks JJMack, that worked!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2015 Sep 17, 2015

Copy link to clipboard

Copied

You can use Action Manager code (as recorded with ScriptingListener.plugin) for the creation of the Solid Color Layer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines