0

My problem

The screenshot here shows my problem.

I'm trying to draw a multicoloured line. Its not a straight line, it curves a lot and irregularly. To make this I've set up a number of different lines and set them overlapping each other. Which...sort of works. Though it gives the problem on the left, I have to very exactly manually get things just right or else I get issues like the too small white on the left.

To solve this I tried to join the lines... but this gives the problem on the right. Part of my line needs to be curved, but the white rectangle inside the line should have a square edge. The curve itself has also became distorted.

What is the 'correct' way to draw a multicoloured line like this, ensuring its internal segments remain square and the curves do not alter when I join them?

1 Answer 1

5

Use the appearance panel to apply two strokes to the same path. The bottom stroke can be a solid colour and then the stroke on top needs to be a dashed line. Like this:

enter image description here

That way you can adjust colours, size of dashes and change the shape of the line easily.


To add round end caps, you can use a very similar method. The solid stroke has the rounded end caps, while the dashed stroke has square end caps. There are a couple of things to adjust to make this look right, as highlighted in the following image:

enter image description here

By default, the two ends of the line / curve won't look the same, but by tweaking the highlighted value by tiny amounts, you can even them up.

6
  • Thanks. My issue however is that I might not be able to make the entire line at once, it has to be quite exactly measured and is subject to modification, hence why I'm making it in chunks and then joining. Theres no way to do this without making sure I haven't first applied the rounding? May 9, 2017 at 16:56
  • The dashes aren't fixed, so they would adjust and retain their even spacing as you join more lines together.
    – Westside
    May 9, 2017 at 16:59
  • That's what I did in my example, it led to the problem of curved dashes May 11, 2017 at 10:16
  • Do you mean that you want the lines to have rounded end caps, but square ended dashes?
    – Westside
    May 11, 2017 at 10:21
  • yes. The overall line itself should be curved but the dashes on the strokes inside the line should all be the same size with square ends May 11, 2017 at 10:59

Your Answer

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

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