6 Replies Latest reply on Jan 28, 2016 5:16 PM by levonkps

    Detect artwork edges

    levonkps Level 1

      Hi,

      I am trying to create a script that will draw registration marks. There are two marks that go into specific locations, top and bottom centre, and that is easy to do. Four other marks go at the corners of the artboard, but in some situations, where there is nothing in the corner, I need to have the marks inside the job.

       

      Is there any way I can detect if there are any objects within the artboard? The artboard is to the dimensions of the bounds of the artwork, so there is always some object at the edges, but it might not be in the corner and maybe far enough to have the mark placed inside.

       

      InDesign has the wrap around object shape with detect edges option. If I am able to get that info, I should be able to do the rest.

        • 1. Re: Detect artwork edges
          Silly-V Adobe Community Professional

          If your artwork is consistent enough to be able to rely on this, you could get away with just comparing the coordinates of pathPoints in all of the paths to see if there's an object within your landing zone.

          • 2. Re: Detect artwork edges
            levonkps Level 1

            No it is not consistent in any way. At the moment I have the rego marks on the left and right sides of the artboard 7 mm from the sides. I want to get them as close as possible, or even inside the artboard if  possible. If I have 20 mm x 20 mm space on the corner I can put it fully inside.

            • 3. Re: Detect artwork edges
              CarlosCanto Adobe Community Professional & MVP

              can you post samples of the different scenarios you commonly have showing the marks placement?

              • 4. Re: Detect artwork edges
                levonkps Level 1

                OK. The red line is the artboard.

                 

                sample-1.gif

                Sample-2.gif

                • 5. Re: Detect artwork edges
                  CarlosCanto Adobe Community Professional & MVP

                  good, since we don't have any collision detection we need to resort to workarounds, try this

                   

                  - deselect all

                  - make a new temporary artboard, same size as your registration mark

                  - place it at bottom left

                  - use the method selectObjectsOnActiveArtboard()

                  - check your selection.length(), if zero, then there's nothing in that corner

                  - place your symbol inside

                  - remove your temp artboard

                   

                  this is not 100% reliable since the method selects items based on their bounding box, not the actual art object.

                   

                  for example, in your second image, the symbol at bottom right, seems to fit inside, but the method above will select the item, the temp artboard will not touch the Geedup word but it will touch its bounding box, why did you put it outside?

                  • 6. Re: Detect artwork edges
                    levonkps Level 1

                    This is for screen printing. After setting up all screens the marks are covered with tape. If it is too close to the actual artwork, the tape might cover the artwork, or the thickness of the tape raises the screen to give unwanted effects. So, I leave enough space around the mark.

                     

                    With the method you describe, I need to make the temp artboard bigger than the mark to include the space around it as well. then it would also select the drawing on the bottom left around GDUP because its bounding box will be within those limits.