Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Detect artwork edges

Explorer ,
Jan 27, 2016 Jan 27, 2016

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.

TOPICS
Scripting
661
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Jan 27, 2016 Jan 27, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 27, 2016 Jan 27, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2016 Jan 27, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 27, 2016 Jan 27, 2016

OK. The red line is the artboard.

sample-1.gif

Sample-2.gif

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2016 Jan 27, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 28, 2016 Jan 28, 2016
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines