Javascript to delete clipping mask

Hi all,
I have an Applescript that places a PDF into a document. When the file is placed, it's cropbox becomes a clipping mask, which I then need to delete.
So I have the following:
set themasterlayername to "Legend"
tell application "Adobe Illustrator"
tell current document
set clipList to every path item whose clipping is true
repeat with clipItem in clipList
set sel to name of (layer of clipItem)
if sel is themasterlayername then
delete clipItem
end if
end repeat
end tell
end tell
This seems to be the only way I can find path items that are clipping, by testing in a repeat loop whether they belong to the layer I have placed the PDF into.
However, when there are a lot of objects (say from a CAD file) on other layers, the script runs very slowly, as it has to test every object to see if 'clipping' is true
Would this be quicker in Javascript? Delete all clipping path items on a certain layer. Or is there another way to narrow down getting only items belonging to the specific layer? For some reason if I put in 'of layer themasterlayername', I get no objects.
Thanks for any help
Ian

This is NOT tested but could not…
tell application "Adobe Illustrator"
tell current document
delete (every path item of layer "Legend" whose clipping is true)
end tell
end tell
The 'whose filtering' and target layer should deal with the lot?

Similar Messages

  • Clipping masks in ai CS5 deletes strokes and other crazy things

    When creating a clipping mask, Illustrator CS5 deletes the stroke on the mask itself and when I add the stroke back in, it adds the same stroke to objects within the clipping mask.
    In the file below, Figure 1 shows a rectangle with a black stroke and an orange circle with no stroke. Figure 2 shows the result of creating a clipping mask - the black stroke on the rectangle has been deleted. Figure 3 shows the result of adding the black stroke to the mask - it adds the stroke to the orange circle as well.
    This is one of the many things about Illustrator that lead me to believe that the people at Adobe have never tried to work with their own programs. Why on earth would I want the stroke to be eliminated in the first place and why would I want it to be added to the items inside the mask when I go to replace it?
    Is there something I should do differently or is this yet another oversight I'll have to work around forever?

    Thank you to Larry and Scott! That's exactly right. I wasn't aware that by making a clipping mask you also make a group (and I'm not entirely sure that it logically should) but using the direct selection tool does the trick.
    Thanks again,
    Dave

  • I have a line (stroke, no fill) and an eps graphic. I'm trying to make a clipping mask of the single line art but all it does is cut the eps graphic instead of making a mask?

    I have an eps graphic and a single line drawing 2 pt wt. I'm trying to make a clipping mask of the line drawing. When I tried it all that happened was the eps graphic was cut in half. I did the exact steps from AdobeTV except the line drawing [pink camera.ai*@1200% (CMYK/Outline)] is an ai pen line drawing instead of a vector graphic and the other is [vector flower lillies.eps @ 100% (RGB/Preview)]. If you need more info on the graphics please tell me where to find it and I will send it.
    This is all because the eps graphic has a white background. I have tried everything I know including opening it in Photoshop and deleting the background and it always pastes with a white background. My thought was if I can't change the background then maybe I can make a clipping mask of the pink camera and just paste it in front.
    Please help this has been a thorn in my side for too long...

    please post a screen shot of the graphic(s) as it's hard to understand exactly what you are asking
    IF these are 'vector' graphics there should be no need for a clipping mask--also--if the .eps files are small (MB or KB) try posting one of those

  • Is there a fix for the slow processing yet? Clipping mask slows down Illustrator CS4 to the point it can't be used

    I've seen a few older posts regarding CS4's bug with applying a clipping mask to any image that is somewhat complex, but have yet to find an answer.
    The problem is, any time a clipping mask is applied to a semi-complex shape, Illustrator CS4 slows almost to a halt. We're talking 10 minutes of the beach ball to apply the mask and then another few minutes to do anything else with the document. This is unacceptable. My system is loaded (Dual 1.8 GHz G5, 1.25 GB of memory). The exact same files process fine in CS3. Many of our other designers are running iMacs and cannot work on the files at all using CS4. There has to be an answer to this problem.
    Prefs have been deleted, Document Raster Effects has been lowered. Any other suggestions?
    Your help is greatly appreciated.

    My system is loaded (Dual 1.8 GHz G5, 1.25 GB of memory).
    Uhm.. that's "loaded"? That's like the slowest G5 made with almost the minimum amount of RAM.
    But.. I agree with you. Clipping masks seems to drastically slow CS4 down. Even if an object isn't really complex, but included many objects. I'm running a much faster system than you are and I have to wait around 3 to 10 seconds after any operation for some files. It's annoying. So far, I've not found any solution other than to expand and clip the masks.

  • Illustrator - Pattern Swatch / Clipping mask issue

    I'm currently working in Illustrator CS6. I'm creating pattern swatches and have successfully created 20 - but 4 are giving me the following issue.
    When I drag the perfect swatch tile into swatches it appears as so instead of the perfect tile:
    "New pattern swatch 3" has a white space on the right. Which sometimes when I create the swatch takes up half of the 'swatch.'
    When I go to create a shape and apply the pattern, I am left with an empty box.
    When I double click to adjust the pattern I get this dialog box:
    When I go to adjust the bounding box, to see where my pattern is - this crazy mess happens:
    Further investigation and deleting items to see whats happening:
    Bits of my pattern appear, but not sure why the other bars are there.
    I'm having this issue with four very different patterns. But I have also succesfully created more complicated ones. Not sure why this is happening.
    Any help is greatly appreciated!

    Hey everyone,
    I am in the same version, same file. I have also tried starting from scratch in another file just to make sure. Same issue.
    I have templates of what i want my patterns to be, so I have tried to make the patterns both ways. Starting from my original art - expanding all shapes and making them so they will tile perfectly.
    1. with clipping mask. 2. released mask, and expanded shape. 3. perfect tile.
    from scratch, made to tile perfectly.
    Same issue for both:
    To make sure it wasn't only this one I tried a different pattern that was giving me the same error before hand.
    I tried with original art which didn't work, so I quickly recreated with squares. Same tile, one time it was empty producing same issue as above. And second time it did this:
    1. What tile is supposed to look like       2. Tile applied to shape - but the pattern swatch icon is empty?
    Maybe this is a program bug?

  • Help with Illustrator Clipping Mask!

    Hi,
    I am trying to make a clipping mask over a alot of vectors (to be specific, have made an envelope design so am trying to use the template/evenlope outline as the clipping path) however when ever I try to create the clipping mask - command 7 - all the vectors inside are deleted mostly or half dissapear.
    I have tried;
    Making sure the clipping path is the top layer in the layers panel
    Ungrouping the vectors and selecting individually to mask all together
    Putting all into a new document and clipping
    Seperating the clipping path and what I want to clip into differnt layers
    None of the above has worked as yet, I have done this plenty of times before but am not sure what I am over looking. I am using CS5 on a mac.
    Thanks for anyones help!
    here is what I am trying to do; I need all of the vecotrs to be masked by the envelope outline.

    I you are using a template in AI CS 4 or 5 then it is possible thgat the template is an artboard which you cannot use as a clipping mask.
    You would have to draw a rectaangle to the size of the enevelope template and use that rectangle path as a clipping mask.
    Ok! Besides from that possibility if yiou are printing an envelope withy objects that have to be clipped to the edge of the front of the enevelope that is not a very good idea.
    Even if you are printing and then converting the envelope it is a bad idea as you8 would definitely need a bleed and that would wrap around to the back of the envelope and in a nott so pretty way.
    OK so say you are using an inkjet that can print on an envelope and it can even successfu8lly print it with a bleed feature the way thoise  bleed features have to work is that they enlarge the art slightly and so whyat every you design and create will be enlarge and trying to figure that out is not going to be very easy.

  • How to get transparent lines in a black box (clipping mask)?

    Hello,
    This is the first time I am using Illustrator so I'm hoping this is a simple question.  I created a black box and a series of white line segments through it.  Now I need those white lines to "cut" the black box.  In the end, I need just the black parts of the box with basically transparent lines in it (so the lines take on whatever the background happens to be - i.e. another image or color).  I tried to group the line segments together and create a clipping mask but did not have any luck.  Does someone have any tips on how this can be accomplished?
    Thanks, Marc

    Expand the strokes using Object > Path > Outline Stroke. Select the lot and click on the Divide button in the Pathfinder panel (second row, left button). Delete everything not black.

  • A Way To Invert A Clipping Mask?

    Hey all.  Can this be done - inverting a clipping mask?
    Basically, when you clip an image, the outside junk gets hidden.  I would like the reverse effect where the inside stuff is hidden.  Any way to do this?
    And another question: is there a way to cleanly erase around an object in Illustrator? In Photoshop one can place a marquee around an image, then invert the marque to delete the stuff around it.  Is there a way of doing this in Illustrator without using the divide pathfinder command?
    I'd like to erase around a bunch of overlapping object without having to divide them, because they'll all end up as separate slices, which is not what I want.
    Thanks,
    B.

    B,
    To hide what is inside and show what is outside a path, you may consider Transparency palette flyout>Make Opacity Mask (Clip unticked, Invert ticked/unticked for white/black path).
    To (more or less) get rid of the stuff round a Clipping Path/Mask, you may try the destructive deed, with the Clipping Mask selected:
    1) In the Transparency palette/panel dropdown list select anything but Normal (Multiply is fine),
    2) Object>Flatten Transparency, just keep the defaults including 100% Vector,
    3) Shudder.
    This should reduce the size to the Bounding Box of the Clipping Path.

  • Use a compound path as clipping mask?

    Hello,
    I’m trying to use a complex compound path as a clipping mask, but it won’t work. I have narrowed down the problem a little in two smaller scripts described below.
    Using a single path as clipping mask works very well:
    var doc = app.documents.add();
    var clipGroup = doc.groupItems.add();
    var bgItem = clipGroup.pathItems.rectangle(200, 200, 200, 200);
    bgItem.position = Array(200, 500);
    bgItem.fillColor = doc.swatches[8].color;
    var fgItem = clipGroup.pathItems.polygon(144, 288, 72.0, 7);
    fgItem.position = Array(220, 480);
    fgItem.fillColor = doc.swatches[7].color;
    fgItem.zOrder(ZOrderMethod.BRINGTOFRONT);
    clipGroup.clipped = true;
    alert(clipGroup.clipped); // will alert true
    But when trying the simplest form of a compound path, it’s not working:
    var doc = app.documents.add();
    var clipGroup = doc.groupItems.add();
    var bgItem = clipGroup.pathItems.rectangle(200, 200, 200, 200);
    bgItem.position = Array(200, 500);
    bgItem.fillColor = doc.swatches[8].color;
    var compoundItem = clipGroup.compoundPathItems.add();
    var fgItem = compoundItem.pathItems.polygon(144, 288, 72.0, 7);
    fgItem.position = Array(220, 480);
    fgItem.fillColor = doc.swatches[7].color;
    compoundItem.zOrder(ZOrderMethod.BRINGTOFRONT);
    clipGroup.clipped = true;
    alert(clipGroup.clipped); // will alert false
    Using compound paths as clipping masks is really simple in the Illustrator GUI. So what am I missing here?
    Help would be greatly appreciated.

    The simplest way, I think, would be to set the white line work as an opacity mask on top of the tan circle. That is not a clipping mask, but does the same thing and it's much easier.
    Otherwise, outline white strokes and "Unite" using pathfinder tool, then delete outside path (the circle), from the compound shape. That will leave the appropriate compound object to make the clipping mask:

  • Calling all compound path and clipping mask experts...

    I am attempting to get all the white areas in the attached "globe" artwork to knockout to the background color. I have tried making the entire thing a compound path, tried clipping mask and different combinations in pathfinder with no success. The image on the right is what happens when I make it a compound path. Any suggestions would be greatly appreciated, thanks!

    The simplest way, I think, would be to set the white line work as an opacity mask on top of the tan circle. That is not a clipping mask, but does the same thing and it's much easier.
    Otherwise, outline white strokes and "Unite" using pathfinder tool, then delete outside path (the circle), from the compound shape. That will leave the appropriate compound object to make the clipping mask:

  • Help with creating compound/Clipping Mask

    Hello,
    This is going to be quite hard to explain so bear with me!
    I recently live traced a hand drawn pattern into illustrator pressing 'Ignore white', Underneath this I have a jpg with a texture I want to use. My aim is to cut out the shape of two letters into this pattern/texture.
    My problem is that creating a compound mask on my pattern will not work because live trace has created a group with hundred of paths and compound paths from my live trace, is there anyway create a mask so that the pattern just shows up as the two letters and deletes everything around it?
    I want to use this method because although I can cut the letters out of a white square covering everything in the background, the design is for a logo and I would like to export as a PNG with a transparent background.
    I know there are often a few was to get a desired effect with illustrator but I just can't get my head around this one!
    Thanks for any help,
    Laltoofan4

    Place the outline of the letters on top of the pattern. Select the pattern and the letters and choose Object > Clipping Mask > Make.

  • URGH! Make clipping mask/path out of a placed image?!

    I'm having major issues. I'm a n00b at Illustrator, though.
    I need to make a placed photo into a clipping path, and I can't figure out how to do it correctly.
    It's homework for a college course in Digital Illustration. I need to recreate a photo using only shapes in Illustrator, and to do so, we're supposed to make the photo into a clipping path so that when we draw the shapes on it, the shapes won't leave the bounding box of the photo and onto the white space of the document.
    I know to make the clipping mask, you just go to object > clipping mask > make... but every time I do it, and I draw on the image, the shapes still leave the image, so I must not be doing it correctly.
    ANY help would be great. I'm about ready to rip my hair out.
    Thank you!

    Hola Carlos,
    Thank you so much for you help!!
    your first suggestion worked wonderfully!!
    however, i have one more question ... for Carlos or anyone else
    i am suppose to delete the original circle but not matter what i do ... select it and hit the delete key, select the layer it's on and hit the trash can icon or even cutting it ... the Edit menu says the actions have taken place but when i hover over the area afterward the path is or seems to still be present.
    i have tried and tried to look for an answer in the manual, FAQ's and have even Googled for an answer but i cannot find any info at all about how to delete a path ~ most of all under this particular circumstance. arg!
    i've looked at the rest of the tut and i think if i can get past this point i'll be great.
    i am wondering if it even matters rather i delete this original path.
    any help and/or suggestions would be greatly appreciated.
    thanks again for your time
    ps. i was just thinking ... can this original path/circle even really be deleted? isn't it necessary to keep the shape of the object and/or a part of the mask that gives the object its appearance?

  • Seamless repeating pattern - using embedded images with clipping masks

    Hi forum,
    We struggle a bit creating a seemless repeating pattern that includes embedded images with clipping masks applied.
    Our pattern is a 550x550mm black square with various embedded inserted on top. All of these images have Clipping Masks applied to hide unwanted areas.
    These images are placed so they create a seamless repeating pattern and this includes areas that overlap the square.
    Once we create a swatch from this pattern the repeatable area becomes too big as it includes the unwanted areas hidden by the clipping masks.
    Because the repeatable area is now too big it's actually not repeatable.
    We tried various things in order to solve this issue. Pathfinder/crop to delete the unwanted areas in the images etc.
    None of them worked good enough.
    We though of just livetracing the images, but due to the complexity this is not an option.
    Do we really have to do our "cutting" in Photoshop or do you know any fancy tricks for issues like this?
    Appreaciate your insight
    Kenneth

    Kenneth,
    You may try the destructive deed, with the Clipping Mask selected:
    1) In the Transparency palette/panel dropdown list select anything but Normal (Multiply is fine),
    2) Object>Flatten Transparency, just keep the defaults including 100% Vector,
    3) Shudder.
    This should reduce the size to the Bounding Box of the Clipping Path.

  • Working with old PDF files - Release Clipping Masks

    Hi Everyone....Please Help Me!
    I am regularly required to work with old pdf files for my company, which I have to open in Illustrator to amend and update (we don't have access to the original .ai files).
    Whenever I start to work on these files I have to spend ages just unconnecting the elements of the artwork, usually by right clicking and choosing "release clipping mask"
    Is there a way to just disconnect everything when you open up an old pdf document in Illustrator?
    Tá mo chroi bhríste
    (it has my heart broken - in Irish!)

    Always keeping a careful eye on the effects of released clipping masks, the process can be accelerated using the keyboard shortcuts rather than hunt-and-click.
    Open the PDF.
    Ctrl/Cmd+A (Select All)
    Ctrl/Cmd+Alt/Opt+7 (Object > Clipping Mask > Release) Hold down Ctrl/Cmd+Alt/Opt and tap the 7 key repeatedly to initially release all top-level masks, then continue through the levels of nesting that may be present. With Show Bounding Box and Show Edges active it's easy to see when the releasing has stopped...usually only a few levels.
    Deselect, then find one of the orphaned mask objects, which will have a fill and stroke of None. Select it, then choose Object > Select > Same > Fill & Stroke to select all the orphaned mask objects.
    Delete.

  • How do I make a clipping mask static?

    I have a group of objects that move around within a 700x500 px artboard. The size of one object within this group is a map that spills over outside the artboard. I want this group to only be 400 px high, but not change anything withing the group. Just shorten the height of the clip. When I tried to just clip the height to 400 the clipping obviously followed the zooming of the animation of the group. I want the hight to be static at 400 when the animation plays.
    Any ideas? Do I need a second clipping mask like I would have added if I worked in Illustrator? So I could move a whole group within a static clipping mask. If so, how do I create one?

    "1) remove the clip set to the group"
    How? When I mark the group and then click on clipping tool (only why I know to mark the clipping mask) I can´t delete it without deleting the entire group.
    "2) use style="overflow:hidden" instead of use style="overflow:visible"
    But that´s on the stage? It´s already set at hidden there. I don´t want to change the height of the stage.

Maybe you are looking for

  • View actual data from an EXPORT statement in the debugger

    Attention ABAP pros, ninjas, and rock stars: I am trying to learn more about some standard SAP code that is having a runtime error. IF NOT gv_cluster_key IS INITIAL. * Get the combinations   IMPORT it_combi TO <plobs_in_view>       FROM DATABASE indx

  • Forwarding requests to multiple weblogic servers

    Hi, I have two applications running on two different Weblogic servers and wish to use one Apache web server as a front end interface. I can forward the requests from apache to one weblogic server using apache-weblogic bridge. Is it possible to forwar

  • Does anyone know how to add time using TIME function?

    Hi, I just switched from Excel (lol) and found an error in a key calculation i use. Does anyone know how to automatically add hours to a time? i.e. i have to convert Pacific Time to other U.S. Time Zones so in the past I used this formula in Excel (=

  • How do you select the play length bar in an iphone/ipod?

    Sometimes I have a single song file of a book which is quite long, 10 hours, so I need to be able to restart where I left off. It is easy to mess up and end up back at the beginning. I have noticed that sometimes Imusic shows a play back length bar w

  • Pixmantec Migration Tool is unusable

    First of all, I am very happy with the LR. In comparison to the RSP, the slow performance is compensated with a much better control of colors. (even if all cameras need to be calibrated for correct (red) colors?!?) Because I really archive all my pic