Copy link to clipboard
Copied
Hi,
How can I convert this matrix to a one that actually transforms a PageItem in the document ? Seems like PlacedItem's matrix is defined in a very mysterious coordinate system that never been mentioned anywhere in the documentation.
regards
Copy link to clipboard
Copied
Can you re-phrase your question I don't understand what you want to do here…?
Copy link to clipboard
Copied
I want to convert the PlacedItem::matrix to a local transformation matrix relative to the artboards coordinate space.
A typical placed item matrix
(a,b,c,d,tx,ty) = 0.8474169969558716 0.5309280157089233 0.5309280157089233 -0.8474169969558716 -2089.5380859375 10003.640625
but the bounds of the item are: 638.2664184570313,-194.9597625732422,783.7483520507813,-345.822021484375
as you can see the translations are extremely bigger than what it sould be, the matrix is obvously not defined at the same space with bounds(which is defined in artboard space).
My aim is to replace a PlacedItem with the original contents from another AI file(like embedding). To do that I need to transform copied elements to the exact same place of the PlacedItem, what I need is the matrix that I can apply to the elements from original file
Copy link to clipboard
Copied
you can use "Relink" to replace your PlacedItem with the contents of another Ai file, and it will go to the exact same place the PlacedItem was.
Copy link to clipboard
Copied
Hey Carlos,
I need the matrix for other purposes also. If a property is there why it is not even documented. I wonder if purpose of this sdk really is extending the applicaton or just to make developers waste time and come up with pretty limited stuff never can be seen as a new feature. Other applications directly link to their internal libraries, they use their own SDK to develop new features for their won application, they actually FIELD TEST their OWN SDK, OR scripting engine. This Creative suite SDK and Scripting engine looks like just a tool for non-developers to automate some stuff...
Copy link to clipboard
Copied
I hear you, the AI scripting capabilities are very limited, we have to work with what we have.
what other purposes? describe exactly what you're trying to achive, we might be able to find a solution.
Copy link to clipboard
Copied
I want to export that matrix to use on 2d game engine. I am using placeditems as references to my entities, well at least I was hoping to. If I use the exported SVG unfortunately, the placed items are embedded and even the object local coordinates are recalculated, there is not useful matrix there either. It looks like obfuscation, matrix is there and they just want to hide it.
Copy link to clipboard
Copied
Just a suggestion, the matrix properties A thru D could easily be stored in a variable… TX & TY I have never been able to work out… they don't appear calculated to anything I can find… But don't you just need A thru D and the bounds array to position the item…?
Copy link to clipboard
Copied
I need the TX and TY too.
Did you succeed getting them?