I'm using a Gear generator tool to draw a rack gear which I then plan to mill on my CNC machine. The Gear generator tool outputs the rack as an SVG file which I can open in Inkscape. For some reason the rack is made up of individual strokes (I assume they are strokes) overlapping but unconnected.
(I can't use the Inkscape gear extension because I can't define a matching circular gear and rack gear – don't ask me why).
I need to convert those strokes to a single connected bezier line.
I tried Path > Stroke To Path but that converts each stroke to a rectangle, defined by 4 nodes.
I can select all of those rectangles and connect them using Path > Union.
The problem is that the result is not a single bezier line, but an object with width. This means when I try to generate the CNC gcode I get a cut being made on each side of the rack, not on the outside only:
Can anyone suggest a method for getting from a series of unconnected but overlapping strokes, to a single bezier line with two end nodes?
Thanks!
How to convert a set of strokes to a single bezier line?
- [email protected]
- Posts: 9
- Joined: Tue Jul 05, 2016 6:30 am
How to convert a set of strokes to a single bezier line?
Steve - Shapeoko 3; Inkscape, MakerCAM, UGS, bCNC.
Software engineer professional; woodworker journeyman; CNC tyro;
Software engineer professional; woodworker journeyman; CNC tyro;
Re: How to convert a set of strokes to a single bezier line?
You can use the node tool to connect two nodes:
- Select both objects (holding Shift)
- switch to node tool
- select both nodes (holding Shift)
- click on 'Join selected nodes' button in the node tool's tool bar at the top.
- Select both objects (holding Shift)
- switch to node tool
- select both nodes (holding Shift)
- click on 'Join selected nodes' button in the node tool's tool bar at the top.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: How to convert a set of strokes to a single bezier line?
(You can also try if it works out correctly if you select all objects, then switch to node tool, select all nodes (Ctrl+A), then use the 'Join selected nodes' button - that's a bit faster
)

Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
- [email protected]
- Posts: 9
- Joined: Tue Jul 05, 2016 6:30 am
Re: How to convert a set of strokes to a single bezier line?
Thanks for the reply, Moini.
Unfortunately, that doesn't work. I know about using the node tool to connect nodes - either by adding a segment or replacing two nodes with one. In this cases, however, each individual segment is made up of 4 nodes - like a rectangle. I can select a node on one segment corner, and select another node on an adjacent segment corner. Inkscape refuses to connect them.
Look at it this way. Segment 1 is defined by nodes A,B,C,D. Segment 2 is defined by nodes E,F,G,H. I'm trying to connect node A to E. If successful, node A is now connected to E, B, & D. My understanding of bezier lines (possibly mistaken) is that each node can have at most two connections to other nodes. In this case I'd be trying to connect a third node, and I don't think that is allowed.
Unfortunately, that doesn't work. I know about using the node tool to connect nodes - either by adding a segment or replacing two nodes with one. In this cases, however, each individual segment is made up of 4 nodes - like a rectangle. I can select a node on one segment corner, and select another node on an adjacent segment corner. Inkscape refuses to connect them.
Look at it this way. Segment 1 is defined by nodes A,B,C,D. Segment 2 is defined by nodes E,F,G,H. I'm trying to connect node A to E. If successful, node A is now connected to E, B, & D. My understanding of bezier lines (possibly mistaken) is that each node can have at most two connections to other nodes. In this case I'd be trying to connect a third node, and I don't think that is allowed.
Steve - Shapeoko 3; Inkscape, MakerCAM, UGS, bCNC.
Software engineer professional; woodworker journeyman; CNC tyro;
Software engineer professional; woodworker journeyman; CNC tyro;
Re: How to convert a set of strokes to a single bezier line?
I believe the most answers you`re looking for are described in this part of the Manual.
Also, some interesting stuff might pop-up if you use centerline tracing as a key words for a web search.
Also, some interesting stuff might pop-up if you use centerline tracing as a key words for a web search.
Re: How to convert a set of strokes to a single bezier line?
Don't convert stroke to path before you try using the method I described.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
- [email protected]
- Posts: 9
- Joined: Tue Jul 05, 2016 6:30 am
Re: How to convert a set of strokes to a single bezier line?
Maestral -- thanks -- I read that section and it cleared up some of my confusion -- especially the difference between Object to Path and Stroke To Path. Centerline tracing may be the way to go, but I'm still hoping for an Inkscape solution.
Moini -- thanks also. When I import the original set of lines that form the rack, they show up as objects only. They do not have nodes. They really don't. The only way to get them to have nodes is to apply Object to Path. (I understand now Stroke to Path is a dead end).
Now I'm trying to apply your suggestion. I select the two end nodes on the two segments I want to join:
And then I apply "Join selected end nodes with a new segment". But I get this:
Not what I want. (Incidentally, if I draw two Bezier lines from scratch and apply the "Join" operation, everything works as expected; a new segment shows up joining the endpoints).
So I'm guessing these imported objects, whatever they are after I apply Object To path, are not standard Bezier lines. In fact, when I select one of the lines, I get a statement that I can drag it to make it a Bezier line. If I do that (of course destroying the position of the segment which is the whole freaking point of this exercise) -- THEN I can join the segments normally.
So is there some way to convert this "linear segment" (whatever the heck that is), to a Bezier line, without actually dragging the line?
Thanks for helping a noobie out. I really appreciate it.
Moini -- thanks also. When I import the original set of lines that form the rack, they show up as objects only. They do not have nodes. They really don't. The only way to get them to have nodes is to apply Object to Path. (I understand now Stroke to Path is a dead end).
Now I'm trying to apply your suggestion. I select the two end nodes on the two segments I want to join:
And then I apply "Join selected end nodes with a new segment". But I get this:
Not what I want. (Incidentally, if I draw two Bezier lines from scratch and apply the "Join" operation, everything works as expected; a new segment shows up joining the endpoints).
So I'm guessing these imported objects, whatever they are after I apply Object To path, are not standard Bezier lines. In fact, when I select one of the lines, I get a statement that I can drag it to make it a Bezier line. If I do that (of course destroying the position of the segment which is the whole freaking point of this exercise) -- THEN I can join the segments normally.
So is there some way to convert this "linear segment" (whatever the heck that is), to a Bezier line, without actually dragging the line?
Thanks for helping a noobie out. I really appreciate it.

Steve - Shapeoko 3; Inkscape, MakerCAM, UGS, bCNC.
Software engineer professional; woodworker journeyman; CNC tyro;
Software engineer professional; woodworker journeyman; CNC tyro;
Re: How to convert a set of strokes to a single bezier line?
rack2_2
You have fill enabled for that shape, that`s why it looks that way. Please, check the Manual for more info.
rack2_3
I can`t get that line on my status bar but, Bezier is more often a curve rather than a straight line. I`d try with another Ctrl+Shift+C to convert it to the path - or - if you need that segment to have some curvature, select the desired node/s and change their curvature from the top menu bar. (again, Manual, please .. ,)
Rock on and chime back if you stumble.
You have fill enabled for that shape, that`s why it looks that way. Please, check the Manual for more info.
rack2_3
I can`t get that line on my status bar but, Bezier is more often a curve rather than a straight line. I`d try with another Ctrl+Shift+C to convert it to the path - or - if you need that segment to have some curvature, select the desired node/s and change their curvature from the top menu bar. (again, Manual, please .. ,)
Rock on and chime back if you stumble.
Last edited by Maestral on Tue Aug 23, 2016 9:34 pm, edited 2 times in total.
Re: How to convert a set of strokes to a single bezier line?
If you don't want the additional segment inserted, try 'Join selected nodes', not "Join selected end nodes with a new segment".
As Maestral says, Object to Path is fine, you only need to remove the fill.
As Maestral says, Object to Path is fine, you only need to remove the fill.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
- [email protected]
- Posts: 9
- Joined: Tue Jul 05, 2016 6:30 am
Re: SOLVED -How to convert a set of strokes to a single bezier line?
Maestral -- I had never come across a Bezier line with the fill turned on and didn't even realize it was possible. It's a dimensionless line, for crying out loud. But that was a big source of my confusion. I promise to read the manual first next time.
Moini - your suggestions finally penetrated. The process is:
This results in what I want -- a single Bezier line with two endpoints forming the outine of the rack gear.
Thanks for all the help!
Moini - your suggestions finally penetrated. The process is:
- Select all lines
Path > Object to path
Select all paths
Switch to node editor (F2)
Deselect end points; leave rest selected
Join selected nodes
Turn fill off
This results in what I want -- a single Bezier line with two endpoints forming the outine of the rack gear.
Thanks for all the help!

Steve - Shapeoko 3; Inkscape, MakerCAM, UGS, bCNC.
Software engineer professional; woodworker journeyman; CNC tyro;
Software engineer professional; woodworker journeyman; CNC tyro;
Re: How to convert a set of strokes to a single bezier line?
Just to make it clear, as much as possible...
To draw a line, you use Pen or some other tool. As in math, a line is defined by two points - so, no room for fill there. But, from the tool`s POV, you are creating a shape which makes room for the fill.
In the Preferences, you may set the "default" behaviour of each tool or to let it keep last used settings (color, no color, width...)
To draw a line, you use Pen or some other tool. As in math, a line is defined by two points - so, no room for fill there. But, from the tool`s POV, you are creating a shape which makes room for the fill.
In the Preferences, you may set the "default" behaviour of each tool or to let it keep last used settings (color, no color, width...)
Re: How to convert a set of strokes to a single bezier line?
@[email protected] : Will you send us a picture of your final result? We're always curious to see what comes out of our forum help 

Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
- [email protected]
- Posts: 9
- Joined: Tue Jul 05, 2016 6:30 am
Re: How to convert a set of strokes to a single bezier line?
Surely!
Still a ways to go before I start milling gears, but I'll send a long a few images when I get there.
Still a ways to go before I start milling gears, but I'll send a long a few images when I get there.
Steve - Shapeoko 3; Inkscape, MakerCAM, UGS, bCNC.
Software engineer professional; woodworker journeyman; CNC tyro;
Software engineer professional; woodworker journeyman; CNC tyro;