Convert line segments to a path

Discuss SVG code, accessible via the XML Editor.
scott216
Posts: 18
Joined: Tue Aug 14, 2012 5:22 am

Convert line segments to a path

Postby scott216 » Thu Sep 19, 2013 12:38 pm

When using my laser cutter (fslaser.com) I create outlines in Sketchup, then export to a SVG file which I open in Inkscape. Then in Inkscape I can print to the laser cutter. The problem is sketchup creates everything in small line segments. So if I have a create a circle, I might have 48 small line segments that make up this circle. When my laser cutter goes to cut the circle out (and has to make multiple passes to get through the material) it cuts one small segment, then goes to the start of that segment and makes the second pass. Then it goes to the next line segment and and cuts it two time. If I created the circle in Inkscape, the laser cutter would go all the way around the circle as the first pass, then around again for the second pass. Is there a way in Inkscape to somehow join all the segments so it looks like one path or something to my laser printer? I'm not sure of "path" is the right terminology. Also, the circle is already grouped together, so grouping it doesn't help.

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Convert line segments to a path

Postby v1nce » Thu Sep 19, 2013 8:37 pm

Your problem is about circle only or all kind of segments ?
Do you have a sample svg ? (Maybe there are solutions before importing in inkscape)

scott216
Posts: 18
Joined: Tue Aug 14, 2012 5:22 am

Re: Convert line segments to a path

Postby scott216 » Thu Sep 19, 2013 9:28 pm

It's not just circles, it's everything. Attached is an example.
Attachments
drillguide.svg
Exported from sketchup
(44.39 KiB) Downloaded 502 times

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Convert line segments to a path

Postby tylerdurden » Thu Sep 19, 2013 10:15 pm

Any chance you version of SU can export a DXF?
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Convert line segments to a path

Postby Lazur » Thu Sep 19, 2013 11:01 pm

With a single circle a manual method would be by
combining all the segments (Ctrl+K) together, selecting all nodes,
connecting the unconnected segments,
pressing Ctrl++ to remove doubles,
then selecting again all the nodes and set them to curved ones.

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Convert line segments to a path

Postby v1nce » Thu Sep 19, 2013 11:07 pm

scott216 wrote:It's not just circles, it's everything. Attached is an example.


I meant the svg that comes out from sketchup

scott216
Posts: 18
Joined: Tue Aug 14, 2012 5:22 am

Re: Convert line segments to a path

Postby scott216 » Thu Sep 19, 2013 11:27 pm

tylerdurden wrote:Any chance you version of SU can export a DXF?


No, I'm using the free version and I haven't found a plug-in that will do this.

scott216
Posts: 18
Joined: Tue Aug 14, 2012 5:22 am

Re: Convert line segments to a path

Postby scott216 » Fri Sep 20, 2013 12:08 am

Lazur URH wrote:With a single circle a manual method would be by
combining all the segments (Ctrl+K) together, selecting all nodes,
connecting the unconnected segments,
pressing Ctrl++ to remove doubles,
then selecting again all the nodes and set them to curved ones.


I tried ctrl+k and it joined all the segments. Then I tried the laser cutter and it didn't help. I know you have more steps, but I'm having trouble following them. When I press ctrl and the += key, nothing happens. When I press ctrl and the + key on the numeric keypad it deletes the selected objects. So I'm not sure how to remove the doubles. Also in the last step how do I convert all the nodes to curves?

I have tried using ctrl+shift+c to convert to path, but this hasn't worked on anything so far. Inkscape says there are no objects to convert to path when I try.

scott216
Posts: 18
Joined: Tue Aug 14, 2012 5:22 am

Re: Convert line segments to a path

Postby scott216 » Fri Sep 20, 2013 12:59 am

I made some progress

If I do this:
ungroup
combine
stroke to path
simplify

Then my laser cutter software no longer sees a bunch of small segments (polylines is what the laser software calls them). Instead it sees just two. So when cutting a circle that needs two passes, it will go all the way around once, then around again. But the what's strange is then it goes around again the opposite way and again the opposite way. So if I tell it to make two passes, it's actually making 4. It's as if there are two circles superimposed on one another. So this is better, but not quite right.

Attached are a few files:
shape test 1.svg - output from Sketchup. Twelve sided circle
shape test 2.svg - file after making changes: ungroup > combine > stroke to path > simplify
Laser Screenshot 1.png - screenshot of what laser software sees from shape test 2.svg

The goal would be for there to be just one polyline (that's the laser software terminology). This would make the laser cut a circle in one continuous motion.
Attachments
Laser Screenshot 1.PNG
Laser software screenshot of shape test 2.svg
Laser Screenshot 1.PNG (124.9 KiB) Viewed 18421 times
shape test 2.svg
Combined segments
(3.55 KiB) Downloaded 326 times
shape test 1.svg
Output from sketchup
(4.23 KiB) Downloaded 311 times

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Convert line segments to a path

Postby Lazur » Fri Sep 20, 2013 1:22 am

Here is how that method works, step by step.
Attachments
hlp76.svg
(195.66 KiB) Downloaded 560 times

scott216
Posts: 18
Joined: Tue Aug 14, 2012 5:22 am

Re: Convert line segments to a path

Postby scott216 » Fri Sep 20, 2013 3:19 am

Lazur URH wrote:Here is how that method works, step by step.


Thanks, that helps. I'm not sure I'm doing it quite the same way though.

After I combine with ctrl+k. I then selected the "Edit paths by node" tool. Then I selected everything and clicked on the Join Selected Nodes Icon. Then the status at the bottom said there were 12 nodes in Layer 1.
Inkscape join nodes.PNG
Join Selected Nodes Icon
Inkscape join nodes.PNG (46.54 KiB) Viewed 18397 times


In you're example, after combining with ctrl+k, you say to "select all nodes and and the click the right icon" I don't know what you mean by clicking on the right icon.

Also in your last step you say select all nodes and set them curved. I tried using the tool "Make Selected Segments Curves" but that didn't see to do anything. It did change the segments so they could be curved if you did it manually, but they didn't automatically turn into a nice round circle. Or was that something you did manually?

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Convert line segments to a path

Postby Lazur » Fri Sep 20, 2013 3:34 am

I was meaning these:
Inkscape join nodes.PNG
Inkscape join nodes.PNG (43.29 KiB) Viewed 18395 times


The first one to connect unconnected nodes, and the second to make them curved.

scott216
Posts: 18
Joined: Tue Aug 14, 2012 5:22 am

Re: Convert line segments to a path

Postby scott216 » Fri Sep 20, 2013 9:05 am

This was a big help. I tried both the "Join Selected Nodes" and "Join selected endnodes with a new segment" and both convert it into one path for my laser printer.

Now I just need to see if there is a way I can run a macro or something to automate it.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Convert line segments to a path

Postby Lazur » Fri Sep 20, 2013 9:29 am

You can use this method on all objects together except for the Ctrl++ part.
So if you don't want any cusp nodes,
select all objects,
combine them together,
select all nodes and connect all unconnected ones.
Than break the path apart (Ctrl+Shift+K),
select each path alone and press Ctrl++ for each,
then combine the paths together, and set nodes to curved ones.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Convert line segments to a path

Postby tylerdurden » Sun Sep 22, 2013 1:49 am

This free CAD was just released.
http://www.designspark.com/eng/page/mechanical

It will open the skp files and output DXF that have true arcs and circles.
Image

I might suggest this over using Sketchup for CAD.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

korallski
Posts: 1
Joined: Fri Mar 13, 2015 10:15 pm

Re: Convert line segments to a path

Postby korallski » Fri Mar 13, 2015 10:18 pm

as long time sketchup user i have the same problem. i installed Designspark Mechanical and i like it, im pretty sure i will have use for it in the future but i couldnt find how to convert the arcs of sketchup into real arcs.
anybody got a tip?

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Convert line segments to a path

Postby tylerdurden » Sat Mar 14, 2015 1:17 am

Unless you have SU-Pro, converting to arcs requires some fiddling. In DSM (DesignSpark Mechanical), you might need to replace the segmented arcs from SU with true arcs made by DSM. Not too difficult with 3-point arc tool, but if you have a lot of arcs, it could be a chore (but maybe easier then in Inkscape).
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

scott216
Posts: 18
Joined: Tue Aug 14, 2012 5:22 am

Re: Convert line segments to a path

Postby scott216 » Sat Mar 14, 2015 1:23 am

tylerdurden wrote:Unless you have SU-Pro, converting to arcs requires some fiddling.


How do you do it in SketchUp Pro?

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Convert line segments to a path

Postby tylerdurden » Sat Mar 14, 2015 5:00 am

Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/


Return to “SVG / XML Code”