Skip to main content
Participant
April 2, 2018
Question

How to obtain positional data with the follow-up of trajectory?

  • April 2, 2018
  • 1 reply
  • 414 views

Hello,

I need your help :

I have abode effects and I cannot extract the positional data in format .csv "excel" ?

It's possible ? Can you explain please ?

It's for extract the positional data of the football players during a game to obtain :

sujet-physique-et-tableur-excel-123606.html

Thanks,

Julien

This topic has been closed for replies.

1 reply

stib
Inspiring
April 3, 2018

If you want to script it, you can access the position of a layer in the active composition like so:

app.project.activeItem.layer(i).position.valueAtTime();

where i is the index of the layer (counting from 1). Or you can select the layer and use:

app.project.activeItem.selectedLayers[0]

to return the first selected layer of the active comp

You can open a file to write into with

var f = new File("/URI/for/my/file.csv", "w");

f.write("hello, I'm writing to the file")

f.close();

The URI is the path to the file on your local filesystem, expressed as a URI, e.g. "//C/users/stib/Documents/data.csv" on Windows or "/Users/stib/Documents/data.csv" on mac.

You can loop through the frames of a composition by using

var myComp = app.project.activeItem;

var compLength = myComp.duration / myComp.frameDuration; //length in frames

for (var i =0; i < compLength; i++){

    //do stuff

}

So putting it all together:

var f = new File("/URI/for/my/file", "w");

var myComp = app.project.activeItem;
var myLayer = myComp.layer(1); //could also use myComp.selectedLayers[0]

var p;

var compLength = myComp.duration / myComp.frameDuration; //length in frames

for (var i =0; i < compLength; i++){

     p = app.project.activeItem.layer(i).position.valueAtTime(i * myComp.frameDuration)

     f.write(""+p[0]+","+ p[1] +"," + p[2] + "\n"); //write the data as three numbers separated by commas "x,y,z" plus a line return

}

f.close();

You may have to edit the output file with a text editor like notepad++ or textWrangler to format it exactly as you want.

Participant
April 3, 2018

Hello,

Thanks for your answer.

Sorry but where I enter the script in abode effects ?

Thanks

Julien

stib
Inspiring
April 9, 2018

Using a text editor, save the script as a .jsx file, e.g. "myscript.jsx" and then in abode effects go to File>Scripts>Run script file.

You know if you ever want to RTFM, it's right here.