: Illustrator: How to draw circles at control points? I drew a polygon using the pen tool. Now I'd like to draw small circles (illustrating vertices) at the polygon control points.
I drew a polygon using the pen tool. Now I'd like to draw small circles (illustrating vertices) at the polygon control points.
More posts by @Si6392903
4 Comments
Sorted by latest first Latest Oldest Best
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
Effect->Convert to Shape->Ellipse...2 pts extra width/height
you can do circles or squares
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};
}
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
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.
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:
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.