Copy link to clipboard
Copied
Hi All,
I am developing a C++ plugin for AI CC 2017. I need to get the rotation angle applied to a line segment.
I found this method in the AIRealMathSuite which might give what I need,
AIAPI void(* AIRealMathSuite::AIRealMatrixGetRotate) (const AIRealMatrix *m, AIReal *angle)
But for this I need the AIRealMatrix parameter which is the transformation matrix of the line segment.
I am not sure how to get that.
Any ideas where I might start on this?
Thanks!
Okay.. So, I was able to do it..
I was going through the Scripting forum to find some answers there, and I got a breakthrough..
AI adds a tag to an item if it has been rotated. The tag is 'BBAccumRotation'.
I used the object's dictionary to find the tag and get it's value. The value is stored as a string in radians.
Convert it to degrees and you get the rotation angle.
Copy link to clipboard
Copied
It seems that there is no way, to get it. I have similiar problem, trying to get rotation/transformation matrix of kGroupArt object. As documentation for AITransformArtSuite::TransformArt says:
- Text art, raster art, and placed art objects have associated transformation matrices. Functions such as
AIRasterSuite::GetRasterMatrix()
in the related suites provide access to the matrices.TransformArt()
does not use the associated matrix, but instead uses a matrix that you pass to the function.- Path art objects are simple collections of connected line segments, and do not have an associated transformation matrix. For these, you must use the
TransformArt()
function.
Copy link to clipboard
Copied
What are you trying to achieve? Do you want to distinguish between when a user draws a horizontal line and rotates it 90 degrees and when they draw a vertical line? I don't think that is possible. When you rotate a line, Illustrator just moves the points, it doesn't store the original points and the rotation. If you want to know the angle of a line segment, you can work this out from the start and end points.
Copy link to clipboard
Copied
I want to find if the user has transformed the line by rotating it. So, finding the angle through the coordinates won't be much useful to me.
I was going through the Scripting forum to find some answers there, and I got a breakthrough..
AI adds a tag to an item if it has been rotated. The tag is 'BBAccumRotation'.
I used the object's dictionary to find the tag and get it's value. The value is stored as a string in radians.
Convert it to degrees and you get the rotation angle.
Copy link to clipboard
Copied
Okay.. So, I was able to do it..
I was going through the Scripting forum to find some answers there, and I got a breakthrough..
AI adds a tag to an item if it has been rotated. The tag is 'BBAccumRotation'.
I used the object's dictionary to find the tag and get it's value. The value is stored as a string in radians.
Convert it to degrees and you get the rotation angle.