3 Replies Latest reply on May 12, 2010 10:24 PM by Yuliaart

    Compound path  in InDesign CS4 JavaScript

    Yuliaart Level 1

      Hi, I need to create compound path from 2 overlapping rectangles, the top one subtracts from the bottom one and I could find anything in OMV, not sure where to look for it, didn't find anything the the forum so far. Could someone help me:

       

       

      var myBleedRectangleOutside = myDoc.rectangles.add();

      myBleedRectangleOutside.geometricBounds = [0, 0, myPageHeight, myPageWidth];
      myBleedRectangleOutside.strokeColor = myDoc.colors.item("Green");

       

      var myBleedRectangleInside = myDoc.rectangles.add();

      myBleedRectangleInside.geometricBounds = ["0.0625 in", "0.0625 in", myPageHeight -  0.0625, myPageWidth -  0.0625];
      myBleedRectangleInside.strokeColor = myDoc.colors.item("White");

       

       

      I need to subtract white rectangle from green.

       

      Thank you very much for your help.

      Yulia

        • 1. Re: Compound path  in InDesign CS4 JavaScript
          Yuliaart Level 1

          Corrections to my script:

           

           

          var myBleedRectangleOutside  = myDoc.rectangles.add();

          myBleedRectangleOutside.geometricBounds  = [0, 0, myPageHeight, myPageWidth];
          myBleedRectangleOutside.fillColor  = myDoc.colors.item("Green");

           

          var myBleedRectangleInside  = myDoc.rectangles.add();

          myBleedRectangleInside.geometricBounds  = ["0.0625 in", "0.0625 in", myPageHeight -  0.0625, myPageWidth -   0.0625];
          myBleedRectangleInside.fillColor  = myDoc.colors.item("White");

           

           

          Actually I am even not sure if I need a fill color for my inside rectangle, because I want that part to be transparent when compound.

           

          Thank you.

          Yulia.

          • 2. Re: Compound path  in InDesign CS4 JavaScript
            [Jongware] Most Valuable Participant

            "subtractPath", as in

             

            myBleedRectangleInside.subtractPath (myBleedRectangleOutside);

             

            It's the reverse of what I would thought it'd be, but it seems to work; switching 'inside' and 'outside' gives an "empty path" error.

             

            The bottom and right hand edges are mere lines, you need to make the bleed smaller by twice the necessary amount -- once for the left side, once for the right side.

            • 3. Re: Compound path  in InDesign CS4 JavaScript
              Yuliaart Level 1

              That's perfect, thank you very much.

               

              Yulia