6

You know the "connect the dots" books for children where you connect the dots from 1 to 100 and a picture becomes visible?

I would love to do the same in Adobe Illustrator.

Is there a way (with any kind of scripting maybe) to add numbers to anchor points?

Is there a way (with any kind of scripting maybe) to color the points based on their anchor index (for example points 1-99 are black, 100-199 are blue etc.)?

10

To get started, easy dotted line creation and ordering can be accomplished using this script as explained by joojaa here.

The importance of arrangement is because the Document.selection array respects the order that the objects are stacked. You can take advantage of that to create a new text object for each object currently selected.

Here's a very simple snippet of JavaScript to point you in the right direction:

var document = app.activeDocument;           //Use the current open Ai File
var selected = document.selection;           //Use the current selection in Ai

for (var i = 0; i < selected.length; i++) {  //Iterate over every selected object
    var text = document.textFrames.add();    //Add a new text object
    text.contents = i + 1;                   //Set the corresponding number text
    text.top = selected[i].top - 10;         //Position the text object underneath
    text.left = selected[i].left;
}

In action:

Illustrator script demonstration

I'm using shapes instead of anchor points for demonstration purposes but it does not matter if you use just anchor points instead. It would not be difficult to color the points based on their index. You should consult the Illustrator Scripting Reference for all the information required on how to custom tailor a script to suit your needs.

  • 1
    Nice +1, there is a script in this post that can be scalped for the rest of code needed. – joojaa Aug 12 '15 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.