Script: Select objects, that are overlapping a specific object
Copy link to clipboard
Copied
Hi there, following problem:
i have several paths and designs and images, laying over a polyline-path "front part" or "back part" ...
If the objects and paths would lay inside the path "front part", it would be easy to select all of them with
But because, the designobjects are not laying as a child-item inside the path, I need to select them by comparing the positions.
item = pageItems.getByName("front part");
position = item.position
itemwidth = item.width;
itemheight = ...
So i have a cut-layer with sublayers. If i want to choose "part-1", every path in other layers shall be selected.
Next problem would be, that the source-path is not rectangular. If i'd define the corners of the item to check, if an object is laying inside the four corners of the source, it could be, that its not laying inside the path.
Any idea, how to do that propperly? Or is there another way to solve?
If its not solveable, i think, i have to move every designobject inside the source-layer.
---
Explore related tutorials & articles
Copy link to clipboard
Copied
can you show some screen shots?
Copy link to clipboard
Copied
I added a screenshot of a layer. There are sublayers with polylines, which defines our print paths.
Now if i want to have all design elements, images, texts inside the part (which are all on a different layer)
i choose "PART-1" and want, that all design elements, which are positioned inside this element, is being selected.
Copy link to clipboard
Copied
there might be a mathematical way of finding out if a path is inside of a non-rectangular shape. I don't have such a library, and I'm not sure it already exist. You'll have to try to look for a javascript library or build your own.
one work around that might be worth trying is to select your items as well as your non-rectangular shape and applying Unite Pathfinder. All paths fully inside your non-rectangular shape will disappear. Paths partially inside will be cut by the non-rectangular shape. All complete remaining shapes are outside of the non-rectangular area.

