• 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 an equivalent to pointOnPaths for scripting?

Community Beginner ,
May 05, 2023 May 05, 2023

Copy link to clipboard

Copied

I'm working on a script that collects the path data from the selected layer and then checks to measure the pixel length of each path. I was using pointOnPath within an expression (h/t to Dan Ebberts) as a test, but I'm trying to create a more general tool through scripting, and pointOnPath doesn't seem to be accessible from scripts. Am I missing something? Is there an alternative way to get the path length in a script?

TOPICS
Scripting

Views

281

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 , May 06, 2023 May 06, 2023

With scripting, you just have access to the vertices, inTangents, and outTangents. In theory, you could come up with your own iterative routine to calculate the length of each bezier segment, but it would probably be easier to use a temporary pointOnPath() expression to cut the path into a bunch of small segments and approximate the length that way.

Votes

Translate

Translate
LEGEND ,
May 05, 2023 May 05, 2023

Copy link to clipboard

Copied

You can apply temporary expressions in scripts, bake the keyframes and use those values. You'll of course have to include extra loops to clean up after yourself and delete all the temp stuff. Otherwise you can always implement the Bèzier algorithm yourself and do al lthe calculations. It's really not that difficult.

 

Mylenium

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 ,
May 06, 2023 May 06, 2023

Copy link to clipboard

Copied

LATEST

With scripting, you just have access to the vertices, inTangents, and outTangents. In theory, you could come up with your own iterative routine to calculate the length of each bezier segment, but it would probably be easier to use a temporary pointOnPath() expression to cut the path into a bunch of small segments and approximate the length that way.

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