I'm writing a tool to export PlacedItems' pos/rot/scale out to a JSON file, then reading them into a proprietary app. I get the transform matrix, no problem. However, the matrix values don't make sense.
In the poperties panel, the linked object's transform is [0, 0].
In the object's matrix, [mValueTX, mValueTY] are [-3314, -2537].
How do I reconcile these numbers?
Copy link to clipboard
I'm not sure if this will be the case, but try tinkering with Application.CoordinateSystem (CoordinateSystem)
There are two of them - Artboard and Document.
You could also use Document.convertCoordinate function, to recalculate the position, if you don't want to change it in whole Application for some reason.
While running Artboard coordinate system, then placement is calculated relative to artboard starting point, for Document - placement is calculated globally.
I don't remember which one was the default, but i know when i was working on some position translating scripts it saved me a lot of time.
Lumenn, worked great!
The documents have multiple Artboards, so I ended up using the conversion script.
sourceDoc.artboards.setActiveArtboardIndex(index); var pos = sourceDoc.convertCoordinate( item.position, CoordinateSystem.DOCUMENTCOORDINATESYSTEM, CoordinateSystem.ARTBOARDCOORDINATESYSTEM);