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

Is there a tutorial for rendering paths?

New Here ,
Sep 07, 2020 Sep 07, 2020

Copy link to clipboard

Copied

Adobe's documentation explains very little about this process. What is the easiest way to use a JS script to draw consective connected anchor points up to an arbitrary number?

TOPICS
Actions and scripting

Views

795

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
Adobe
People's Champ ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

I did not understand anything
For error control
wrap all the code in a block
try {
...
} catch (e) {alert (e); }

Don't forget to include in your code the push_point function, which is defined at the very end.

What is difficult or incomprehensible for you?
My code is absolutely working, tested.
 

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
New Here ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

Again sorry you're bothered with the reposts, the system keeps deleting them so I have to keep reposting them.

 

I literally just copied and pasting the code and it didn't compile, I'm not sure why that occured.


What I did just try as well though is copying only the first segment and the function definition, and somehow that semi-worked. Photoshop compiled the script successfully, but didn't render anything. It seems as though it processed the locations of these points somewhere, but it wasn't told to render anything with them.

 

The difficulty is not its incomprehensibility, it's a lack explanation in each of the components. As I have been saying all along, the issue is communication based. If I could construct a path as easily as saying something like app.activeDocument.addPoints(<type>,<location>,<handle location>,<connected = (boolean expression)>,<closed = (boolean expression)>) then I think it would be straight forward and I wouldn't be here, but for some reason it's more complicated than that.

It seems an array needs to be created manually (for each...path? Or maybe each subpath too?) instead of implicitly in the hard code and it looks like somehow specific indices in that array need to be referenced to make the points do anything. I'm not really sure how to predict which element I will need when it looks like 4 different points have the same index. I'm not entirely sure what the function you defined is doing.

 

What I aim to work with eventually once I get the hang of generating points is generating them in very precisely spaced locations, like for instance "every 100 pixels" according to the document length, so I might not need a push function which seems based more on relative position rather than absolute position, though if that is what it's doing, it's good to know about.

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
New Here ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

Again sorry you're bothered with the reposts, the system keeps deleting them so I have to keep reposting them.

 

I literally just copied and pasting the code and it didn't compile, I'm not sure why that occured.


What I did just try as well though is copying only the first segment and the function definition, and somehow that semi-worked. Photoshop compiled the script successfully, but didn't render anything. It seems as though it processed the locations of these points somewhere, but it wasn't told to render anything with them.

 

The difficulty is not its incomprehensibility, it's a lack explanation in each of the components. As I have been saying all along, the issue is communication based. If I could construct a path as easily as saying something like app.activeDocument.addPoints(<type>,<location>,<handle location>,<connected = (boolean expression)>,<closed = (boolean expression)>) then I think it would be straight forward and I wouldn't be here, but for some reason it's more complicated than that.

It seems an array needs to be created manually (for each...path? Or maybe each subpath too?) instead of implicitly in the hard code and it looks like somehow specific indices in that array need to be referenced to make the points do anything. I'm not really sure how to predict which element I will need when it looks like 4 different points have the same index. I'm not entirely sure what the function you defined is doing.

 

What I aim to work with eventually once I get the hang of generating points is generating them in very precisely spaced locations, like for instance "every 100 pixels" according to the document length, so I might not need a push function which seems based more on relative position rather than absolute position, though if that is what it's doing, it's good to know about.

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