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

Get only the paths of a embeded placedItem (without clippingpaths)

Community Expert ,
Sep 22, 2012 Sep 22, 2012

Hello,

at first sorry for my bad english.

I use my script to embeding a placed graphic (MyImage.embed();). Then I always get a group with the correct paths and two clipping paths in a grouped grouped groupItem.

My question is:

I want to delete the two clipping paths to get only the correct paths of the graphic. Does anyone know the best way?

Thanx for your help.

<edit>

This is, what I always have:

Result_Embeded1.png

and this is, what i want:

Result_EmbededWish.png

TOPICS
Scripting
2.5K
Translate
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
Adobe
Guru ,
Sep 24, 2012 Sep 24, 2012

Your example looks straight forwatd enough for you to loop the group and remove() items property whose clipping is true… Im almost certain you will get the same issue with groupItems.createFromFile() as place() then embed() as you test your pathItems move to parent layer… What you want can become very complex depenent on what your placing? Is it *.ai or *.pdf?

Translate
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 Expert ,
Sep 24, 2012 Sep 24, 2012

Hello Muppet Mark, Thanks for your reply.

Mostly I put *. Ai or eps rare. There are only simple graphics.

I already suspected that a loop through the Items of the graphics is likely to be "the method of choice", but unfortunately elsewhere in the script several loops through larger groups are required. The script becomes quite slow.

So I'm looking for alternatives. I will try your suggestion groupItems.createFromFile () and then sign up again. (This command was previously unknown to me)

Translate
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 Expert ,
Sep 24, 2012 Sep 24, 2012

Okay,

createsFromFile() gives the same grouped grouped groupItem with also two clipping paths. Nevertheless, this seems to be the more direct route. Thank you.

Probably I need in any case to loop through items to delete the clipping Paths? Is that so?

Translate
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
Guru ,
Sep 25, 2012 Sep 25, 2012

I thougth groupItems.createFromFile() resulted in the same thing… The other alternative is to open the *.ai or *.eps files and duplicate the required art from on doc to another… Clunky again but may be better the more complex the art gets… You look to be doing things the right way and I don't know of any other methods to avoid this…

Translate
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 Expert ,
Oct 04, 2012 Oct 04, 2012

A little update.


@ Muppet mark, your two answers were helpful, but now I am afraid to try another way.
The main script needs to run on several computers, so it is not good to distribute many more files. I have written to me for each file a function that draws the paths. This is probably the best way for me.

I thank you again for your answers.
regards

Translate
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
Guru ,
Oct 05, 2012 Oct 05, 2012

You can store an Array of pathPoints in your script if you need to… then use setEntirePath() method.

I have not looked at this just yet but sounds like what you are wanting to do…

http://www.behance.net/gallery/Trace-vector-to-script-Illustrator-scripts-CS3-and-up/806397

Translate
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 Expert ,
Oct 05, 2012 Oct 05, 2012

Hello Muppet Mark,

I have completed my script before half a week. That's why your link was unfortunately a few days too late for me.

Nevertheless seems linked
script to the behance.net page to allow a much more comfortable reading and passing the path point locations in a *. jsx file. Maybe I sign on the page and test the script.

Greetings pixxxelschubser

Translate
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 Expert ,
Oct 05, 2012 Oct 05, 2012
LATEST

in your picture, what's "MyImage", a group or a layer? either way, I think your only option is to loop thru your pageItems in the second "group" and take them all out and put them somewhere (in "MyImage" maybe), except if they are the actual clipping paths you're trying to delete...then delete the group with the remaining clipping paths.

in this example, I'm just showing how to delete the clipping paths, this will leave you with the wanted paths still inside the group, you'll still need to "ungroup".

my sample was only one group deep, unlike your sample wich is two groups deep.

before

removeClippingPath1.gif

after

removeClippingPath2.gif

var idoc = app.activeDocument;

var clip = [];

var igroup = idoc.groupItems[0];

for (i=0; i<igroup.pathItems.length; i++) {

    var ipath = igroup.pathItems;

    if (ipath.clipping) {

       clip.push(ipath);

    }

}

for (j=0; j<clip.length; j++) {

    clip.remove();

}

Translate
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