Copy link to clipboard
Copied
Ever wondered how to perfectly fill an outline with touching circles? I did -- after seeing the example image in Solving design effect - image made of perfectly arranged circles.
It took me a while to get the proper calculations, but -- Here It Is! A Javascript, written for Illustrator CS4 (it might work on other versions as well), that fills a selected outline with circles. Download zipped script from my site: #1 http://www.jongware.com/binaries/CircleFill.zip #2 (https://shared-assets.adobe.com/link/7cf1dee2-08bc-435f-6fbc-546d36937712) unpack if necessary, and put it in your Illustrator Scripts folder to make it available the next time you run Illy, or anywhere else (you have to browse for it each time).
Select any path -- but no live text, please; you have to convert it to outlines and select each character in turn. Then run the script.
It displays a simple dialog, where you can set a maximum and minimum circle size as a percentage of the selected object size. In addition, you can select either a plain basic color, or select any of your current Swatch Groups; in that case, each of the circles are filled with a random color from that group.
The script may take a while to run. Usually, only a couple of seconds for a simple rectangle, but it may run into minutes for objects with lots of curves and/or holes. I didn't have the guts to run it on a vectorized world map, to recreate Mario "Quasimondo" Klingemann's Foam World Map; but, in theory? Possible.
This image only took a few minutes:
Enjoy, everyone!
{Script Download Link option Updated by MOD}
Lisapru, with a little help from pixxxel schubser in the Illustrator Scripting​ forum, I've updated the script and uploaded it again onto my site. Check if it behaves correctly now.
Hi @TeeStore5E0C and @Long98A1,
Thank you for reaching out. I have added a second option to download the script created by OP @Jongware.
I hope it helps.
Thanks & regards,
Anshul Saini
Copy link to clipboard
Copied
The text is just grouped (even if it's a single letter) that's all. Ungroup it and everything works fine.
Copy link to clipboard
Copied
Hi all, just saw this in my search for something very similar but without the varying sizes, in other words, filling a shape with circles of all the same, definable size. I looked at the javascript, but that is beyond my skills to manipulate. Would you have any advice or suggestions?
Thanks so much!!
Copy link to clipboard
Copied
That makes it a bit more complicated, unfortunately.
At present, the script selects a random point somewhere inside the shape. It then selects a random circle size from the list "radiiList" and checks if the point can hold a circle at that radius. If not, it simply adjusts the circle size to make it fit.
Your requirement is different, and close to "optimal packing" (which is a known problem in mathematics). I don't think it's feasible to adjust this script to make it optimally fill a path with same-sized circles, it would require a different approach.
Copy link to clipboard
Copied
Hi,
The script is very usefull, is it possible if we wnat to fill an object with randomletters like " D F R Y I O N U W S P D R H" and so on....
Thanks
Copy link to clipboard
Copied
> ..fill an object with randomletters ..
Um, yeah but it would not Look Good. (Except when you only use O's.)
The script works the way it works because using circles, I can use maths to calculate if the random position of a new circle is not overlapping any other circle or the edge of the base object.
Most letters (the "O" is the one exception) are not circular, and so if you use the same algorithm, you would need to scale all letters to fit *inside* each circle; and, if you do so, you will see that the spacing is very irregular and no two letters will touch each other.
The algorithm you are looking for is "free form packing", which is *way* more hard than just circles.
Copy link to clipboard
Copied
Theunis,
This is the thread that led to the latest well deserved praise:
Copy link to clipboard
Copied
Thank you Jongware....Brilliant!
I have used Illustrator for many years and this is the first time I have ever installed a script into Illustrator as I tend to rely on the standard scripts and styles etc already built in. I will be certainly be using this script for future projects.
TREX
Copy link to clipboard
Copied
TREX, thanks for having my script as "your first"!
And I hope this encourages you to try some of the other free Illy scripts floating around. There are the artistic ones such as mine, but also lots of tiny/little/big/HUGE time savers that are well worth checking out.
Copy link to clipboard
Copied
Obey/Jongware, it's thanks to you.
This forum does not surprise me that there are a lot of genious's here giving fantatstic advice and knowledge!
TREX
Copy link to clipboard
Copied
that's awesome. thank you very much.
i'm gonna have to come up with a reason to use it at work.
Copy link to clipboard
Copied
Just wanted to drop a quick note:
THANK YOU FOR THIS AWESOME SCRIPT.
That is all.
Sincerely,
Ben
Copy link to clipboard
Copied
that was really awesome, sorry for the late reply, thanks for sharing.
Copy link to clipboard
Copied
I just tried running this Illustrator CS2. I get an error message that says the following: Error 22: Window does not have a constructor. Line 32. It says some more stuff but I don't know how to insert an image. It won't accept the screen shot. I saved it as a jpeg but it won't accept my image.
Copy link to clipboard
Copied
Illustrator CS2 is currently 11 years old. The script was "written for Illustrator CS4 (it might work on other versions as well)" but when saying that I assumed people would try to use with on newer versions, not on antique ones. At the time my CS4 was considered already pretty old.
Copy link to clipboard
Copied
Hi Jongware,
i could fill the letters correctly with the script but it didn't work with the background.
I put a rectangle in the background and made a subtract of the letters - image left shows the area i want to fill with the script and then i got the error message.
The right picture shows the filled letters - just missing the background.
So, i should check all the layers for a single point or do you have another idea?
Thanks! Lisa
Copy link to clipboard
Copied
I am very short on time these days but I did a quick test with your cut out text. And .. nothing happened! No error message (so you still might have a stray point somewhere – please note there is a Select Stray Points menu item!) but also no circles.
It could be such a shape is too complicated for my script, although I did not expect it to do nothing in such a case.
This needs in-depth looking at and debugging I'm afraid – and, alas, I am pressed for time so I cannot do so immediately (or in the following few days) ...
Copy link to clipboard
Copied
Lisapru, with a little help from pixxxel schubser in the Illustrator Scripting​ forum, I've updated the script and uploaded it again onto my site. Check if it behaves correctly now.
Copy link to clipboard
Copied
Thank you so much guys! After several tests it worked!
Problem was the inner space of the letters... i had to convert the font into paths, then delete the inner spaces from P or O, then put it on the background, exclude and then run the script - crazy
But there was still a little problem with filling the whole background except the font - i think it is to difficult for the script
Copy link to clipboard
Copied
This is awesome, I have long admired the ishihara images they use for colourblind tests, and now i can save myself a ton of time creating more images using that style.
Thanks so much..
Copy link to clipboard
Copied
Jongware; nice script. works in CS6. Only short coming to me is it locks-up Illustrator when I try and enter a negative integer like ie: min% 0.1. As long as they're whole numbers no problem. Unusual you just giving it away when I'm sure you could have made some money on it. In what seems like a time when you can't even find free clipart hardly it's refreshing to see the old school spirit of the web still alive. Nice job.
Copy link to clipboard
Copied
Hi
iam using it on Illstrator CS6 and getting an error message:
the attributes injected in the script were:
max 2%min 0.5 %
min dist. 0pt
it already worked once with values < 1 ... so that should not be the problem, dont know which layer should be meant o.O
EDIT: so i just put the layer in top of all others now it seems to work .. so not that important if you keep it in mind when using it (y) - thank for that awesome script
Copy link to clipboard
Copied
Hey I just ran this script in CC and I got this error:
Copy link to clipboard
Copied
I also am getting this error when using latest version of CC.
I've tried it on multiple shapes, multiple variable changes, and multiple layers and I just get this error whenever i try it at all. Is there something I'm doing wrong?
I've tried it on layers with only one shape, and layers with multiple shapes, tiny circles, large circles, black circles, multi colored circles, small / no distance / large distances and always get this error.
Any help?
Copy link to clipboard
Copied
CyannaEd schrieb:
I also am getting this error when using latest version of CC.
I've tried it on multiple shapes, multiple variable changes, and multiple layers and I just get this error whenever i try it at all. Is there something I'm doing wrong?
I've tried it on layers with only one shape, and layers with multiple shapes, tiny circles, large circles, black circles, multi colored circles, small / no distance / large distances and always get this error.
Any help?
Are you using the latest version of the script (see at the bottom of page 1 of this thread)
Copy link to clipboard
Copied
Is the shape you are trying to fill a "Live" object (one created directly with a tool in the AI file)? Try expanding the object first and then run the script. Also check post #42 in this thread.