Inkscape.org
Tips, Tricks, and Tutorials Tutorial - How To Make Center Line Path of a Shape
  1. #1
    Hum Hum @Hum
    *

    Hi. I am Ken and am new to this forum. I truly enjoying using Inkscape and helping all I can others.

    This short tutorial will cover how to find/create a center line path for any given shape. There could be several reasons for wanting to do this. One such reason could be to create path for text or aligning objects.

    After these written instructions I have included some short screen shots that may add clarity to the process.

    First some terms I use here. “Start and “end” are just that – the beginning and the end on the path. “Edge” means the boundary line that encompasses the shape.

    The essence of the process is to create a series of “edge” lines using the Bezier Curves Tool throughout the length of the shape.

    After that, you will use the Bezier Curves Tool to create a single, continuous line that connects each of the individual “edge” line from their middle to middle. And then, after that we will enable the Node Tool, choose each node within the single line and use the Make Selected Nodes Smooth option.

    This will result in a center line path within the original shape.

    So, step by step …

    1 – Enable the Snap to Paths Option.

    2 – Press B to select the Bezier Curves Tool. Use this tool to snap a straight line from one “edge” of the shape to another “edge” of the shape. Do not worry about the angle of the line. Just snap a line from one “edge” to the opposite “edge”.

    3 – Continue to use the Bezier Curves Tool, making a series on lines throughout the length of the shape. The more “edge” to “edge” line are made, the more accurate the end result will be.

    Also be sure to make an edge” to “edge” line for the Start and End portions of the original shape.

    4 - Next, enable the Snap Centers to Objects option.

    5 – From the “start” to the “end”, click the center of each “edge” to “edge” line, making a single, continuous line.

    6 – Be sure you have clicked onto that single continuous line you just made. Now press N or F2 to select the Node Tool.

    7 – Select all the nodes within that line. (Either a few at a time, or all them at once.)

    While these nodes are selected, choose the Make Selected Nodes Smooth option.

    8 – The center line path will now show as a single that is smooth.

    9 – Delete all the previously made “edge” to “edge” lines.

    SEE THE SCREEN SHOTS PROVIDED BELOW FOR ADDITIONAL CLARITY.

    Enjoy.

    Ken

  2. #2
    Hum Hum @Hum

    This is Ken again. I apologize. When I originally posted this topic, I included 8 images to support the text details. I guess I did not take into account the file limitations. So, not all images appeared with the first post.

    I have now included these same 8 images in 3 zipped files. You can see images 1 to 3 in the 1st zip file, images 4 to 6 in the 2nd zip file, and images 7 and 8 in the last zip file.

    Please excuse my goof and thank you.

    Ken

  3. #3
    Marco Riva Marco Riva @zerocinquanta

    Thank you!

  4. #4
    Hum Hum @Hum
    😉

    Thank you, Marco. Enjoy a great day.

  5. #5
    Hum Hum @Hum
    *

    Hi again. Here is a continuation of the idea above. (A variation of the original idea.)

    Instead of creating a center line within the shape, what if you wanted a "portion" centered within your shape, such as 1/3 ... that covered the entire shape length (no matter how curved or straight)?

    That "portion" would consist of 2 lines, a top line and a bottom line, that smoothly followed the curvature of your original shape. Such as 1/3.

    Or, instead of 1/3, what if you wanted any other "portion amount"? Such as 1/4, 1/5, 1/7, 1/8 ... you name it.

    Here is how this can be done. (See the attached graphic.)

    1 - After creating the "edge lines" as mentioned above, select all the edge lines.

    2 - Open the Transform Panel. Go to the Scale Tab and enable the Scale Proportionally option.

    In the Width field type 100 and then / and then the number you wish your "portion" to be. In this case 3.

    So, you would type 100/3 and then press the Apply button.

    Now all your "edge lines" will be 1/3 of their original sizes.

    3 - Press B to enable the Bezier Tool.

    Using this tool, click from end of each of the re-sized "edge lines" to the next "edge line", and keep on doing this ... making a single continuous line. This will be your "top portion" line.

    Do this again to make the "bottom portion" line. Go from one "edge line" to the next, making a single continuous line.

    4 - Select the "top portion" line and press N to access the Edit Path by Nodes Tool ...  then select all the nodes, and then choose either the Make selected nodes auto-smooth option, or select the Make selected nodes symmetrical option.

    Now do the same for the "bottom portion" line.

    You should now have 2 lines that are evenly spaced and that are the "desired distance" you wanted ... the "portion" you wanted to fit within your original shape.

    That is it.

    Enjoy this day. Do make something beautiful and useful.

    God bless you.

     

     

    Idea
  6. #6
    Hum Hum @Hum

    One more thing. This "technique" could be used to cut or divide shapes, or as another alternative to using Path > Inset or Path > Outset on your original shape.

    (Just as you used 100/3 in the Transform Panel, to reduce the desired "portion", you could make the "portion" larger by entering in the Transform Panel 100 * 3 ... or any other number you wish.)

  7. #7
    flywire flywire @flywire
    *

    How would you split an arbitrarily sized horizontal ellipse into top and bottom curves using this technique? I can't snap to the bounding box handles to draw the horizontal line to split the ellipse.

  8. #8
    Hum Hum @Hum
    *

    Hi, flywire.

    Since an ellipse (or circle) is already symmetrical, I would approach your request differently.

    One simple way is to add a stroke to the ellipse. Remove the fill. Select Edit path by Nodes tool. Select 2 opposite nodes, such as the leftmost and rightmost nodes that are horizontally across from one another. Then, while still in the Edit Nodes tool, choose the option "break paths at selected nodes" and then select F1 to select the ellipse again, and then Path > Break Apart. 

    This will result in 2 arcs, one above the other, a "top" one and a "bottom" one. (One arc looks like an upside down U and the other like a U.)

    You can use any nodes within the original ellipse (or add several nodes within the original ellipse), follow this process, and "break apart" the ellipse path into as many arcs as you wish.

    The key in your request is to choose the nodes and not the bounding box.

    (If your original ellipse does not have an existing node where you want it, press F2 for Edit Paths by Nodes tool, select 2 nodes, then the Insert new nodes into selected segments (has a plus sign+) to add a node that will be equidistant between those 2 nodes. Or, double click on the stroke where you want the new node to be, and it will be added to the ellipse.)

    Hope this helps.

Inkscape Inkscape.org Inkscape Forum Tips, Tricks, and Tutorials Tutorial - How To Make Center Line Path of a Shape