gotcha

Author Topic: Best way to create 45-degree angle.  (Read 2695 times)

June 06, 2018, 09:33:49 PM
Read 2695 times

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
I have some simple rectangles that server as highlight borders near some text. Sort of like this --->   | Example |

I'd like to make that stand out a bit more by adding 45-degree "caps" on the top and bottom of each vertical border/bar. To visualize this, take the bar to the left of the E in "Example". On top of that bar I'd add a short extension that would essentially point to 2 o'clock and the bottom of the bar would get the reverse of that (pointing to 5 o'clock) and the the right bar would get the mirror of that.

I'm having trouble getting this to be uniform. I can create the same width rectangle and rotate it (with CTRL) to exactly 45 degrees, but how can I then SNAP it such that the edges align perfectly? In other words, the bottom left edge of the extension rectangle connecting to the top left edge of the existing vertical bar.....

Or, am I doing this entirely wrong and there's a much better way to achieve this look?
  • Windows 10

June 06, 2018, 10:02:14 PM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Do I understand that you're using long, skinny rectangles to represent lines?  Or maybe you draw a short path, and then use Path menu > Stroke to Path?

If it would be possible to use paths instead of rectangles, that might make it a little easier.  Then you could snap the end node of the 45° angle path to the end node of the vertical path.  Remember, you make paths as wide as you like.  And if rectangles are absolutely required, then after you finish, you can use Path menu > Stroke to Path, to make them into rectangles.

If you want to learn about using rectangles, then you'd have to snap one particular corner node on the angled rectangle to one particular node of the vertical rectangle.  See attached.

Do you already know how to use snapping?  Or do you need to know how to set it up?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 06, 2018, 10:18:46 PM
Reply #2

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
Do I understand that you're using long, skinny rectangles to represent lines?  Or maybe you draw a short path, and then use Path menu > Stroke to Path?

Paths.... New one for me. I had been using rectangles and as long as paths can act like rectangles (that is, be filled, various lengths/widths and snap to grids) then this seems the way to go. Just will need to look them up now.

Quote (selected)
Do you already know how to use snapping?  Or do you need to know how to set it up?

Snapping I MAINLY know how to use, though all the options that you can select for them are a bit daunting and confusing at times.

Oddly, regarding your rectangle example, I can't get nodes to appear on my rectangles to have them snap together. However, since you said Paths is the better option I'd be glad to learn that. Can you fill me in on that process?

Thanks so much!

EDIT: Learning a bit about paths and help on four fronts could really help beyond the above:

1) Can they be edited after the fact? For example, each part seems to be a unique element (the vertical and then the angles).

2) I drew two verticals and found that they didn't line up on a grid as expected and even though I had two path lines of the same thickness, I couldn't get them to line up on top of each other perfectly.

3) They seem to be all stroke. If I draw a "line" with one and fill it, it fills to the right empty space. Perfect would be a line with a center file and a stroke around the entire path as a border. I can't get that to go at all unless I'm not supposed to be making this shape with just one "line".

4) How do I get the 45-degree part of the line to be of a reliable length? I draw one of these shapes and simply cannot replicate it (as I need them with different heights, but all with identical angled pieces).
« Last Edit: June 06, 2018, 11:04:29 PM by Agrajag »
  • Windows 10

June 07, 2018, 12:20:27 AM
Reply #3

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Yes, snapping is very complex in Inkscape.  I'd guess it took me a couple of years, before I felt like I had a solid understanding.  Although part of the reason it took so long is because I didn't ask questions right away, and as long as I found other ways to achieve something, I didn't need to ask.  But anyway, continuning with your questions...

After you draw a rectangle, with Rectangle tool :rect:, you need to do Object menu > Object to Path.  Then when you switch to the Node tool :node:, you will see the nodes.

Actually, I think the corners of the rectangle might snap together....  Hah -- yes, they do!

Generally with snapping (and especially for newbies) it's best Not to have all the options enabled at the same time.  Sometimes newbies get desperate and have them all enabled.  But really what that does, is allow every snappable element to try to snap to every available target.  It's kind of a crazy and unmanagable situation.

So attached is a screenshot of snap settings which I find to be useful for most situations.  I leave mine like that, and when I need something different, I just change whatever I specifically need.  And when I'm finished, I change them back.  I've noticed a lot of newbies seems to use the bounding box options for snapping, but I find it limiting.  Only rarely do I find a situation where I have to use snapping to a bounding box.

I also find it very helpful to use Inkscape Preferences > Behavior > Snapping > Only snap the node closest to the pointer.  Then when I'm dragging something to snap it to something else, I grab the object with the mouse close to that node.  I find it helps to prevent accidentally snapping the wrong thing to the wrong target.  Although, since Inkscape added the snap indicator (the small text which pops up when the snap happens) I guess it's not as important as before that.  Maybe it's just a habit now?

1) Can they be edited after the fact? For example, each part seems to be a unique element (the vertical and then the angles).

I'm not sure what you've found or what you mean.  After what fact? 

I think you might have found the Pencil tool, where you click once to start a path, and click once to end a path.  However, the Pencil tool is primarily a freehand drawing tool.  So you press the mouse and keep it pressed while you drag it around.  Inkscape automatically creates and places the nodes for you.

The Pen/Bezier is the main path-drawing tool.  With that, you click once to start, and every time you click after that, you place another node.  Then you double-click (or press Enter, if you like key shortcuts) to end the path.

You might want to look at a tutorial I wrote some time ago.  It's very long, but it's written in a way that you can find the section you need, and only read that.  Plus, after you read a little bit of it, the rest becomes more and more predictable.  Plus, it takes 10 or 20 times longer to read, than to actually perform the steps.  It covers all the path tools.  https://forum.inkscapecommunity.com/index.php?action=articles;sa=view;article=7

2) I drew two verticals and found that they didn't line up on a grid as expected and even though I had two path lines of the same thickness, I couldn't get them to line up on top of each other perfectly.

If you hold the Ctrl key while you draw, it will constrain the tool to vertical or horizontal, or also to 15° angles, if you move the mouse too far out.

Or if you have snapping enabled at the same time the grid is enabled, the Pen or Pencil tool will snap the nodes to the grid intersections.

3) They seem to be all stroke. If I draw a "line" with one and fill it, it fills to the right empty space. Perfect would be a line with a center file and a stroke around the entire path as a border. I can't get that to go at all unless I'm not supposed to be making this shape with just one "line".

You can make a rectangle in just one line, using the Pen tool.  (Now I'm pretty sure you discovered the Pencil tool.)  Click once to start, click once again at the next 2 corners of the rectangle (using Ctrl to keep straight) (or use a grid).  When you come back around to start, click once inside the tiny box, to end.  If the mouse isn't exactly inside the box, the path will look like it's closed, but it won't be closed.  The tiny box will become red, when your mouse is in the right place.

Technically, what you draw with the Pen or Pencil tools, are stroked paths.  Technically, paths are invisible.  If the path has no stroke, you won't be able to see it, even though it will exist.  If it's selected, and you have the Node tool enabled, you will be able to see the nodes, but you won't see the path.  Since that would make it nearly impossible to get much work done, Inkscape makes paths that are automatically stroked when you draw them with Pen or Pencil tools.

You can fill a path whether it's open or closed.  But if it's an open path, the fill will only show when the path has a shape which acts like a container.  Attached is an example of what I mean.  Maybe it would be better to say that it will only fill the concave portions.  Most of the time, you'll want to make sure paths are closed, to give them a fill.  (The Paint Bucket tool :fba: allows to fill spaces which are entirely enclosed, but not by a single path -- a whole different way to give color.)


4) How do I get the 45-degree part of the line to be of a reliable length? I draw one of these shapes and simply cannot replicate it (as I need them with different heights, but all with identical angled pieces).

It's better to draw the path the right length first, and then rotate it after.  If you are doing a lot of this....  If the angled piece is always the same length, you can draw one, and just keep it outside the page border.  Then whenever you need one, just duplicate that one, and move it into place.  (Duplicated objects are right on top of the original - there's no obvious clue about it, so you just need to know it's there, and move it wherever you need it.) If it's in a different file, you can copy it out of one file and paste into another.

Or, you could draw the whole object - the vertical line with the 2 pieces attached already.  Then when you need another one, duplicate it, scale it to the size you need, and move it into place.  If you have a series of different sizes, which are always needed at the same sizes -- same routine -- make one set, and just duplicate it as needed.

If you make a whole shape or a whole series, I would suggest joining all the pieces together.  Using the Node tool, drag a tiny selection box around 2 overlapping nodes.  (If you use snapping, the nodes will be exactly overlapping.)  Then either click this button on the Node tool control bar :jsn:, or use the key shortcut (whatever it is, I always use the button - look in Help menu > Key and Mouse Ref, to find the shortcut).
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 07, 2018, 01:37:33 PM
Reply #4

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
To be honest reading only your original post I'm not sure what you are after.
Simplest way for 45° is pulling a guide line from the top left/right corner of the ruler -just click and drag.
If you enable snapping to guide lines and nodes, it takes seconds for those diagonals.

June 07, 2018, 02:18:56 PM
Reply #5

Agrajag

  • Full Member

  • Offline
  • ****

  • 56
Simplest way for 45° is pulling a guide line from the top left/right corner of the ruler -just click and drag.
If you enable snapping to guide lines and nodes, it takes seconds for those diagonals.

With what tool?
  • Windows 10

June 07, 2018, 03:04:10 PM
Reply #6

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Bézier in straight-line mode + dragging out guides.

To make it symmetrical (same length of the annex), only draw half of one border, then mirror or rotate it, snap it to the other half's end, join nodes if desired or group. Duplicate the group or joined path for the other border.

June 07, 2018, 03:23:52 PM
Reply #7

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
With what tool?

With the node tool :node: or with the select tool  :sel: -or ANY tool for that matter.

.
diagonal.gif
*diagonal.gif
(401.36 kB . 680x696)
(viewed 1454 times)


June 09, 2018, 11:54:07 AM
Reply #8

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
The mouse can pull the guide out of the ruler, no matter which tool is enabled.  But only the Selection tool or the Node tool can adjust the guide after they are pulled out.

Using a 45 degree guide is just a different way of achieving the angle, compared to rotating the line, after you draw it.

You have to start with the mouse, near the ends of the rulers, to automatically drag out a 45 degree angle guide.  If you start in the middle of the ruler, you'll get either vertical or horizontal guide.  You can still rotate the vertical or horizontal guide to any angle you want.  But if you start dragging near the end of the ruler, you get 45 degree guide.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann