Make a group of clipping with a compound path

So, as of today, I am new to scripting for Illustrator, I use the ExtendScript Toolkit. However, I am not new to my own script solutions and I do not have any experience with JavaScript.

What I'm trying to do is the following: for all selected items-> duplicate selected item and make a group of simple clipping with it

What I'm left with visually does not change the picture, but gives me a lot of clipped colored areas that I then can I change in isolated mode, which allows me good shading faster and better. That the doing by hand takes hours on some pictures, it would take a second with a script.

The script itself is already works for normal PathItems. As evident in the title, as soon as I have to apply the same thing to CompundPathItems things stop working. My question is a bit like this old thread [problem with clipping path transparent], but I couldn't find a solution because I get different behavior.

When I run the same script that works perfectly with the normal PathItems with CompoundPathItems I get this: 9046 error: the top element in the group must be a path element to create a mask

Well, it's a problem. There is absolutely no difference between making a clipping with a simple path mask and a compound path in the GUI. Frankly reference guide not helped with this problem at all, the only thing that I learned from it is that the CompoundPathItem object is an attribute of cutting, but those included PathItems.

Here's what I have so far:


If ([i] selected. TypeName == 'PathItem') {}
newGroup var = doc.groupItems.add ();
copy is selected [i] .duplicate (newGroup, ElementPlacement.PLACEATEND);.
Selected [i] .moveToBeginning (newgroup);
newGroup.clipped = true;

}

As I said, this part is exactly what it is supposed to do for normal paths.

For CompoundPaths, I use this work around.

If ([i] selected. TypeName == 'CompoundPathItem') {}
newGroup var = doc.groupItems.add ();
copy is selected [i] .duplicate (newGroup, ElementPlacement.PLACEATEND);.
Selected [i] .moveToBeginning (newgroup);
compoundItems = selected [i] .pathItems;
compoundIndex = compoundItems.length;
for (f = 0; f < compoundIndex; f ++) {compoundItems [f] .clipping = true ;}
var lineList = new array (10);
for (l = 0; l < lineList.length; l ++) {lineList [l] = new Array (I * 10 + 50, ((i-5) ^ 2) * 5 + 50) ;}}
newPath = app.activeDocument.pathItems.add ();
newPath.setEntirePath (lineList);
newPath.moveToBeginning (newGroup);
newGroup.clipped = true;
newPath.remove ();

Mind you, this workaround works in so far that it ignores that annoying error and evil and composite clipping path also works with the only problem being that created composite clipping path as it is always displayed in its original colours in the layers section and is always selectable. When I lock the composite clipping path I can work with it, but still...

So the question is, what am I missing here? Surely, there must be a good way to do this.

app.executeMenuCommand ()? That is me away so far, might be just the right thing. I will definitely take a look, now just to find a ref about it, because unfortunately official documents Ref I do not mention this command. Any place with a list of possible commands?

Ah, also of course I only do for the isolation mode. If you care to hear the background, it is here:

As I said it's for photos of shading, I'm working on. I repeated and tried through a bunch of techniques. For example, gradient mesh on my first few true works. Now these cracks don't do well with complex shapes, which previously I mitigated by using a simple square or rectangle gradient mesh and using the original form as a color clipping mask. It worked, but it was a huge field of work.

After a lot of attempts that I went to the use of simple gradients as a background for the form, and then I do the shading freehand with the blob Brush tool, using a graphic style and filters to make it look like to the right. Is better, but do it right all the clipping masks takes me much more time than anything else.

Now the problem is that shading is not supposed to cross the lines, it's impossible to do correctly without messing up the order, either using clipping masks, where the script. Because you know, if you use a form of the task with a strong Gaussian blur near the lines, you'll find yourself with stuff on both sides. If you do not start close to the line that the shading will be not look right if the darker the shade needs to be close to the line. And that's where magic of clipping masks.

And finally, here's an example of how I work with the script and the result:

After that I drew a sketch, adjust the line widths and at the neatness I turn the paths to sketch the lines and then turn them into a live paint Group (which would ruin the line widths, unless you put the paths in first contour lines).

With this live paint group need me a few minutes to color my piece dish. Then I develop the live paint group, in case of doubt, spend a few more minutes to make transparent traces of all regions, I need the shadow in one piece, and then I select all areas and use my script to activate the neat clipping masks. Then I can click on any field, enter the isolation mode, and go up one level, so I'm in the appropriate group, where I can shadow freely without the problem beyond the lines.

At the end which allows me to apply shading complex and comprehensive, without wasting time to get there.

PS: well, I just found out that draw inside is really close to what I want to do, and oddly enough, it produces the same Visual discrepancy with transparent traces that produces my script. I'll take a closer look that, while my script is a little more than just the stuff of clipping mask, so maybe I'll go for a hybrid solution. Everything that makes for a better workflow.

Tags: Illustrator

Similar Questions

  • How to add a clipping with Photoshop scripts path

    Hi guys,.

    I make a script that will save me a lot of time in the future with photo editing.

    When I take a picture of a product, it always has a background. When I removed background, I want a script to load the layer (while the product inside the PSD bottomless) and save the selection as a clipping path. Does anyone know how to do?

    Thanks in advance!

    Something like that...

    #target photoshop;
    if(documents.length) main();
    function main(){
    var doc = activeDocument;
    selectLayerData();
    doc.selection.makeWorkPath(0.1);
    doc.pathItems[0].name="Clipping Mask";
    doc.pathItems[0].makeClippingPath(0.5);
    doc.pathItems[0].deselect()
    doc.selection.deselect();
    }
    function selectLayerData() {
    var desc2 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty( charIDToTypeID('Chnl'), charIDToTypeID('fsel') );
    desc2.putReference( charIDToTypeID('null'), ref1 );
    var ref2 = new ActionReference();
    ref2.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Trsp') );
    desc2.putReference( charIDToTypeID('T   '), ref2 );
    executeAction( charIDToTypeID('setd'), desc2, DialogModes.NO );
    };
    
  • Fusion of traits with a compound path

    Hey all,.

    I'm new (ish) to Illustrator, and I do not know how to merge the tracks. I call on a form, then a single line path suddenly and want to merge the two without converting the route of the path form (see the screenshot attached). Is this possible?

    Any help is appreciatedScreen Shot 2015-02-02 at 10.29.44.png

    N °

    Mylenium

  • A compound path to access/clipping mask, or something else?

    Hello

    Basically, I'm changing this.

    in a mouth with teeth.

    I am trying to get rid of the surplus lines and leave the black lines in the white space.

    I've tried highlighting all and make a mask of clipping and even with the compound path, and it does not produce the results that I need. Does anyone have an idea what to do?

    Thank you

    Sally

    Hi Sally,

    Using a mask, he would do what you want.

    Select all the black lines and group them (Ctrl + G).

    Then duplicate the white object Ctrl + C (copy) and paste Ctrl + F (stick it in place), make sure that the duplicate is in the front.

    Then by selecting the black lines, you can see and the white shape/object that you have brought to the front (now shift), press Ctrl + 7 (mask) and you will get the result you want.

    Let us know how you get on?

    Edit: Quick help Video:

  • Make compound path in Adobe Illustrator by script

    There are a few compoundPathItems in myfile.ai

    How can I run "object > Compound Path > Make" or send «ctrl + 8 "jsx?» In line with comment that MISTAKE HERE I get the error message "a new object could not be created at the specified location.

    #target illustrator
    
    if (app.documents.length > 0) {
      var idoc = app.activeDocument; 
      var cp = idoc.compoundPathItems.add();
      var allPaths = activeDocument.pathItems;
      //Select objects
      for(var i = 0;i < allPaths.length;i++){
      allPaths[i].selected = true;
      }
    
      var selection = app.activeDocument.selection;
      for (var i=0; i<selection.length; i++) {
      selection[i].move (cp, ElementPlacement.PLACEATEND); // move selected path inside the compound path ERROR HERE 
      selection[i].evenodd = true; // necessary to determine "insideness" or to make holes.  
      }
    
      alert(selection);
    

    "Object > Compound Path > make" as

    app.executeMenuCommand("compoundPath");
    
  • In Movie Maker 6.0 can a video clip (with mute) be spliced in another video clip so it seems to work with the original sound of the first video?

    Hi, I put a video together for my MOM to 70th and one of her friends has provided a video clip of her playing a classical piece on the piano for several minutes.  I would like to cover this clip with other video sequences (landscapes, etc.) whereas the way piano since the main video track in the background.
    I tried to let fall the piano video file directly in the audio editing panel and then cut a second 20 segment in the video editing and insert a 20 second video (mute) images of landscape. However, the piano audio from the first video stops as soon as the strike chronology inserted piece landscape and picks up again when it ends, even if the audio scenario shows the audio piano continuously?  Am I missing a step or is this not possible?   Thank you very much.

    It should work quite as much as you described in Windows Movie Maker 6.0 (WMM 6.0), then maybe there is a step that is missed.  Let me describe how I could do and see if there's something you overlooked.

    First of all, I assume that you have already imported the clip of piano and your other clips of landscape in your collection then you can drag the there where necessary.  First, drag the piano music to the track Audio / Music in the timeline panel.  Note that if you have your video extended timeline, it will show video, Transition & Audio, but you want to get off- below that, to the Audio / Music , to follow.  At this point if you play your 'film', you should not to see any picture but just to hear the sound of the piano.  You should also only see a waveform on the audio / music.

    Now you can put anything you want on the video track.  Let's start by putting another copy of the original video of piano, but this time on the video track.  If you have developed the video track (to see the Vidéo/Audio/Transition) you will see the video piano and its associated audio waveform.  However, in your case, since you already have the audio separated, you want to cut that his partner.  Right-click on the Audio (attached to the video) track and select Muteor use the menus (Clip > Audio > Mute).

    When you preview the project, you have synchronized video browsing with the original copy of the audio piano.  At the point in the video where you want to replace the video with another piano play, making a split (key M).  Make another split at the end of the section.  It is very import that select you the video track when you add new divisions and you have not also be divide the track Audio / Music .

    Important: You want to make sure this divide the part that has the exact duration as well as landscape images, you want to replace.  So if you have 20 seconds to add, you divide 20 seconds piano images.

    Right-click on the part of piano footage (video track) and choose Remove.  Then, insert the part of sequences of landscape (also on the video track) in its place.  Once again, you will have need put this added sequence muted landscape (Clip > Audio > Mute).

    You should now see and hear the piano play.  Without any change in the audio playback in the preview window should implement the landscape images, then returns to piano images.

    If you find that your project is not behaving correctly after these splits, but are you sure that you have followed these steps, it could be a problem with your video file types.  If in doubt, try to convert all your videos to .wmv format using something like Freemake Video Converter (freemake.com)

    In any case, I hope that you are able to achieve, because it is certainly possible.  Good luck and post back with further questions or information, you can have.

  • How to make a clipping with a custom brush mask?

    Hello

    I don't know if this is possible in illustrator, I'm still learning. I made a custom brush style smoke and I would cut it in an exact form. I was wondering if there is a simple way to do it, either by using a clipping mask or using a met

    The top layer is a shape made out of expanded trails, I also do a compound path. The second layer is made of paint brush strokes, I ungrouped them.

    Any suggestion would be appreciated to mush, I learned a lot on these forums.

    Thank you

    Bell

    The mask object must be on top.

    Then select all and object > clipping mask > make

  • can not make or produce the clip modified with dark tones / highlights and reverse

    I can not make or produce a clip that has been modified with the shadows / highlights (smoothing time, black, white clip) and reverse with speed / duration.  When you try to make I get an error.  No number it says only: order and error.  If I try to produce the video, it starts to run and then I heard a sound that resembles a goat and the program stops.

    Clamp reversed, nest, and then add the effect or v.v.

    See if this will help.

  • make a clipping with a complex and custom shape mask

    Hello

    I have a graphic of a print, and I'm trying to use it to the mask of a photograph below. When I do the usual steps, is not working and causing everything to go transparent... my picture, completely disappear. I wonder if it's something to do with the complexity of the vector footprint - it has floating elements that are far away (for example, the toes are not attached to the part of the foot). If he throws?

    How can I get this vector illustration imprint to function as a coherent mask?

    Thank you!

    r,

    Cancel everything you've got (filled) separate paths simple forming the footprint, and then select all of the parts and object > compound path > make and then apply.

  • How to cut the text of a group of Clip?

    Hello

    I am very new to Illustrator, I appreciate any help you could give me.  I use Illustrator CC.  I created a form composed and then used as a mask to cut out an image for the form so that the vector image is the context in which the form I created.  Now I have the text on parts of the form, and I would like to cut the text of the compound shape.  That is a hole through the object in the form of the text.  Also, I should probably note that the object I want to cut the text on is considered as a' Clip' in the layers panel.

    I tried a number of different options that I found on the forums, etc, but none seems not to work.  So far I have tried:

    1. conversion of the type of a sketch, then selecting the Clip group and type and then by a compound path.  The result: a startup error "cannot make a compound path.  A compound path is unable to combine with a regular path clipping mask. »

    2 Select the type and the Group of Clip and then using much less prominent in the Pathfinder Panel.  Result: An error message stating "the filter yielded no results.  Please select two paths that intersect. »

    3 select the type and the value at 0% transparency in the transparency Panel then selected the type and group of Clip and then tried the difference and Exclusion.  Result: Nothing, but transparent type.

    I enclose a photo of the object and the text I want to cut him and also the layers panel.

    I'd appreciate any help I can get.

    Thank you

    Michelle

    CMC_snapshot4IllustratorHelp.png

    Michelle,

    What happens if you go back to the objects in the first picture with the direct Type and:

    (1) select all instances of three Type and group them.

    (2) select the Group Type and group in the flyout palette (Panel) transparency and Clip click the opacity mask making with Clip and mask Invert unchecked (if this sounds wrong to change these options, it should work with those when you have black Type)?

  • Making objects in a compound path then the clip

    Hey everyone, I'm pretty new to Java and Illustrator, so any help would be appreciated.

    I'm trying to set up a script that will retrieve a group of objects and turn them into a compound path, and then apply a clipping for the trace mask and the next group to the layer.

    for this snippet, I typed the letter 'o', he described and separated with a unique path, then I drew a narrow rectangle through the O, no line, black fill. The rectangle selected, run the script

    var idoc = app.activeDocument;
    var cp = idoc.compoundPathItems[0]; // the topmost existing compound path
    var sel = idoc.selection[0]; // select the path you wish to add to the existing compound path
    
    sel.move (cp, ElementPlacement.PLACEATBEGINNING); // move selected path inside the compound path
    sel.evenodd = true; // necessary to determine "insideness" or to make holes.
    
  • create a compound path clipping mask

    Is it possible to put the stars colorful under "Softbrands '? "Softbrands' one traced clipping, colorful stars is the background image to be cut... It's just a prototype.

    I tried several times, clipping path was made, but the stars will appear in any case behind the frame. Enjoy all the support here!

    mask_test.jpg

    Here is the source file to test with:

    http://support.fs.com.CN/Myles/fitness/lesmills/upload/mask_test.AI

    Thank you in advance.

    Kpolo,

    I just tried.

    The letters were separated; When I chose each other, made the object > compound path > make and moved them on top stars (both on the work plan and in the stacking order), the object > clipping mask > Make worked well.

    Do you have both

    (a) make a path composed of letters, and

    (b) have in front of the Star Group (as shown in the layers panel)?

  • Create a clipping with a background color mask?

    I recently made the switch using CorelDRAW for my vector art to mainly using Adobe Illustrator. I know of course that there will be some features that are exclusive to Illustrator and CorelDRAW exclusivity, but I've done the research on trying to find the "equivalents" in Illustrator for some tasks I could do in CorelDRAW.

    I know that the tool in Illustrator clipping mask is very similar to cutting power in CorelDRAW. What I'm trying to determine is if it's possible in Illustrator to create a clipping with a background color mask. In CorelDRAW, I could create a shape with a color fill Uni, and then insert an image with a background transparent, as shown below.

    Capture 1.JPGCapture 2.JPG

    Now, in Illustrator, when I create a shape with a color, then he and a pattern that is transparent to create a clipping mask, the color disappears:

    Capture 3.JPGCapture 4.JPG

    Is there a simple way to create a clipping with a solid background color mask? The only work around, I've found so far is a form of solid color, the same size as what I want to be the size of cutting with my transparent motive, then staple in another form of the group. As I said though, just curious to know if there is a simpler way to do this, or if this is the method I'm stuck with.

    Thanks for any help!

    A clipping mask can have its own fill.

    There are two methods:

    -After creating the clipping mask, select the path of masking with direct selection and apply a fill

    -Use the option 'Draw inside' to create the mask. Next draw is at the bottom of the tools Panel. With draw inside the maks object will not lose its filling.

    Illustrator help | Using drawing modes

  • cut out a shape with compound path?

    Hello Cs6 here... I'm trying to cut out a simple shape to allow the area as transparent or Alpha. As a mask. Except when I use the mask for this, he must make and mask the area where is the shape and hide or delete areas not covered by the mask. I tried the compound path, but I don't get any results from it. My form remains just above my work and do not "cut out" to allow the background shine as an alpha channel. See photos for more clarity please. No matter what specific path or steps would be appreciated.

    Thanks in advance.

    NORTH CAROLINAshapeaway.PNGmask cut.PNG

    I want to reverse this trend where the circle is cut off and the rest remains visible...

    NORTH CAROLINA,

    In the second image of the OP, you have placed at the ellipse, and then you have made an object > clipping mask > make.

    Instead, you can simply select the ellipse and the work and transparency palette flyout > make opacity mask and she, with a reverse mask for a white ellipse.

    Or instead, you can:

    (1) create a rectangle that extends beyond the work behind the ellipse;

    (2) select the ellipse and the rectangle and object > compound path > make;

    (3) select the compound path and the work and the object > clipping mask > make.

  • crossing a mixture with a compound shape

    Hello

    I tried to spread the mixture at the intersection of row groups. I tried at the point of intersection of the lines and one of the birds after the release of

    the compound path.   Erything disappear.

    intersect.gif

    If you want to fill the transparent path with this mixture and then spread the mixture and make a shade and fill the path with a shade.

Maybe you are looking for

  • Wireless does not work - new installation Win7

    I had to reinstall Win7 64 bit. Wireless does not illuminate. Giw610.exe driver of Lenovo is not accepted. Device Manager does not indicate that there is a wireless card. However, I can boot Ubuntu and it recognizes the wireless card and it works per

  • ProBook 6440 b: RAM upgrade Question

    Help! I just bought a refurb Probook 6440 b. Only, it came with 2 GB of memory, so I bought an upgrade to 8 GB. However, I can't find any instruction DECENT on the replacement of the RAM. Is there something there?

  • Side-by-side configuration is incorrect when you try to open Live Mail and Messenger

    I get this error message when you try to open Live Mail and Messenger... What can I do to fix this? C:\Program Files\Windows Live\MEssenger\msnmsgr.exeThe application could not start because the side-by-side configuration is incorrect.  Check the log

  • Windows 7 x 64 shows less memory than installed

    Hello I have a Dell Dimension 5150 with Windows 7 x 64 and 4 GB (2x2gb) RAM. But Windows 7 is said under properties I have a 2.5 GB of RAM. (He does NOT like in other posts 4 GB (2.5 GB usable)).  Where is used the rest?  I used the (3.5 GB) together

  • contacts with the missing of my yahoo email account

    my list of contacts and even the contact icon missing in my yahoo email account