Skip to main content
Murali.M
Known Participant
April 17, 2021
Answered

How to get all placed items on illustrator sdk ( sAIPlaced )

  • April 17, 2021
  • 2 replies
  • 703 views

Iam new in illustrator plugin development. 

 

I am trying to get all places image via illustrator sdk.

 

I trying with "sAIPlaced" suite. But I didn't get any result.
Is there any possible .

This topic has been closed for replies.
Correct answer Rick E Johnson

Hi, welcome to the forum! Since you say you're new to this, you may be looking for a method to find all placed art. This is a snipped from how I do it:

 

AIMatchingArtSpec spec[1];
AIErr error;
*matches = nil;
spec[0].type = kPlacedArt;
spec[0].whichAttr = 0;
spec[0].attr = 0;
error = sAIMatch->GetMatchingArt( spec, 1, matches, numMatches );

 

Once selected, you may want to iterate through the list to check if they're locked, visible, etc.

If you've already done that, then maybe you're planning to access the actual item that was placed. I've done this with scripts, but not in the SDK -- sorry I don't have C++ code to offer for that. With AppleScript it's easy to get the file path, then find the item via the OS file system, and even hand it off to another app to edit.

 

Best of luck with your project!

2 replies

Rick E Johnson
Rick E JohnsonCorrect answer
Inspiring
April 17, 2021

Hi, welcome to the forum! Since you say you're new to this, you may be looking for a method to find all placed art. This is a snipped from how I do it:

 

AIMatchingArtSpec spec[1];
AIErr error;
*matches = nil;
spec[0].type = kPlacedArt;
spec[0].whichAttr = 0;
spec[0].attr = 0;
error = sAIMatch->GetMatchingArt( spec, 1, matches, numMatches );

 

Once selected, you may want to iterate through the list to check if they're locked, visible, etc.

If you've already done that, then maybe you're planning to access the actual item that was placed. I've done this with scripts, but not in the SDK -- sorry I don't have C++ code to offer for that. With AppleScript it's easy to get the file path, then find the item via the OS file system, and even hand it off to another app to edit.

 

Best of luck with your project!

Murali.M
Murali.MAuthor
Known Participant
April 18, 2021

First of all thank you both of you.

Eespecially @Rick E Johnson  Great, It's working fine. 

I success fully geting the placed images with below code.

sAIPlaced->GetPlacedFilePathFromArt(art,filePath);


I need one more help. How to I get the status of Transparent. Refer below snap.

Murali.M
Inspiring
April 17, 2021

Hi Murali.M!

 

I think you need to be a bit more specific about what you want to do.

 

What do you mean with "get all places image"? Do you want a list of handles to all the placed art in a document OR perhaps the coordinates of a selected image? And what do you mean with "image", paths or placed artwok?

 

If you want to find all placed art within a document I would try using MatchingArtSet from AIArtSetSuite, and check for kPlacedArt.