Highlighted

Copy compound Path

Community Beginner ,
May 17, 2020

Copy link to clipboard

Copied

I need to copy compound path from one AI file to another file using my MAC Plugin.

Kindly guide me how to perform this.

TOPICS
SDK

Views

1.0K

Likes

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

Copy compound Path

Community Beginner ,
May 17, 2020

Copy link to clipboard

Copied

I need to copy compound path from one AI file to another file using my MAC Plugin.

Kindly guide me how to perform this.

TOPICS
SDK

Views

1.0K

Likes

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
May 17, 2020 0
Adobe Community Professional ,
May 17, 2020

Copy link to clipboard

Copied

Hi,

Could you please give more information what you are trying to achieve.

May be sharing some screenshot. More information about MAC Plugin.

 

Thanks

 

Best regards

Likes

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
Reply
Loading...
May 17, 2020 0
MilosR LATEST
Participant ,
May 18, 2020

Copy link to clipboard

Copied

If you want to build plugin using C++ SDK, follow "Creating a plug-in in Mac OS" in "Getting started" guide (https://www.adobe.com/devnet/illustrator/sdk.html). Download appropriate version of SDK depending on Illustrator version and your OS and you will find examples there, you can copy and edit some of examples.

 

First you need to acquire suites you need. To copy arts from one document to another you will need AIDocumentListSuite and AIArtSuite.

 

Here is code example for copy part (example uses AILayerSuite too - didn't try example it could be that there is are some bugs, return error codes should be checked too):

 

 

 

AIDocumentHandle documentSrc;
AIDocumentHandle documentDest;

// One way to get document handles, lets say that you want to copy from first opened document to second
sAIDocumentList->GetNthDocument(documentSrc, 0); // get first doc
sAIDocumentList->GetNthDocument(documentDest, 1); // get second doc

// Acivate source document
sAIDocumentList->Activate(documentSrc);

AILayerHandle layerSrc;
AIArtHandle artSrcGroup;
AIArtHandle art;

// Get first layer and first art in layer from source doc
sAILayer->GetFirstLayer(layerSrc);
sAIArt->GetFirstArtOfLayer(layerSrc, &artSrcGroup);
sAIArt->GetArtFirstChild(artSrcGroup, &art);

// Acivate destination document
sAIDocumentList->Activate(documentDest);

AILayerHandle layerDest;
AIArtHandle artDestGroup;

// Get first layer and first art in layer from source doc
// First art is layer-group
sAILayer->GetFirstLayer(layerDest);
sAIArt->GetFirstArtOfLayer(layerSrc, &artDestGroup);

// Duplicate
sAIArt->DuplicateArt(art, kPlaceInsideOnBottom, artDestGroup, NULL);

 

 

 

 

 

 

Likes

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
Reply
Loading...
May 18, 2020 1
Most Valuable Participant ,
May 17, 2020

Copy link to clipboard

Copied

selvakkanit,

 

How about just copying and pasting (Cmd+C, then Cmd+F or B or V, whichever is suitable)?

 

Likes

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
Reply
Loading...
May 17, 2020 0
Community Beginner ,
May 17, 2020

Copy link to clipboard

Copied

Thanks for the reply.

Yes. It is ok of copying and pasting (Cmd+C, then Cmd+F or B or V). But i need to done by code.

If possible, kindly explain how to perform the copying and pasting by code.

Otherwise if API support exists for copying Compound Path then it is also ok for me.

Kindly help me.

Likes

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
Reply
Loading...
May 17, 2020 0
Adobe Community Professional ,
May 17, 2020

Copy link to clipboard

Copied

Hi,

Are you using Javascript to code? If yes,

Then for copy use following

app.executeMenuCommand('copy')

and for paste you can use

app.executeMenuCommand('paste')

Before executing these command, make sure your compund path is selected.

 

Let us know if this helps you. There are many other ways to copy the objects using code, I know only using Javascript.

 

 

Best regards

Likes

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
Reply
Loading...
May 17, 2020 0
Community Beginner ,
May 17, 2020

Copy link to clipboard

Copied

Thanks for the reply.

Sorry! I created Plugin using XCode. So i need Xcode code for this case.

Likes

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
Reply
Loading...
May 17, 2020 0
Resources