-1

I drew a polygon using the pen tool. Now I'd like to draw small circles (illustrating vertices) at the polygon control points.

  • There is a bug in newest ilustrator that makes this a bit anoying to do with out additional tools. Also all the current answers have misunderstood your wuestion. – joojaa Apr 2 '15 at 13:12
  • Do you perhaps know how to query a poly's control points position in a script? I'd probably would be able to handle the rest. – Zohar Levi Apr 2 '15 at 17:52
  • @ZoharLevi if your question got a satisfactory answer below, please accept the one you think worked best. You do this by clicking on the green check-mark next to that answer. It is good for you, me and most of all for the community and others looking for solutions to the same problem. – benteh Apr 2 '15 at 22:02
7

As per request, a script to do this on selected paths. This is an alternative for @CConroy answer that may make things easier to do in the long run. It draws symbols on points and tangents and connects the tangents with lines, You can use symbols palette to change how they look after the fact. Might be useful for somebody.

Put following in a .jsx file and run it with paths selected:

#target illustrator

main();

function main(){
  var sym = createSymbolsIfNeeded(activeDocument);
  handlePaths(activeDocument.selection, 
              sym.anchor, sym.tangent); 
  // pass undefined for sym tangent if you dont want 
  // tangent handles.
}

function handlePaths(sel, symAcnhor, symDir) {
  for(var i = 0; i < sel.length; i++){
      if(sel[i].typename == "PathItem"){
          symbolsOnPoints(sel[i], symAcnhor, symDir);
      }
      // you would possibly need to recurse
      // the groups and compound paths in some 
      // cases.
  }
}

function symbolsOnPoints(path, symAcnhor, symDir) {
  var pts = path.pathPoints;
  for(var i = 0; i < pts.length; i++){
      var pos = pts[i].anchor

      if(!(symDir === undefined)) {
        var pos2 = pts[i].rightDirection;
        if (dist(pos, pos2) > 0.1){
          drawLine(pos, pos2);
          centeredSymbol(pos2, symDir);
        }

        pos2 = pts[i].leftDirection;
        if (dist(pos, pos2) > 0.1){
          drawLine(pos, pos2);
          centeredSymbol(pos2, symDir);
        }
      }

      centeredSymbol(pos, symAcnhor);
  }
}

function centeredSymbol(pos, symbol) {
  var p = pos.slice(0);
  sym = activeDocument.symbolItems.add(symbol);
  p[0] -= sym.width/2.0;
  p[1] += sym.height/2.0;   
  sym.position = p;
  return sym;
}

function drawLine(p1, p2) {
    var line = activeDocument.pathItems.add();
    line.setEntirePath([p1,p2]);
    return line;
}

function dist(a, b){

  return Math.sqrt(Math.pow(b[0]-a[0], 2) + 
                   Math.pow(b[1]-a[1], 2));        
}

function createSymbolsIfNeeded(doc){
    var symAnchor;
    try {
        symAnchor = doc.symbols.getByName("Anchor");
    }
    catch(err) {
        var circle = doc.pathItems.ellipse(5,5,5,5);
        symAnchor = doc.symbols.add(circle);
        symAnchor.name = "Anchor";
        circle.remove();
    }

    var symTangent;
    try {
        symTangent = doc.symbols.getByName("Tangent");
    }
    catch(err) {
        var rect = doc.pathItems.rectangle(5,5,5,5);
        var symTangent = doc.symbols.add(rect);
        symTangent.name = "Tangent";
        rect.remove();
    }
    return {anchor : symAnchor, tangent: symTangent};
}

    tangents

Image 1: Example result. You can easily change the different marker symbols win the symbol palette.

PS: The script is not really super secure and stable because its one of my own scripts for quick documentation so be careful.

PPS: I have pushed this code to bitbucket

  • so, the control gadgets and angle flyouts are simulated in the screencap? genius. – Yorik Apr 2 '15 at 20:16
  • Nice! If I'd seen this post a bit sooner, I'd mention an oldie of mine doing exactly the same. "Maybe there's something to this Java [sic] business after all." ;) – usr2564301 Apr 3 '15 at 22:22
  • @Jongware well, i allready had this in my harddrive and didnt really see a reason to not share it. Its a quite obvious need. I was also toying on making this a effect at some point. – joojaa Apr 3 '15 at 22:47
5

Start by drawing a line and circle and style each how you would like the polygon sides and vertices to look.

Drag the line to the Brushes panel and choose Pattern Brush. In the Pattern Brush Options dialog, set the first tile (Outer Corner) to None and hit OK.

Then, Option-drag your circle onto the Brushes Panel into that first tile slot. You'll return to the Pattern Brush Options dialog, but now your circles will be in place of all the vertices (the corners basically). Repeat the option-drag for the 3 remaining brush tiles.

enter image description here

  • Not sure why this is getting down votes. It works. I don't think users are reading carefully enough. – Scott Apr 2 '15 at 18:09
  • @scott i agree with this statement – joojaa Apr 2 '15 at 19:10
  • actually the circles dont exactly lie on the control points. But i didn't down vote i voted up to reverse erroneous mod – joojaa Apr 2 '15 at 20:00
  • The brush could be altered to align the circles properly. I added the screenshot in a quick effort to deter the down voters. – Scott Apr 2 '15 at 20:08
  • Thanks for improving my answer Scott. I'm new to the site and still learning the ropes. – C Conroy Apr 2 '15 at 20:13
3

here's another way to draw circles or squares at each anchor point (no direction handles though)

  • select your path
  • Ctrl+C to copy
  • Ctrl+F to paste the copy in front
  • Select->Object->Direction Handles
  • Ctrl+X to delete the segments and keep the Anchors only

enter image description here

  • Effect->Convert to Shape->Ellipse...2 pts extra width/height

enter image description here

  • you can do circles or squares

enter image description here

0

Use the Subscribe Plugin, which is a free illustrator plugin made exactly for this purpose (Among others).

In the link I adde you'll find tutorials for everything the plugin does, but specifically for your needs you'll use this tool:

enter image description here

  • Could you please tell about other plugins you use? – Ilan Apr 2 '15 at 12:07
  • 1
    There are hundreds of plugins and scripts for adobe programs, you should be more specific – Naty Apr 2 '15 at 12:29
  • In the tutorials on the attached link they explain how to use this tool to make a circle fit perfectly within a shape – Naty Apr 2 '15 at 13:16
  • Yes but hes not asking abot circle fits but circles at curve controll points and possibly tangents. not circle trough points but circles at point? or perhaps im just crazy. – joojaa Apr 2 '15 at 15:17

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.