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?
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.
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
Copy link to clipboard
Copied
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.