Jun 12, 2011

connect_centers_nearest_modified 2

Here's a little tutorial about the script that I uploaded yesterday.
The source objects are the brush objects in Fig.1.  The red one is the foreground (last drawn).  And the distance between the farthest removed objects is about 88pt.
Select all the brush objects, then run the script.
A prompt dialog appears.  Input 80 and hit OK.
Fig.2 is the result.  Paths are separated because the distance between the nearest object is longer than the specified value (80pt).

Jun 11, 2011


I thought about how to create the objects to connect these centers by the script that I wrote previous time. And remembered a software Voronoi Stippler that I used a few years ago. (For some reason, it seems that it is unavailable for download now.)

I made the objects from an image with this tool, then applied the connect_centers_nearest.js script to them ... and got an error due to the upper limit of the number of points that setEntirePath function allows.

So I rewrote a part of the script as follows. Then I ran it again.
for(i=0; i<points.length; i++){
anchor = points[i];
rightDirection = anchor;
leftDirection = anchor;
It seemed to be interesting. But it looked also like an ugly entangled string. So I implemented the idea of the maximum distance of the line to the script. If the distance between the points is longer than the limit, the script finishes the path and begins a new path from the next point.
This seems to be good? I posted this script at the end of this article.

In the archive, the script with .js extention is for windows. And .jsx is for Mac. When you run this script, you are asked the maximum distance in point. (Actually, it is the maximum squared distance. This is not appropriate. But I leave it as it is for now.)
Talking about the code, I put 0 instead of the coordinate [x, y], at the point that separates the paths.

download: aics_script_connect_centers_nearest_modified2.zip

2011.06.12 -- fixes length_limit to be squared 

May 28, 2011

connect centers in various order

These scripts create a path that traces the center of the selected objects. The path starts from the center of the foreground object. And the order of the connection vary from script to script. If the number of points is greater than two, the path is closed.
I thought the "farthest" is unexpectedly interesting.

Tested with Adobe Illustrator CS5 15.0.1 / Windows 7 Pro 64bit
This is a beta software. Please use it carefully, at your own risk.

I bought macbook pro recently. Though I don't have Illustrator works on it yet. I must be familiar with Xcode first.