I have a quick question regarding aligning objects to paths/other objects. Essentially, I have a rounded rectangle with max rounding so that a circle could perfectly fit at either ends. Consequently, that's exactly what I'm trying to do. After trying several methods to no avail, it came to my attention that maybe I could create a path or guide, and lock an object, like a circle, and slide it along that path. So my question is, does this feature exist, and if not, are there other options that could help me achieve a similar effect?

enter image description here

2 Answers 2


You can achieve the same thing with a single path using the Appearance panel...

  1. Draw your path...

  2. From the Appearance panel, add a number of strokes: the bottom for the "outline", the next one a few pt smaller for the "fill" and another on top for the end pieces. Set all the strokes to have round end caps.

  3. For the end circles set the stroke to be dashed with a "0" width dash and the largest gap you can (which should hopefully be longer than your path). Set the dashes to align to corners; this will keep the "dashes" (the circles) at the ends of the path.

Once you've finished setting up your appearance you can drag the object to the Graphic Styles panel to save your style for easy reuse:

enter image description here

  • The only reason i was answering was that my comment was too close to an answer and Vincent would have admonished me for commenting what is in fact an answer.
    – joojaa
    Commented Mar 17, 2017 at 13:08
  • Yeh, don't let Vincent catch you doing that ;)
    – Cai
    Commented Mar 17, 2017 at 13:28
  • Thank you for the response! I'm fairly new to the program, is doing something like this normal or did you just find a complex way to achieve what I was asking? Because this method seems a little advanced for wanting to align a circle with a rounded rectangle. Either way, I appreciate your response!
    – Steven
    Commented Mar 17, 2017 at 20:25
  • @Stevens, I'd say using multiple strokes on a path is pretty normal, but I've never heard of the circle trick. If you need circles of different colours or sizes, or only on one end, it's easy to exactly align a circle on the end-point of a path if it has round end-caps.
    – user53083
    Commented Mar 18, 2017 at 20:38
  • @steven sorry, missed you comment... It's pretty normal; you can of course just use the regular alignment tools if they work for you, using the appearance panel to build styles and shapes like this is a very useful thing to know though :)
    – Cai
    Commented Mar 18, 2017 at 20:41

Select the rounded rectangle tool. Draw the rectangle with exact measures. Click the artboard, give the measures. The adjustment of the rounding is possible in Illustrator's new version. If you have it, no exact measures are a must.

In the Wiev menu set the smart quides on, enable snapping to point and disable snapping to grid. Now you can easily draw a circle that fits exactly and can be dragged easily along the rectangle.

The problem is more complex if you want the rectangle to have substantial stroke width and the circle must fit exactly between the strokes. One possiblity is to offset the strokes or have multiple strokes and make the extras invisible in the appearance panel. Actually your rectangle can be a curve as written in another answers.

Here's a different, the hard worker's solution:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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