1 2 Previous Next 44 Replies Latest reply on Sep 8, 2012 1:44 PM by tromboniator

# Defining Diagonal Bars in a Rectangle in Illustrator

Hi everyone, In Illustrator how do you make a shape with points which go from point to pint within another shape?

For example, I am making flags, when a flag has a diagonal bar such as Scotland and Jamaica, the width of the bar is defined by it flat or laying horizontal and then it is set diagonally across the flag, with it's centre across the centre of the flag [rectangle] and it's ends centred on the corners.

How do you define a horizontal bar to be a certain width (when flat) and define it to be centred along the diagonal of a certain shape and with it's length defined by the corners of the rectangle?

Any help much appreciated

Gareth

PS. I have done an example of what I am trying to do here in an exact square. It can be done easily in an exact square because you just make the bar 45º, however by doing it this way the points at the centre of the white bar (which I have put there myself exactly in the middle) are still not at the corner points of the rectangle, thus the length of the diagonal bar is not defined.

• ###### 1. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

You may (Smart Guides are your friends):

1) Create a straight path, with a Stroke Weight equalling the width of the bar, close to being from corner to corner, then with the Direct Selection Tool drag the endpoints to coincide with the corner Anchor Points,

2) Object>Path>Outline Stroke,

3) Create a copy of the background rectangle (Ctrl/Cmd+F),

4) Select 2) and 3) and Pathfinder>Intersect shape areas (or whatever it is called in your version to result in the overlap between the shapes, you may need to press Alt/Option to make a simple path).

To create the crossing bar you may:

5) Select 4) and Object>Transform>Reflect a copy (vertically or horizontally).

• ###### 2. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Thanks Jacob, that is fantastic! My life has just been made so much easier!

Gareth

• ###### 3. Re: Defining Diagonal Bars in a Rectangle in Illustrator

You are welcome, Gareth.

Just an afterthought: if you ever need to add a stroke to the flag, you may copy the background rectangle and change from fill to stroke, then move it to the top/bottom of the stacking order, depending on whether you wish to have the full stroke visible on top of the rest (covering the outermost part of the fills) or the outer half of the stroke visible (outside the fills).

• ###### 4. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Hi, I do have a stroke around the whole flag like you suggested, it's a rectangle with no fill and a black stroke (0.25 pt) which is at the top in the stacking order, which looks quite good, It's definitely necessary to have a stroke because if any of the edge of the flag is white you wouldn't be able to see the edge!

• ###### 5. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Hi again Jacob, Whoa! … I have just tried doing what you said and found a problem with your solution “Create a straight path, with a Stroke Weight equalling the width of the bar” The stroke value is in points and my dimensions are in millimetres, am I required to change the stroke value back and forth while working on the design? that would be a bit annoying.

I have at the moment got as far as a straignt line from corner to corner which has no width value [width value should be 18 mm]

Gareth

• ###### 6. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

In the Stroke Weight box, you may enter the unit, if you need 18 mm, just insert 18 mm.

It will change to the corresponding value in points (51.024).

• ###### 7. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Hi thanks, I have made the width 18 mm Ok, and done [Object > Path > Outline Stroke] There are two things I would say. First, the bar (from the guidline in the middle) appears to be no longer centrerd propery on the corner points of the rectangle (but that may just be the way Illy presents it visually, as there are no longer points where the original line was on the centre line of the bar)

Second, when I select the bar and the rectangle behind it, it does not let me pathfinder it with Intersect for some reason [it just says, “Filter produced no results, please select two overlapping paths”], however, it does let me pathfinder it with exclude just leaving me with all the rubbish I didn't want! See below.

• ###### 8. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

Here is an amended version which deals with the occasional issue of lacking coincidence/overlap in 2B) and a way to make sure the bar is centred over the corners in in 2A), the latter to be undone again:

You may (Smart Guides are your friends):

1) Create a straight path, with a Stroke Weight equalling the width of the bar, close to being from corner to corner, then with the Direct Selection Tool drag the endpoints to coincide with the corner Anchor Points,

2) Object>Path>Outline Stroke,

2A) If desired, to make sure the centring is right on the corners, Object>Path>Add Anchor Points to get Anchor Points at the centre of the end segments, then use Ctrl/Cmd+Z to Undo to get rid of unecessary Anchor Points,

2B) In the Transform palette/panel, increase the value of W (or H, you may insert *1.01 (or *1.1) to the value to increase it by 1% (or 10%)) and use Ctrl/Cmd+Enter to increase the length past the corners of the background rectangle (it is important to have the Centre Reference Point ticked),

3) Create a copy of the background rectangle (Ctrl/Cmd+F),

4) Select 2) and 3) and Pathfinder>Intersect shape areas (or whatever it is called in your version to result in the overlap between the shapes, you may need to press Alt/Option to make a simple path).

To create the crossing bar you may:

5) Select 4) and Object>Transform>Reflect a copy (vertically or horizontally).

I apologize for forgetting the coincidence/overlap issue. It only occurs when some inaccuracy sneaks in, but it is rather annoying when it does. I went through the steps before posting the original suggestion without encountering it.

• ###### 9. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Hi Jacob, thanks, I will have a go at that tomorrow, it's getting late now here in the UK. I will let you know how I get on.

Gareth

• ###### 10. Re: Defining Diagonal Bars in a Rectangle in Illustrator

You are welcome, Gareth. It is getting late indeed, for us over here.

I forgot to mention that Smart Guides say anchor when you are within snapping distance of the corners.

• ###### 11. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Hi again, I have done [Object > Path > Add Anchors Points] and got the anchor points successfully. (it now displays a point at each end of the line in the centre of the shape) When I zoom in on it, I can quite clearly see that the end points of the centre line is not on the points of the corner of the rectangle, but there is not much I can do about it as it does not allow you to select the point and move it with the white arrow tool as usual.

With the white arrow tool you can only move the whole thing, I need to move the points of the line in the centre of the shape to put it back on the corners of the flag.

Sorry if I am doing something wrong,

thanks for help Gareth

• ###### 12. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

When the object is selected, you need to deselect it to move an individual Anchor Point (or the Direct Selection Tool will keep moving it as a whole); you can do it by clicking an empty spot.

• ###### 13. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Thanks, I have moved the shape's centre points to the corners of the rectangle successfully, (the line it's self has not moved). I don't know what will happen when I remove the anchor points hopefully the line in the centre of the bar will adjust accordingly centring the shape on the corner points. I will let you know what happen's in a minute.

• ###### 14. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Removing the anchor points made the shape disappear! and, what it has done is not moved the whole bar to centre on that line it has just merely moved the centre points of the surrounding shape, so it is no longer a right angled shape nor is it actually centred on the diagonal between the two corners. (hope you can see the pic when it is scaled down)

• ###### 15. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

I believe it is better to return to a slightly simpler instruction (and I just realized that the order was a bit wrong so the width of the bar would become too large):

1) Create a straight path, with a Stroke Weight equalling the width of the bar, close to being from corner to corner, then with the Direct Selection Tool drag the endpoints to coincide with the corner Anchor Points; the line will be coincide with the centreline of the bar when outlined;

2) In the Transform palette/panel, increase the value of W (or H, you may insert *1.01 (or *1.1) to the value to increase it by 1% (or 10%)) and use Ctrl/Cmd+Enter to increase the length past the corners of the background rectangle (it is important to have the Centre Reference Point ticked); this will extend the line past the corners of the background rectangle, but the line will still go through the corners;

3) Object>Path>Outline Stroke,

4) Create a copy of the background rectangle (Ctrl/Cmd+F),

5) Select 3) and 4) and Pathfinder>Intersect shape areas (or whatever it is called in your version to result in the overlap between the shapes, you may need to press Alt/Option to make a simple path).

To create the crossing bar:

6) Select 5) and Object>Transform>Reflect a copy (vertically or horizontally).

I hope this works.

• ###### 16. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Hi, thanks for help again, that sounds like a much better order of doing it. If I make the stroke the right thickness (18 mm) and then place the points on the corners, it might stay in place when I Object >Path >Outline Stroke it. I don't yet see the point in extending the diagonal line past the rectangle (if it is to make illy recognise it has overlapping for the Pathfinder crop, I think I can get it to do that another way. I would just rather keep the points on the points). If I can get the bar to be 18mm think with the points still on the corner points of the rectangle I think I can do it.

I am going to try this on Friday morning when I have a day of work (it's Wednesday night here now) I will have a good go at your instructions and some other ways and get back to you. I am going to drink some beer and listen to some music (Children of Bodom) now, and then get some sleep!

thanks again for all your assistance and patience Jacob

Gareth

• ###### 17. Re: Defining Diagonal Bars in a Rectangle in Illustrator

You are welcome, Gareth, and enjoy (is it a bottle a broon?).

As I said, the issue with the Pathfinder only occurs when there is an inaccuracy; normally you should be fine without extending the line.

• ###### 18. Re: Defining Diagonal Bars in a Rectangle in Illustrator

It took me ages to get your question “is it a bottle a broon?” is it a bottle of Newcastle Brown Ale, (pronounced by northerners as “a bottle a broon”) in England that's very northern, I'm from the south, (Andover, Hampshire) but obviously it's a mockery of a northern accent, I got it in the end. Actually (for me) it's four cans of Carling. I know all the brands are different in the USA so you have probably never heard of Carling!

BTW if you don't know your UK geography, Newcastle is in Northern England not Scotland but both people from Northern England and Scotland would literally say “a bottle of broon” they do all sound impossible to understand!

• ###### 19. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

Newcastle is in Northern England not Scotland

Indeed, a bit north of Aidensfield.

For a broon, you may try a gentle, steady pour down the side of the tilted glass to avoid the head and keep the hop oils in the ale.

• ###### 20. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Hi Jacob, Yep, that has worked, 100%. It looked right to the eye and to check it, I did [object » path » add anchor points] and clicked on the central point and it was right on the corner of the flag, so all is good. I am sure I will be able to crop it somehow with the pathfinder now it is properly aligned on the points.

Is there any way of making it a normal shape? i.e. without the line through it where the centre of the stroke was (when you select it with the black arrow tool). So it just becomes like any other rectangular shape? I might not apply this change, it depends what happens when I crop it, or try to crop it!

Gareth

• ###### 21. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

It seems that you have the original line lingering somehow. You may see that in the Layers palette/panel. If/when it happens, you will have to delete it.

Edit: Away for an hour or so. Back long before sunset.

• ###### 22. Re: Defining Diagonal Bars in a Rectangle in Illustrator

It still won't let me crop it. So I have made a rectangle corresponding to the edges of the flag and tried to crop it that way, but it still won't let me do it.

It allows me to combine the shapes (picture below) deduct the bar from the rectangle (post 2) though I don't know why there is an extra point in the punched out bit at the bottom. That shouldn't be there! and it allows me to exclude overlapping areas (post 3)

It just has a major problem with cropping the bloody bar!

• ###### 23. Re: Defining Diagonal Bars in a Rectangle in Illustrator

post 2 Punch Out

• ###### 24. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Post 3 Exclude

• ###### 25. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Result of applying pathfinder operation depends upon the stacking order of objects. So maybe you'd want to dive into the manual and read a little about how this all works.

• ###### 26. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

Sorry, it proved to be an hour or two rather than so.

Sometimes the inherent inaccuracy (of drawing in mm when the fundamental unit is points) disturbs the use of the Pathfinders, especially when the coincidence/overlap occurs between an Anchor Point (such as the corner of the background rectangle) and a segment (such as the end segment of the bar); is often seen in connexion with circles and radial lines, so the latter need to be extended.

That is the reason for step 2) in post #15, which is only required in such cases.

It may be that yours is one of them.

What happens if you use the extension in step 2)?

By the way I have noted that you use Crop instead of Intersect shape areas. What happens if you use Intersect (depending on version you may need to hold Alt/Option to get just the bar as a simple path)?

• ###### 27. Re: Defining Diagonal Bars in a Rectangle in Illustrator

No, I don't use Crop, I have only used the top four buttons on the pathfinder pallet, unite, minus front, intersect and exclude. I can (I think but I haven't tried it yet) achieve what I want to by instead of cropping it with the pathfinder, drawing the shape I want to get over it with the pen tool with smart guides on so that it snaps the pints to the points where the shapes' lines overlap. I think that will work to achieve the exact same result.

Monika, I did it all in both orders, (with the bar above and below the rectangle). The three results I got where the only things it allowed. All other combinations produced the error message mentioned above.

• ###### 28. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

What about the inclusion of step 2), then?

• ###### 29. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Ok I will do that now, and let you know what happens.

• ###### 30. Re: Defining Diagonal Bars in a Rectangle in Illustrator

It still doesn't work if you extend the shape beyond the corner points. One thing that might make a difference is if we made the diagonal bar a normal shape. What do I have to delete in the layers panel to make it normal and have the properties of any other rectangle made in the usual way?

• ###### 31. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

One thing that might make a difference is if we made the diagonal bar a normal shape

It should be.

If you select the diagonal bar, right after Object>Path>Outline Stroke, what does the Layer palette/panel say?

And if you open the Window>Document Info and select Objects in the flyout, what does it say (hopefully just Path: 1 (4 points))?

Edit: Soon away for a while again, maybe until  sunset.

• ###### 32. Re: Defining Diagonal Bars in a Rectangle in Illustrator

In the Layer panel for diagonal bar it says, <group> and there is a black circle, for the rectangle it says <path> and there is a white circle

[window » document info » object] for the diagonal bar says - paths 2 (one open, one closed, six points … loads of other stuff I tried to paste it for you but I couldn't.

It might be quicker if you tried doing it yourself on an illustrator file. My rectangle is on A4 portrait, is 150 wide, 90 high and centred on 105 horizontally and 117 vertically, that makes the edge of it 30 mm (x) and the hight of it 72 mm (y). Have a go at a diagonal bar of any width and see if you can do it.

• ###### 33. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

Back from the field, sun below the hills.

What I did was (actual clicks and keystrokes):

0) Create the 150 by 90 mm nostroke background rectangle with a 100% C Fill, placed with X = 105 mm, Y = 117 mm as centre, lower left corner at X=30, Y=72, and upper right corner at X=180,Y=162;

1A) Create a nofill straight path with a white 1pt Stroke and drag the endpoints to coincide with the lower left/upper right corners (Smart Guides say anchor), Anchor Points having the same X,Y values as the corners of 0);

1B) Increase the Stroke Weight to 18mm, the path covers the corners of 0);

2) Nothing/Skip the extension of length;

3) Alt/Option+O+P+U (Object>Path>Outline>Stroke) to create the bar rectangle;

4) Select the background rectangle 0) and Ctrl/Cmd+C+F to copy it above the original;

5) ShiftClick the outlined white rectangle 3) to have both selected and Pathfinder>Intersect while holding Alt/Option, resulting in the first bar being a simple path;

6) Alt/Option+O++E (Object>Transform>Reflect) a copy vertically, to make the full cross;

7) Select the background rectangle 0) and Ctrl/Cmd+C+F+X+F to copy it above everything else and change it to nofill 0.25 pt 100%K Stroke.

The outcome looks more or less like a rather whitened Bratach na h-Alba (Saltire).

So it works here, with the same sizes and positions.

• ###### 34. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

Changing the background to 100%C and 44%M gets it rather close.

And selecting both bars, then Pathfinder>Merge in step 6) would make it even neater with the whole cross as one simple path with 16 Anchor Points.

I really hope you can make it work: I should hate to suggest cruder solutions.

• ###### 35. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Hi Jacob, why on earth are you doing it all white so you can't see what you're doing? Is there a reason that everything has to be white?

• ###### 36. Re: Defining Diagonal Bars in a Rectangle in Illustrator

It worked! your a slippery little genius Jacob. I don't merge the two bars on right angle crosses, so I can still access the width of the bars, you loose that capability if you merge them together, however with the diagonal cross, it doesn't matter because I can't ever effect the width without doing it all again anyway.

I don't see why the colour scheme made a difference but it did, as soon as I outline stroked it, it went to a normal shape, not a funny one with a line through the middle. and I held down alt and option when I used the pathfinder this time which it didn't before. Anyway, it all works the bar stayed on the points and everything.

thanks for you help

Gareth

PS. I am going to click correct answer, again but this time I have actually done it!

• ###### 37. Re: Defining Diagonal Bars in a Rectangle in Illustrator

You are welcome, Gareth; a great relief.

why on earth are you doing it all white so you can't see what you're doing? Is there a reason that everything has to be white?

I made the background rectangle 100% C(yan), then finally changed it to 100%C+44%M, following the recommendation of the Education, Culture and Sport Committee of the Scottish Parliament.

I don't merge the two bars on right angle crosses, so I can still access the width of the bars, you loose that capability if you merge them together,

That makes perfect sense, and obviously it is unnecessary to merge in any case.

• ###### 38. Re: Defining Diagonal Bars in a Rectangle in Illustrator

My mistake, I thought you had done the rectangle and the bar white. Something about what we did differently made it work, it may well have been that when I did the original stroke this time, I set it (on your instructions) no fill and only gave it a stoke colour. And when it was outline stroked it just turned straight into a normal shape.

PS. Alt/Option+O++E (Object>Transform>Reflect) didn't work, so I did it manually in the reflect pallet. what I tried to do (this might not have been what you meant) was selected teh bar and pressed [alt and option and O and E] all at the same time but nothing happened!

• ###### 39. Re: Defining Diagonal Bars in a Rectangle in Illustrator

Gareth,

it may well have been that when I did the original stroke this time, I set it (on your instructions) no fill and only gave it a stoke colour. And when it was outline stroked it just turned straight into a normal shape.

Ah, sorry, I overlooked the filled path trap, Illy assuming filled and stroked paths to start with: when you outline the stroke, the fill is kept as a separate filled nostroke path with no width, just waiting to cause trouble.

Alt/Option+O+T+E is meant as Hold Alt/Option (depending on OS) while you press O, thenT, then E; you can see the keystroke guide unfold as underlining of the (next) letter in question when you hold Alt/Option.

1 2 Previous Next