3 Replies Latest reply on Jun 20, 2012 1:58 AM by Muppet Mark

    detecting objects inside shape

    hilukasz Level 1

      so I came up with this script, and it worked fine until I tried it on a different file. I have moved the artboard around all over the "main" canvas (if that is what it is called) and on the one that it works on, seems to only work when artboard(top, left) is positive values. however on the new file it doesn't seem to matter where it is on the artboard, it wont work anywhere. it should find the textpath relative to the shapes position.

       

      I thought it was the coordinateSystem, but that doesn't seem to fix it. any ideas would be greatly appreciated. been banging my head against desk for about a week on this one. I have an feeling it might be because I am not understanding how the canvas works (maybe the math.abs(); are bad idea?)

       

      threw it up on gist because it was pretty big: https://gist.github.com/2951981

        • 1. Re: detecting objects inside shape
          Larry G. Schneider Adobe Community Professional & MVP

          Since CS4, the coordinate system's 0,0 point is at the upper left of the artboard. X is positive to the right and Y is positive down. It used to be that the origin was a Cartesian one with 0,0 at the lower left and positive Y was up but since Photoshop and a lot of other software (mostly for images work) work from the upper left, Adobe decided to change AI to match. There are now global and artboard rulers as well to further confuse the issue. Hope this helps.

          • 2. Re: detecting objects inside shape
            hilukasz Level 1

            ok so maybe I am getting confused. so there is app.coordinateSystem as well as something else I have to set? It doesn't seem 0,0 is upper left because when I set canvas to 0,0 it brings it to center...? and when I print return values it gives me negative for Y if it is below the 0,0 point.

            • 3. Re: detecting objects inside shape
              Muppet Mark Level 5

              Larry… while that may be what it looks like in the GUI. In script AI is still not like any other app my CS5 is 0,0 top/left it moves left to right in positive values but down the artboard in negatives…

               

              Screen shot 2012-06-20 at 09.55.58.png

               

              Screen shot 2012-06-20 at 09.55.41.png