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);
Hi, I have the matrix of TextFrame. I tried to get the normal TX & TY but it didnt work.
Do you have any idea why or how should I do it?
The Geometric Bounds:
var matrix = selection.matrix, pos= [ matrix.mValueTX, matrix.mValueTY]; app.activeDocument.convertCoordinate(pos ,CoordinateSystem.DOCUMENTCOORDINATESYSTEM ,CoordinateSystem.ARTBOARDCOORDINATESYSTEM)
Hi @m0riya, good question and we didn't answer the OP's question. I had a poke around and I couldn't find any property or method of anything that shows or provides a relationship between the matrix T values and the document or artboard coordinate spaces. If I translate the text frame by inverted T values (so they are both zero) it puts the item down *near* the bottom right corner of my artboard (but not exactly in the corner!). Sorry I couldn't find an answer.
However, as this thread explores, perhaps there are other ways?
Edit: ignore my previous post requesting a new question—you are perfectly correct to ask in this thread.