• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

AIArtHandle changes when anchor is moved

Community Beginner ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Hi there!

 

I'm working on a bridge plugin between our own CAD software and Illustrator, and it's going fine for the most, but now I've hit a weird wall... I'm probably not understanding something intrinsic to the SDK, so hopefully someone can shed some light.

 

I get some bezier lines from our software (through a socket connection), and get them into Illustrator, and I store the link between my own UUID and the AISafeArtHandle (that I get through the AIArtHandle).

 

But when I move a point in the bezier lines, I receive the notification that something has changed, but when I get the selected lines, it seems the ArtHandle (and SafeArtHandle) changes, so I can't find a link between the source line (on my software) and the changed line on Illustrator.

 

Initially I was only using AIArtHandle, but then I found about AISafeArtHandle and thought that was the missing link, but apparently no. As a secondary question, what's the difference between AIArtHandle and AISafeArtHandle? If I can't trust it to be immutable, it seems like there's no big difference between both.

 

Anybody has any idea on how to preserve this link?

 

Best regards,

Diogo

TOPICS
SDK

Views

142

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Aug 02, 2022 Aug 02, 2022

An AIArtHandle is just a pointer to some object deep in AI; sometimes when art is changed on the artboard they decide that rather than alter it, it's easier to rebuild it (undo management may play a role here). It's almost certainly not worth investigating the whys & whens, but rather use some other method to track art.

 

I believe an AISafeArtHandle is guaranteed for the life of the art/document, but no further. I feel like I've had a similar experience to yours where the AISafeArtHandle wasn't a

...

Votes

Translate

Translate
Adobe
Guide ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

An AIArtHandle is just a pointer to some object deep in AI; sometimes when art is changed on the artboard they decide that rather than alter it, it's easier to rebuild it (undo management may play a role here). It's almost certainly not worth investigating the whys & whens, but rather use some other method to track art.

 

I believe an AISafeArtHandle is guaranteed for the life of the art/document, but no further. I feel like I've had a similar experience to yours where the AISafeArtHandle wasn't as useful as I'd hoped, changing in some situations. I know of situations where you can feed an AIArtHandle to an API and it can crash Illustrator (if the art refered to was on an undo branch that is no longer accesible and thus has been pruned). I think AISafeArtHandle doesn't have that problem, so it's useful if you want to talk to the API and not crash, but it won't protect you from the behaviour you're seeing.

 

The true solution I think you're looking for is ai::uuid. We use it to track art & changes to art and I believe it is what you're really looking for -- see AIUUID.h. It works very similarly to AISafeArtHandle, so you should be able to switch one out for the other fairly easily.

 

This won't survive the document though; if you want to do that, you need to use AIUID.h (ain't the naming convention grand lol).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

LATEST

Hi there!

 

Thank you very much, UUID did the trick, as easy as you suggested!

 

Best regards,

Diogo

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines