Script to calculate and fill empty spaces
- December 20, 2024
- 返信数 1.
- 558 ビュー
Hello, everyone. I am familiar with scripts, but I don't have a deep understanding of js.
I need help with the following:
- I have an artboard with some objects (all groups);
- I need to fill the empty spaces on the artboard with other objects, for example, they could be rectangles measuring 5cm by 3.7598cm (but the future idea is to fill them with other files that have objects with the same dimensions);
- This filling needs to take into account the best distribution of the objects, so that they do not overlap and that they follow a spacing of 3mm; - These rectangles can be rotated 90 and 180 degrees (as the script considers the best arrangement).
- This 3mm spacing needs to be between the objects;
- There is no need for spacing between the rectangles and the artboard limits.
- The challenge is to calculate the area and calculate the possible arrangements to fill with the rectangles;
- The best arrangement is not crucial for me, the important thing is just to fill to avoid so many empty spaces.
I will leave some images to illustrate.
