Skip to main content
Crooty
Inspiring
July 5, 2022
Question

Help needed: how to add circles (eg) to each corner of a path?

  • July 5, 2022
  • 10 replies
  • 5599 views

Hi!

 

I would like to add circles (eg) to each corner of a path.

I can make it easily if I break my path into separate segments and use arrowheads, but I would prefer to keep it one single path.

I have tried using a pattern brush, but the shapes are deformed, some of the corners don't show if the angle isn't sharp enough.
(I have also tried with a dotted line, rounded path ends and 0mm dash and long gap eg but it doesn't work if my segments are different lengths).

 

Any idea? Thanks in advance!

This topic has been closed for replies.

10 replies

CarlosCanto
Community Expert
Community Expert
July 12, 2022

given the limitations, I would do it like Met1 suggested. I would trigger a script repeatedly as needed. Femke's script would probably need an upgrade to remove previously added circles though.

 

[Edit] or I would just delete the circles manually before running the script to create a new set

Kurt Gold
Community Expert
Community Expert
July 6, 2022

A handful of ointment for the aggrieved obtuse and acute angles.

 

Circle Pattern Brush 2 (styles)

 

Note: The workarounds may work in many cases, but they may also (partially) fail. You may just want to play a bit with them.

 

Crooty
CrootyAuthor
Inspiring
July 12, 2022

Hi Kurt…

Nice but sadly, still no cigar, eh?

 

Thanks a lot for searching, all the same!

Kurt Gold
Community Expert
Community Expert
July 12, 2022

Well, if you compare the "wrong" and "right" graphic styles in my second sample file, I'd say it deserves at least a cigarillo! |-)

 

Kurt Gold
Community Expert
Community Expert
July 5, 2022

Femke,

 

basically you understood the task pretty well and there are already a couple of scripts out there that do similar things. As does the the approach Ton provided.

 

But if you carefully reread Crooty's request, it is pretty obvious that he is not looking for a rather one-shot static solution. As far as I understand, some kind of compact dynamic objects are desired, such that you can for example just continue the zig zag paths or add and move some more anchor points while the circles will automatically be added. The scripting route cannot do that. The pattern brush can do it (with some limitations I mentioned above).

 

Crooty
CrootyAuthor
Inspiring
July 6, 2022

BTW, I'm a she. 😉

femkeblanco
Legend
July 5, 2022

It is possible that I misunderstood the question, but if the intent is to add a circle at each anchor point, then this is trivially simple with a script.  Select a path and run the script.  The diameter and stroke weight of the circles can be changed by changing the values in the first two lines. 

// select path
var diameter = 10;
var strokeWidth = 1;
var points = app.selection[0].pathPoints;
var items = app.activeDocument.pathItems;
for (var i = 0; i < points.length; i++) {
    var top = points[i].anchor[1] + diameter/2;
    var left = points[i].anchor[0] - diameter/2;
    var circle = items.ellipse(top, left, diameter, diameter);
    circle.strokeWidth = strokeWidth;
    circle.selected = true;
}
app.executeMenuCommand("group");

 

Crooty
CrootyAuthor
Inspiring
July 6, 2022

Hi Femke, thanks for your reply. As Kurt says, I'm looking for a dynamic solution, like a style or an effect that can be applied to my strokes.

Kurt Gold
Community Expert
Community Expert
July 5, 2022

Met,

 

as far as I can see, Crooty already stated in his initial post that he knows workarounds that split the paths into separate segments. At the same time he said that he would prefer something more compact.

 

Therefore I provided the pattern brush approach with circular tiles that do not get distorted (which usually happens if one creates tiles out of normally drawn circles). The downer at the moment is that it doesn't work well with some obtuse and acute angles. Nonetheless, it will work in many cases, though some manual work will be required.

 

Met1
Legend
July 5, 2022

Not a solution but a clunky work around: draw your line, apply the circle arrowheads, with the direct selection tool select every other line segment, cut, then paste in place.

There's an Align box under the arrowhead section of the stroke pallet, which will change where your line starts. (I used the first one and the circles perfectly overlapped - if you are concerned about them not overlapping just have the circle arrowhead turned on on one end (except for the first (or last) line segment where you'll need both) - the problem with this is you really have to pay attention to the stacking order so that the "tail" of the previous line segment is under the circle.)

Crooty
CrootyAuthor
Inspiring
July 6, 2022

Hi Met, thanks for your reply. That's exactly what I did in the second drawing. I'm looking for a more dynamic solution, though.

Kurt Gold
Community Expert
Community Expert
July 5, 2022

Here is a sample Illustrator file that uses a pattern brush.

 

Circle Pattern Brush 1

 

You will still have the issue with the obtuse angles (see green path), but at least the circles will not get distorted.

 

Crooty
CrootyAuthor
Inspiring
July 5, 2022

Thanks Kurt,
That's really close to what I'm trying to achieve!

Any idea on how to solve the obtuse angles?
Any setting or preference maybe?

Kurt Gold
Community Expert
Community Expert
July 5, 2022

Unfortunately, at the moment there is no instant setting or preference to prevent the obtuse (and acute) angles issue.

 

So, basically, you will have to add some circles manually from time to time. I'd have to think about more sophisticated workarounds.

 

Met1
Legend
July 5, 2022

This is probably easily done with a script - I say probably because I'm not a scripter - but you will have to keep invoking the script, or wait 'til you've completed your path then run it.

Monika Gause
Community Expert
Community Expert
July 5, 2022

Do the circles need to be part of the path (as would be the case with a brush) or would you also accept it if they were separate objects?

Crooty
CrootyAuthor
Inspiring
July 5, 2022

Hi Monika, thanks for your reply.

Yes, I'm looking for a solution where the circles are part of the path, as I'm creating many paths and have to move the anchor points often.
Maybe it's not possible, but maybe there's a way I don't know yet about. 🙂

Monika Gause
Community Expert
Community Expert
July 5, 2022

It doesn't help you immediately, but you could support the feature request I made some weeks ago: https://illustrator.uservoice.com/forums/333657-illustrator-desktop-feature-requests/suggestions/45223489-a-brush-that-places-elements-on-anchors

Ton Frederiks
Community Expert
Community Expert
July 5, 2022

You could try this, the circles are separate from the path, but can easily be moved together with the corner when selected with the direct selection tool.

Select your path and choose: Object > Direction Handles.

Cut the selection.

Choose: Effect > Convert to Shape > Ellipse

Edit > Paste in Back and Object > Path > Join.

Crooty
CrootyAuthor
Inspiring
July 5, 2022

Hi Ton, thanks for your reply, but I already have several workarounds.
I'm looking for a solution where the circles are part of the path, as I'm creating many paths and have to move the anchor points often.
Maybe it's not possible, but maybe there's a way I don't know yet about. 🙂

Ton Frederiks
Community Expert
Community Expert
July 5, 2022

It is easy to move the anchor points and the circles if you select them both with the direct selection tool.