Can anyone suggest a method that will essentially allow me to use the pattern shown in the below image as a stroke? I want to be able to apply this to any path, and want to ensure that the each component/dash will remain as it is in the image; that the squares, for example, will remain perfect squares and exactly the same size as they appear in the below image? At corners, either overlaps or a specific shape will be fine, as long as they retain visual consistency.

Pattern to use as stroke

I have tried Art and Pattern and Scatter brushes, but each of these in some way or another manipulates or stretches the pattern; in line with the previous example, a square will either get bigger or smaller, or become a rectangle.

  • Can you post an example screengrab of one of your attempts with pattern brushes - the settings used, and how it looked and why it wasn't right? I believe this is possible with the right pattern brush settings, but I don't want to repeat something you've already tried and ruled out. – user56reinstatemonica8 Jun 17 '15 at 14:45
  • I have tried every single brush and every single setting - they do most of what I want, but as someone mentioned, they scale the pattern to fit it onto the path to which it is being applied, purely because the path is too short to facilitate an entire length of the pattern; eg. if the pattern is 20 (units) wide, and the path 10, then it will attempt to squeeze one repetition of the pattern onto the 50 unit path, meaning that the pattern and all its components will be half as wide. – TPLD Jun 23 '15 at 10:10

Is this the sort of result you're looking for?

enter image description here

If it's not and you need no curved segments at all, ever, even on curved lines, you'll need to just do something like this as a guide then place and rotate the rectangular segments over it by hand.

If this is what you want, you can exceed Illustrator's dash-gap-dash-gap-dash-gap maximum (with some compromises) by saving as SVG from Illustrator, then hacking the SVG. Full steps below.

But first, be aware that with this approach:

  • You lose any features Illustrator can't convert to SVG. There aren't many, but some complex effects like blends or raster effects may break or cause the file size to balloon absurdly.
  • You can't edit the doc in Illustrator after applying this pattern. I'd recommend applying this when finishing the file - if you need any further file conversion or finishing, an SVG-based editor like Inkscape (free and open source) is your friend.

Here's how to do it:

  • Prepare your shapes in Illustrator. Give them a solid stroke, no dots or dashes at all else Illustrator will muck up the SVG. Tip: making anything you can into a compound path (object > compound path) will make the next steps slightly easier. For example, all the lines above making the second Hello are combined into one compound path.
  • Save as SVG
  • Open the SVG in a plain text editor / code editor. There are thousands of free ones, or you can use Windows Notepad or Mac TextEdit (but first set TextEdit to plain text mode before opening any file), or even Dreamweaver if you have it...
  • Add something like this to each <path you want to have this pattern:

    stroke-dasharray="2 1 4 1 5 1 3 1 5 1 2 1 4 1 1 1 3 1 1 1"

The numbers define the pattern and are relative to the stroke width - so if you want a stroke width of two, for example, double all the numbers (4 2 8...). It's length of dash, length of gap, length of dash, length of gap, repeat.

Then open it in something that can read SVG (e.g. a web browser)

Here's how the code behind the above example looks after adding the stroke-dasharrays:

enter image description here

  • That's absolutely perfect, thank you very much! – TPLD Jun 26 '15 at 13:02

You are kind of asking for the impossible. At least with any automated function.

The simple nature of having something "along any path" means it will distort to a degree. It's impossible to have something follow a path with absolutely no distortion. There are always curves and distortions introduced in order to mimic the path. Even if that pattern was created as a font, you'd see distortion along a curved path.

A pattern brush will work, but only if A) your paths have no curves and B) all path segments are long enough to encompass the entire pattern. "Any path" falls apart with brushes. And as @EddieA mentions in the comments, Illustrator doesn't provide enough gap and dash options to generate that particular pattern.

In order to have absolutely zero distortion everywhere, along a non-linear path, you would need each piece to be able to swivel and rotate independently of the other pieces. Which, to me, means the pattern would be broken in that respect.

You'll have to manually place the pattern and position it. Using a Symbol would help, but in the end it will take some manual precision if you don't want distortion anywhere.


In Adobe Illustrator

  1. Create a stroke using pen tool, Keep it selected.
  2. After making a stroke, Go to Menu on top of screen. Click on Window>Stroke...
  3. A menu will be shown similar to the image attached. (If you cant see Dashed Lane Options. You need to click the icon on the right side of the Stroke window and show options).
  4. And now you need to check Dashed lane to make it working, play with the settings. Then you can now enjoy creating custom dashed lane.

enter image description here Stroke Image

  • 2
    For the particular pattern above illustrated does not have enough dash/gap combinations to achieve this look. – Eddie Adolf Jun 17 '15 at 12:44
  • @EddieA. you can use patternt brush for same effect, even if the user claims otherwise. – joojaa Jun 17 '15 at 13:15
  • Actually @joojaa a brush will distort things in all cases unless the path is strictly linear. – Scott Jun 17 '15 at 17:04
  • The issue the user is having is that using these methods the brush bends and warps the squares as opposed to keeping their rectangular shape, plotted along the path. – Eddie Adolf Jun 17 '15 at 17:08
  • 1
    @Ryan no im saying PostScript does not set a fixed limit illustrator does set a limit of 6 and when interpreting postscript a limit of 10 (which I admit is weird). shs scripts dont actually have a limitation other than how the script is made. There is really no reason for a limit to exist. – joojaa Jun 17 '15 at 19:45

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.