Skip to main content
Rick E Johnson
Inspiring
October 13, 2022
Question

sAIArt->GetArtTransformBounds may return wrong values

  • October 13, 2022
  • 1 reply
  • 185 views

In a method where art is first rotated, then the plugin calls sAIArt->GetArtTransformBounds(theHandle, NULL, kNoStrokebounds, &bounds), the values are wrong (e.g., left is usually 20-30 pts. too high). Is there any way to nudge Illustrator to recalculate the art bounds before calling this?

This topic has been closed for replies.

1 reply

Rick E Johnson
Inspiring
October 14, 2022

Doing more experiments, using GetArtRotatedBounds or GetArtBounds instead of GetArtTransformBounds did not help. Syncing the document did not help. Calling SetArtBounds is supposed to "Updates cached information for the enclosing rectangle (bounding box) of an art object" but it did not help.

 

My function created 28 path art objects. I tried manually building bounding boxes using anchor point locations, and creating path art in order to actually see them. The bounding boxes were the right size, but again did not line up with the art whose anchor points they were made from! All were shifted to the right, and some were shifted up or down as well. The amount of the error varied from about 20 to over 100. It's as though each path art object were on its own coordinate system.

 

When the function finished, all measured objects were in their correct locations, but their bounding boxes were scattered nearby. Once created, the art objects were not moved or transformed. What could possibly cause the measurements to be off, and with different offsets for each item?