Create a cog shape in Illustrator

05 Oct 2011

As promised in my last Illustrator post, on how to create a geometrical shape, the follow-up tutorial that will explain how I created the cog wheel in my usual step-by-step approach.

Today's post brought back a little bit of nostalgia, as it was one of the very first Illustrator tutorials I have ever written. This was on my very first blog, back in 2004, hence the jaggy ugliness of the transparent gif shown on that page, as it used to sit on a lighter background in that design. In 2005 I've switched designs but kept the articles and didn't bother to adjust all images. The tutorial uses another technique and the end result of the cog fragments is also different. For this cog I wanted a smooth wavy line, not a straight one like I used in my old tutorial,…

For some reason simply using the Zig Zag effect on a circle didn't give me the result I was after. The rounding of each ridge seemed a little bit too pointy and I couldn't get these more round using just this tool. Just adding this effect to a circle is of course way faster, but I tried out a different way to get the exact result I wanted. Here is the method I used:

Draw a horizontal line of 100 px

Before we begin, set the Fill in the Toolbox to Transparent and the Stroke to black. Select the Line tool and click somewhere on the canvas. In the box that appears enter a Length value of 100 px and an Angle of .

Apply Zig Zag effect

With the line selected, go to the Effects menu and choose Distort & Transform > Zig Zag. In the box that appears enter 20 px as Size and 1 for Ridges per segment. Make sure Absolute and Smooth is selected. Click OK.

Expand Appearance

Go to Object > Expand Appearance.

Place guides and draw a circle

Drag a horizontal and vertical guide from the Rulers. If the Rulers aren't visible, go to View > View Rulers > Show Guides or hit Cmd/Ctrl + R in case you don't see them. Make sure Smart Guides is enabled. Go to View > Smart Guides or hit Cmd/Ctrl + U to enable them. Place the wavy line object centered on the vertical guide high above the horizontal guide. Now select the Ellipse tool from the toolbox, hold down the Option/Alt key and click precisely on the intersection point of the 2 guides. In the box that appears enter 1000 px for Width and Height. Now turn the circle into a guide, by hitting Cmd/Ctrl + 5 (or go to View > Guides > Make Guides). Make sure the wavy line is positioned above the circle you've just draw. Move the line up if needed.

Copy Rotate at 10%

As you've must have noticed I'm using some easy figures to work with. I've chosen to use a line of 100 px length, and a circle of 1000 x 1000 px. The reason why is because I need to be able to rotate the wavy line around the circle and have it all seamlessly connected. So with the wavy line of 100 px of length, I can rotate it 36 times around the circle at a 10 degree angle. Select the Rotate tool, hold down the Option/Alt key and click precisely at the horizontal and vertical guide's intersection point. In the box that appears enter the value of 10° as rotation Angle, and choose Copy to duplicate the wavy line. Since we keep copying the wavy line, it gets double in length, and so each time we rotate it, we need to double the rotation angle. In the steps that follow, we repeat the action of copy rotation and joining 2 segments, until we completed more than half the circle's length.

Join path segments

Select the Direct Selection tool (white arrow) from the toolbox, and drag a selection over the 2 neighboring anchor points of the 2 wavy line objects to select only these 2 points. Now hit Cmd/Ctrl + J to join them (or go to Object > Path > Join).

Copy Rotate at 20%

Select the Rotate tool again, hold down the Option/Alt key and click precisely at the horizontal and vertical guide's intersection point. In the box that appears enter the value of 20° as rotation Angle.

Join path segments

Select the Direct Selection tool (white arrow) from the toolbox, and drag a selection over the 2 neighboring anchor points of the 2 wavy line objects to select only these 2 points. Now hit Cmd/Ctrl + J to join them (or go to Object > Path > Join).

Copy Rotate at 40%

Select the Rotate tool again, hold down the Option/Alt key and click precisely at the horizontal and vertical guide's intersection point. In the box that appears enter the value of 40° as rotation Angle, and choose Copy to duplicate the wavy line.

Join path segments

Again, select the Direct Selection tool (white arrow) from the toolbox, and drag a selection over the 2 neighboring anchor points of the 2 wavy line objects to select only these 2 points. Now hit Cmd/Ctrl + J to join them (or go to Object > Path > Join).

Copy Rotate at 80%

Select the Rotate tool again, hold down the Option/Alt key and click precisely at the horizontal and vertical guide's intersection point. In the box that appears enter the value of 80° as rotation Angle, and choose Copy to duplicate the wavy line.

Join path segments

Again, select the Direct Selection tool (white arrow) from the toolbox, and drag a selection over the 2 neighboring anchor points of the 2 wavy line objects to select only these 2 points. Now hit Cmd/Ctrl + J to join them (or go to Object > Path > Join).

Copy Rotate at 160%

Select the Rotate tool again, hold down the Option/Alt key and click precisely at the horizontal and vertical guide's intersection point. In the box that appears enter the value of 160° as rotation Angle, and choose Copy to duplicate the wavy line.

Join path segments

Again, select the Direct Selection tool (white arrow) from the toolbox, and drag a selection over the 2 neighboring anchor points of the 2 wavy line objects to select only these 2 points. Now hit Cmd/Ctrl + J to join them (or go to Object > Path > Join).

Select and remove path segments

We could just copy and paste (in front) the last segment that we need, and rotate it to close the circle, but instead I decided to remove the path segment that covers the second half of the circle. This way we can copy mirror the object that is left, and close the circle by joining both together. So select the Direct Selection tool (white arrow) and drag a selection over the path segment that covers the right half of the circle. Hit the backspace key to delete the selected segment.

Copy Reflect along the vertical axis

Now select the Selection tool (black arrow) to select the entire wavy line object. Select the Reflect tool from the toolbox, hold down the Option/Alt key and click precisely at the horizontal and vertical guide's intersection point. In the box that appears select Vertical Axis and choose Copy to duplicate it.

Join path segments

Select the Direct Selection tool (white arrow) from the toolbox, and drag a selection over the 2 neighboring anchor points of the 2 wavy line objects at the top of the circle to select only these 2 points. Now hit Cmd/Ctrl + J to join them (or go to Object > Path > Join). Do the same for the 2 neighboring anchor points at the bottom of the circle.

Add fill and draw circle on top

Select the object and click the Swap Fill and Stroke arrow above the fill and stroke color at the bottom the toolbox, to remove the back stroke from the object and give it a black fill instead. You can do the same by just hitting Shift + X. You can of course choose any color you like here.

Pathfinder > Minus Front

Now draw a circle on top, starting from the center out (at the guides' intersection point), by selecting the Ellipse tool, holding down the Shift + Option/Alt key, and by click dragging towards the outside. You could also just hold down the Alt/Option key and enter the values in the box that appears, like 1000 px width and height. Select both the wavy object and the circle and choose Minus Front from the Pathfinder palette. There you have it. Hope you enjoyed it ;)

Comments

  1. 1 Simeon 05 Oct 2011

    Hey Veerle, great tutorial as always but I use a far simpler method which I think produces very similar results, with more flexibility and speed.

    Use the star shape.
    Cick the art board to set the size of the cogs and the number.
    Apply Effects > Rounded Corners and adjust to taste.

    Enjoy!

  2. 2 Nikola Igniatovic 05 Oct 2011

    Nice tutorial but for that specific task isnt it a bit of an overkill to do that by hand?

    This is an easy task in photoshop with the polygon shape tool. Just add the Sides, Smooth corners, Smooth indents and offcourse the Star option. Then a simple copy and paste in illustrator.

    On the other hand, anyone that is on a learning curve will benefit from the procedures and technic in this tutorial :)

  3. 3 Igor Gotal - Luksa 05 Oct 2011

    Hm, i think there is much quicker way to create cog shape in Adobe Illustrator: select “Star tool”, left click and open dialog, set values for radius 1 and 2, and enter desired number of points. Now we have a star. Select star > Effect > Stylize > Round corners. Now we have cog shape. After that: Object > Flatter transparency. Voila! Cog shape is here, in less than 30 seconds. :)

  4. 4 William Morren 05 Oct 2011

    snellere manier:
    1. Cirkel aanmaken
    2. effect -> distort & transform -> zigzag
    3. points op corner zetten
    4. effect -> stylize -> round corners

    en dan zijn je hoeken ook mooi rond ipv de gewone zigzag manier.

  5. 5 Nathan 05 Oct 2011

    Nice tutorial.  You could also make a star shape, use the rounded corner filter to smooth it out, then use pathfinder to cut out the center.

    Or, you may want to use the transform filter and repeat + rotate the shape you’ve created in step 1 of your tutorial.

  6. 6 nomi49 05 Oct 2011

    Thanks for the another informative piece. BTW, instead of doing copy/paste strep repeatedly? Have you tried using zig zag shape as a pattern brush. It could be much quicker. I gave it a shot but it only works for 1pt stroke size. Anyways, you’re the pro. You can tell better if it’s a better approach or not.

  7. 7 Veerle Pieters 05 Oct 2011

    @Nathan, @Igor Gotal - Luksa, @Simeon

    Hey Veerle, great tutorial as always but I use a far simpler method which I think produces very similar results, with more flexibility and speed.

    Nice :) Didn’t think about the star shape. I almost never use filters, habbit that comes with using Illustrator so long I guess :) I knew there would be faster ways but I always try to let people learn it the hard way, kinda like not using a wysiwyg editor but using code instead until you understand it. The techniques used are handy in other areas as well so that’s my thinking when I create these tutorials. Filters are nice when you know what you are doing and you have the knowledge to adjust.

    @Nikola Igniatovic

    This is an easy task in photoshop with the polygon shape tool. Just add the Sides, Smooth corners, Smooth indents and offcourse the Star option. Then a simple copy and paste in illustrator.

    I’m so used to Illustrator that Photoshop isn’t being considered. It’s different in how the pen tool works etc…

    @William Morren

    That’s what I mentioned in the beginning of the article (see image) :)

    @nomi49

    BTW, instead of doing copy/paste strep repeatedly? Have you tried using zig zag shape as a pattern brush. It could be much quicker. I gave it a shot but it only works for 1pt stroke size.

    I usually stay away from pattern brushes because they are trouble often. Connecting the pattern seamlessly is the problem on most occasions. It’s an interesting approach though.

  8. 8 William Morren 05 Oct 2011

    @Veerle Pieters
    you didn’t mention my step 4 ;)

    4. effect -> stylize -> round corners

    thats what made it better rounded corners, instead of the “crappy” default ones.

  9. 9 Kyle Harvey 05 Oct 2011

    Learning the basics is a must! My tip because I love the pathfinder:

    1. After creating the top squiggle and circle.
    2. Copy squiggle, flip vertically and place at the bottom of the circle.
    3. Connect top/bottom squiggle endpoints to make a shape.
    4. Rotate at 10deg (copy), duplicate (cmd+d) until shape is finished, select all, then pathfinder-unite.

  10. 10 Tom Nulens 07 Oct 2011

    Dag Veerle,

    Ik zag deze tutorial en wou je laten weten dat je zo een vorm sneller en nauwkeuriger kan maken met dynamische vectors. Ik heb het even gedaan en een screenshot ter illustratie geupload.

    Dat is met de vectorscribe plugin voor illustrator gedaan. Het gaat supersnel en het grootste voordeel is dat de vectors dynamisch blijven. Je kan ten alle tijde zaken aanpassen (aantal golven op de circel, sterkte van de ronding, ...) Volle controle dus. Bovendien kan alles numeriek ingegeven en aangepast worden waardoor het uiterst precies is.

  11. 11 Veerle Pieters 07 Oct 2011

    @William Morren

    you didn’t mention my step 4 ;)

    Indeed an oversight of me :)

    @Tom Nulens

    k zag deze tutorial en wou je laten weten dat je zo een vorm sneller en nauwkeuriger kan maken met dynamische vectors.

    Bedankt voor je uitleg :) Mijn uitleg waarom ik dit op moeilijke manier doe is hierboven beschreven. Je gebruikt hiervoor een plugin die misschien best wel handig is maar tot niet zoveel leidt als je de basis tools in Illustrator niet snapt. Ik wil dat mensen nog wat creatief denken om iets te creëren. Probleem tegenwoordig is dat mensen denken dat je alles met een plugin kan en dat is misschien wel waar tot op een zekere hoogte maar je leert er niets mee. Eens je weet hoe het kan met de basis tools heb je iets fundamenteel nuttig voor later en als je daarna grijpt naar een plugin snap ik dat ook volledig.

  12. 12 Amanda DeVries 01 Nov 2011

    Hey there,

    A little late in looking at this but I just wanted to say even if there are fast/more efficient ways of achieving an effect, I think it is great and very helpful that you post original articles like this.

    While it is great to see fantastic design being featured on blogs, the content tends to repeat itself and so something unique like these tutorials are a treat for me. Thanks again!

The Deck

Ads via The Deck