increments on path

Share your Inkscape tricks and tutorials here.
DWFII
Posts: 2
Joined: Sun Dec 23, 2007 1:14 am

increments on path

Postby DWFII » Sun Dec 23, 2007 1:26 am

I'm pretty new to Inkscape but i have used CorelDraw for years. I'd like to draw a line...say, a spiral, and then make user-set divisions all along the length of the line.

Let's say that my spiral ends up being two inches long. What I'd like to do is make points or divisions at say, 1/9th inch intervals the entire length of the line.

Can this be done?

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: increments on path

Postby RobA » Thu Dec 27, 2007 12:02 am

You can use the Effects->Modify Path->Add Nodes to add nodes along the path. Unfortunately, it will not move existing nodes to get uniform spacing. Also, the spacing can only be specified in pixels.

-Rob A>

User avatar
capnhud
Posts: 435
Joined: Mon Jun 04, 2007 8:30 pm
Location: U.S.A

Re: increments on path

Postby capnhud » Fri Dec 28, 2007 12:28 am

Not sure if this will help, but heathenx has a tutorial episode 47 on creating a clock that may help you acheive what you are after.

DWFII
Posts: 2
Joined: Sun Dec 23, 2007 1:14 am

Re: increments on path

Postby DWFII » Fri Dec 28, 2007 4:19 am

Thank you both. Heathenx's tutorial was good and I watched it to the end but while on the right track it really wasn't the solution. I need to put "ticks" on an open path at specified intervals. The only way I have been able to do that is to create a rather stylized drawing of a divider with the points set at a specified distance apart, and then sequentially rotate and position that along the line adding my tickmarks as I go--manually. I'm not sure that it is any faster or any slower than heathenx's tutorial even if the concepts in the tutorial could be applied to my requirements.

And while I'm at it...I have used an Inkscape tool to determine the length of a path/line (it actually prints the length off to the side), but I would wish that there was a way to always have the length available for any simple path/line. Not as a printout but maybe on the status bar. Any single line, open or closed, ought to yield that information, not just coordinates.

User avatar
kelan
Posts: 178
Joined: Thu Sep 06, 2007 12:55 am
Location: Unicorn of Open Source
Contact:

Re: increments on path

Postby kelan » Sat Dec 29, 2007 2:13 am

If by divisions, you mean you just want to add some tickmark type lines, that can be done without too much fuss. The process is a bit weird to explain in just words, but I don't have an easy way to upload example pictures. Also, the distance between the ticks is not as exact as if Inkscape could do this natively, but it's pretty close. (Note that I'm using 0.45pre1 for these instructions. If you have a different version, they may not work.)

First, draw your spiral (or other random open path).

Now we're going to use the Pattern along Path extension to put on the ticks.
  • Create two guides the distance apart that you want for your ticks. You can place guides precisely by double-clicking them. Make sure guide snapping is on in the Inkscape preferences.
  • Draw a horizontal line from one guide to the other using the bezier tool :tool_pen: (Shift-F6). You can insure the line is horizontal by holding Ctrl while you place your second point.
  • Select the horizontal line and switch to the node tool :tool_node: (F2). Press Ctrl-A to select both endpoints. Then press Insert (the Insert key on the keyboard) five times. The result should be a line made of 33 nodes. This will allow the line to curve smoothly when applied to the spiral.
  • Set the stroke of the horizontal line to be some color, like red. You'll see why later.
  • Draw a vertical line as tall as you want the ticks to be. Note that because of the way Pattern along Path works, the ticks will extend to both sides of the spiral's stroke. If you want ticks on only one side, you'll have to be trickier. I'll add something on that below.
  • Bring up the Align and Distribute dialog by pressing Shift-Ctrl-A. Change the "Relative to" option to "Last Selected." Select your two lines (selection order doesn't matter). Center them on the horizontal axis, and align left sides.
  • Press Ctrl-G to group the two lines. (We don't want them as one path, but as a group.)
  • Select the line-group and then select the spiral. Selection order matters here.
  • Under the Effects menu, choose the Generate from Path submenu, and then Pattern along Path. Options as follows:
    • Copies of the pattern: Repeated
    • Deformation type: Snake
    • Zero for the next three
    • Pattern is vertical: unchecked
    • Duplicate the pattern before deformation: your choice, but I usually have it checked
  • Click OK.

Now you should have a spiral with ticks, and a red line following the spiral. Because we grouped the lines instead of combining them, the red line and the ticks are separate paths in the newly-created group. So you can delete the red line if you want.

Okay, what about making the ticks only show on one side of the spiral's stroke? To do that, instead of one vertical line, you'll need two of the same length. Make one a different color so you can tell them apart. Align them so they look like basically like one line (in the Align and Distribute dialog: center on vertical axis, align tops of objects to bottom of anchor). Group them. Now start at the step in the list above as if you'd just drawn the vertical line. In the final group, you can delete either side of the ticks by going into the group of groups and deleting one of the two paths.

I know this is odd without being able to visualize it; maybe heathenx can make a screencast for it. Let me know if you have any questions.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: increments on path

Postby brynn » Wed Jan 02, 2008 3:05 pm

This is a rather crude idea, but I thought I'd mention it anyway. I'm wondering if you could use the Stroke Style dialog, and try a few of the dashed-line strokes until you find one that's closest to the increment sizes you want. Make the dashed line thicker (and/or a different color) than what you want for the solid line. Then right on top of it, make a 2nd stroke that's the solid line you want. This should leave you with evenly spaced increments, which you could use as a guide to place the tick marks. And then finally delete the original dashed-line stroke. Or if you don't have to have tick marks exactly, you might be able to put a dashed line right beside and touching the solid line, and it would look like dots along the line, rather than ticks.

So anyway, for whatever it's worth, that's my idea :mrgreen:
Happy New Year!

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: increments on path

Postby prkos » Wed Jan 02, 2008 11:25 pm

You can also play with markers after you distribute your nodes uniformly (I haven't tried kelan's suggestion, I hope it works ok).

Draw the object you want to be your tick mark and convert it to a marker: Object > Objects to Marker (this only exists on a newly development build).
Then select your path (spiral) and go to the Stroke style dialog. There you can choose Start, Middle and End markers. When you expand the drop-down there you'll see your tick object, just select it and a tick will be placed on every node of your path.
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download


Return to “Tricks & Tutorials”