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

OVERLAPPING OBJECTS

Explorer ,
Nov 07, 2024 Nov 07, 2024

Copy link to clipboard

Copied

Hi, team. I'm working with illustrator and I have a scene with many objects placed randomly. Some of these objects are overlapping. Is there a script or feature that can automatically adjust their positions to avoid overlaps and ensure a more even distribution?

TOPICS
Scripting

Views

543

Translate

Translate

Report

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
Community Expert ,
Nov 07, 2024 Nov 07, 2024

Copy link to clipboard

Copied

I haven't seen a script for that, can you post screnshots showing more details of what you need? or better yet can you share sample files?

Votes

Translate

Translate

Report

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 ,
Nov 07, 2024 Nov 07, 2024

Copy link to clipboard

Copied

Hanschrs_0-1731027748666.png

When I use brushes in Illustrator to create a stippling effect, I end up with too many overlapping points and have to manually move them to achieve a more uniform shape. That image has been hand-edited to create a more balanced effect.

Hanschrs_1-1731027953018.png

 

Votes

Translate

Translate

Report

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 ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

You could check out the plugin Stipplism. But it's not free

Votes

Translate

Translate

Report

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 ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

I just tried it. What do you think?

Hanschrs_0-1731328506295.png

stipplism

 

 

Votes

Translate

Translate

Report

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 ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

This would be better visible if you leave out that additional gradient.

Did you check out that Quality option in Stipplism?

Bildschirmfoto 2024-11-11 um 13.47.26.png

Votes

Translate

Translate

Report

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 ,
Nov 11, 2024 Nov 11, 2024

Copy link to clipboard

Copied

thanks

Votes

Translate

Translate

Report

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 ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

Hi @Hanschrs, this discussion inspired me to write a script that might help (but don't worry if it doesn't suit your case—I was happy to write it anyway as I've wanted to do something like this for a long time!)

 

The script is called "Distribute Items.js" and you can download it from my github repo for general scripts (it's a new repo, I just made today but I will be adding new scripts to it all the time).

 

If you try it out, try it on not-too-many page items to start with while you are experimenting with the parameters. If you like you can adjust the default parameters by editing the "settings" object in the script (it is near the start).

 

Let me know if it is useful.

- Mark

 

distribute-items-1.gif

Votes

Translate

Translate

Report

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 ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

I haven't tried it yet but this script looks great Mark!

Votes

Translate

Translate

Report

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 ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

Thanks Carlos, I think it's pretty fun too. Wait until I fix up some issues that Kurt mentioned.

Votes

Translate

Translate

Report

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 ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

Thanks for this contribution, Mark.

 

I did some tests and can say that the script works pretty well as far as I do understand its parameters.

 

You already indicated that it's rather a good idea to not execute it with too many selected objects. As per my testing I'd say that one should definitely not select more than about 300 objects at the same time. Otherwise Illustrator gets severely frozen, at least on the machine I use at the moment.

 

Perhaps you should implement a warning message in case the users select too many crumbs.

Votes

Translate

Translate

Report

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 ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

Thanks Kurt, you are my best stress-tester! There is some bad code that runs slow that I will speed up and I will update the github when I've done that. Probably will be later today.

 

For fun, here is an animation showing step-by-step (ie. number of steps set to 1) after slightly increasing the radius. You can see what the algorithm is doing:

distribute-items-demo-2.gif

 

The algorithm is for spreading out the items, but you can make a tighter distribution by using a scale < 100%:

distribute-items-demo-3.gif

Votes

Translate

Translate

Report

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 ,
Nov 14, 2024 Nov 14, 2024

Copy link to clipboard

Copied

Hi @Kurt Gold just letting you know that I have updated the code on github. I have included text warnings, and alert warnings (for more extreme cases) and also added a progress bar, so you can at least know that things are working!

 

I would love to know how to improve performance further, but so far I don't have many ideas. I think now you can work on more than 300 items okay. Of course, if there are too many operations, you might want to stretch your legs and get a cup of coffee!

 

Thanks again, for taking the time to check out my script.

- Mark

Votes

Translate

Translate

Report

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 ,
Nov 15, 2024 Nov 15, 2024

Copy link to clipboard

Copied

Thank you for the updated script, Mark.

 

I will try it.

Votes

Translate

Translate

Report

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 ,
Nov 18, 2024 Nov 18, 2024

Copy link to clipboard

Copied

Thank you so much, I'll give the script a try and let you know what I think. I'm sure it'll be great. Thanks a million

Votes

Translate

Translate

Report

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 ,
Nov 18, 2024 Nov 18, 2024

Copy link to clipboard

Copied

Hanschrs_0-1731946244540.png

The program will only run if fewer than 200 objects are selected."

Votes

Translate

Translate

Report

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 ,
Nov 18, 2024 Nov 18, 2024

Copy link to clipboard

Copied

Hi @Hanschrs are you using the latest script? The first one had a bug that stopped it working with that many items. Also could you please post a demo file that I could test with? The forum doesn't accept .ai files so please save as .pdf with Illustrator compatibility.

- Mark

Votes

Translate

Translate

Report

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 ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

I can't find the link to the latest version. Could you give me the link address?

Votes

Translate

Translate

Report

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 ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Here it is: Distribute Items script. - Mark

Votes

Translate

Translate

Report

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 ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Mark, I tried the latest version of your script with various amounts of selected objects. So far, I'd still say that it is rather not recommended to use more than 200 or maybe 300 objects at the same time.

 

Using 400 or even more objects definitely freezes Illustrator for some time, but at least does not crash it and eventually works as intended.

 

By the way, I like slowness.

Votes

Translate

Translate

Report

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 ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Thanks Kurt. Yes unfortunately the algorithm is very processor intensive and ExtendScript is very slow. I'm not sure how I could improve the speed at the moment. Did you see the progress bar appear? That should give a steady time estimate so you know when you can go and do some gardening while it works away at the problem.

 

Now that I have fixed the initial bug you found, I'd be surprised if Illustrator actually froze or crashed, because it is really doing the same operations—measuring between mathematical points (not DOM path item points)—over and over again without storing them in memory. So if it can do one loop, it should be able to all of them without running out of memory. And it only touches the DOM at the very last minute (once the progress bar is full).

 

The settings are critical to speed, too. In some cases we can play with the parameters with a smaller number of items first, before applying to a larger number.

 

It is unfortunate that—due to the nature of the process—it doesn't work well to do a large number of items in smaller batches because the distribution will show flaws at the intersections of those batches.

 

Monika suggested a plug-in, which has a much better chance due to being written in C+ which is blazingly fast, and especially so compared to ExtendScript.

 

Thanks again for looking at this.

- Mark

Votes

Translate

Translate

Report

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 ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Yes, Mark, the progress bar is displayed, but only after a pretty long time of frozen state (1 up to 2 or 3 minutes when using about 400 objects at the same time). Then the script dialog appears and it may take another minute to see any progress.

 

Then, changing any parameter in the script dialog causes further delays. Impatient people may not entirely be satisfied at that point.

 

Nonetheless, this script is very good. It just takes some time.

 

As an alternative one can always use Illustrator's symbol tools and explore other oddities with them.

Votes

Translate

Translate

Report

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 ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Oh wow! That is very different from—and much worse than—my experience on my machine here. Okay I've had a look and I think I had a glitch with my version control and lost part of a previous change. I have updated again and the time to come up to the UI will be much improved—no more than a second or two no matter how many items.

 

@Hanschrs very sorry but as you noticed—the code was still wrong. I have fixed it now properly. Note that this will only speed up the time between script launch and seeing the UI.

 

You can download from the same repo here.

- Mark

Votes

Translate

Translate

Report

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 ,
Nov 20, 2024 Nov 20, 2024

Copy link to clipboard

Copied

Compared to the earlier versions, the script now runs like Speedy Gonzales!

 

Just tested it with 400+ objects.

 

Thanks, Mark.

Votes

Translate

Translate

Report

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 ,
Nov 20, 2024 Nov 20, 2024

Copy link to clipboard

Copied

LATEST

Excellent! Thanks for your patience!

Votes

Translate

Translate

Report

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