Inkscape .dxf problem

Post about using Inkscape with cutters or plotters.
EricD
Posts: 5
Joined: Thu May 10, 2012 11:42 am

Inkscape .dxf problem

Postby EricD » Thu May 10, 2012 12:14 pm

Hi all.

I built my first CNC Router cutter about 6 weeks ago and have been playing around with it trying to learn how to use it. I have been able to figure out a few things but I am stuck on converting a png to a useful dxf file for engraving/cutting. I am using Vista, Inkscape 0.48, CamBam.

I open the png file in Insckape, trace it and save it as dxf but when I open it in CamBam I get double lines no matter what I try. I tried fill and stroke together, fill no stroke, stroke no fill. I tried saving as svg first then save as dxf but I get the save result every time.

This is the png image I am trying to convert to dxf.

yogi.png
yogi.png (67.68 KiB) Viewed 15429 times


This is what I get.

CamBam_Double_Line.jpg
CamBam_Double_Line.jpg (127.42 KiB) Viewed 15429 times


Can anyone help please.

Thanks in advance.

Eric

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

Re: Inkscape .dxf problem

Postby brynn » Fri May 11, 2012 1:49 am

Image
Welcome Eric!

The "CNC Router cutter" cuts wood, right? Not that it matters really, I guess, just curious :D
And CamBam is the software for the router? You used Inkscape's Trace Bitmap to convert to SVG and/or DXF?

if so, then yes, that's just how Trace Bitmap works. You'll have to find some other technique to convert the PNGs. And honestly, I'm not sure how folks manage this, but I can think of a couple of things.

1) One would be to Import the PNG, and then use Inkscape's Pen or Pencil tool to trace over the lines "by hand". You could have the PNG in a separate layer, and reduce the opacity, if that would make it easier to trace. When you're finished, you could hide the layer altogether. That way the original PNG stays in the same file, in case you should ever need it again (perhaps to edit the SVG/DXF later or something).

2) Another way would be to find images that are already SVG/DXF. There's a huge amount of those available for free at Open Clipart Library. And you could find many websites that sell packages of SVG or maybe even cutter sites that sell DXFs.

3) There may be a trace engine, somewhere, that will do an acceptable centerline trace. I know about this one http://www.roitsystems.com/cgi-bin/autotrace/tracer.pl which does have a centerline trace option, and produces a single path result. But it's probably not going to work for this image. It's hard to describe why, but it seems to make.....not necessarily illogical choices about where to break paths and start new ones....it's more the paths themselves do not stay true to the image. Sharp corners get rounded, lines don't always touch each other where they should, curves may be distorted. You'll just have to try it, to understand what I mean. And there truly are a lot of variables that you can tweak, so you might be able to achieve something acceptable, after much trial and error.

(I really should do a search to find some other trace engines. It might be helpful to have some idea of strengths and weaknesses of different ones.)

Anyway, I have been thinking of a rather ugly way to use the trace result from the original PNG, but I haven't actually tried it, and have no idea whether it might work. It probably would not work, actually. But I've been wondering if you could use the original "double lines" produced from Trace Bitmap, and apply Extensions > Generate from path > Interpolate. Set the interpolation steps for.....hhmmm.....let me do some experimenting, and I'll let you know what I learn. Be back shortly :D

Edit
Ok no, Interpolate does not work at all for this! It might, if you just had a very simple original drawing, with only 2 subpaths in the trace result. In yours, you really have several to many subpaths. But the first 2 options I mentioned really have a good chance for success. The 3rd is a maybe :D

EricD
Posts: 5
Joined: Thu May 10, 2012 11:42 am

Re: Inkscape .dxf problem

Postby EricD » Fri May 11, 2012 4:27 am

Hi brynn, thank you very much for taking the time to reply and try out interpolate for me, really appreciate it.

With a CNC Router you can cut and engrave wood as well as soft metals such as aluminium, brass etc. if you have the cutting tools for them and a strong enough built CNC and a somewhat powerful router. I am using a 400watt edge trimmer and that would be able to cut the metals mentioned above but at reduced speeds. My CNC is made out of wood and MDF so I would have to cut slowly otherwise it'd probably just fall apart. But wood I can cut at full speed at around 600 to 800mm a minute. It looks ugly but works and as a hobbyist I really don't need any more than that.

CamBam is a sofware that converts dxf files into GCode but does not control the CNC, for that I use Linuxcnc. Ohers use Mach3 but that's a little too expensive for a hobbyist like myself whereas Linuxcnc is opensource and completely free to use. The problem with that though is that it runs on Ubuntu only which means that you either need a dual boot PC or a second PC to run it on.

I tried tracing by hand but curves weren't curves any more and straight lines looked like a worm, just don't have that steady hand for it I guess but I'll keep on practicing and maybe I'll get it right one day.

I did download a program called "Image2cad" which does trace centre lines but it looked uglier than my hand tracing so I gave up on it. I'll have to search around and see if I can find a better one or find a way of cleaning it up in CamBam.

I did download some dxf files from the internet and engraved them for my dragon mad son but no one has that image I posted in my OP. It's "yogi", mascot of the unit I served with back in the 70's and wanted to make a plaque for a few of the guys I served with at the time. There are also a few other images that I wanted to engrave but have not been able to till now.

Here are a few of the things that I have managed to do:

The dxf for the gragon I downloaded form the internet, engraved it in to plexiglass and filled it with acrylic paint. The other two are my grankids which were converted to GCode by the built in "Image-to-Gcode" converter in Linuxcnc and then also cut using Linuxcnc. They are definitely not 100% but I'm still new to the CNC world and still have a lot to learn.
Attachments
Image00003.jpg
Image00003.jpg (39.32 KiB) Viewed 15400 times
Image00002.jpg
Image00002.jpg (47.02 KiB) Viewed 15400 times
Image00001.jpg
Image00001.jpg (42.67 KiB) Viewed 15400 times

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

Re: Inkscape .dxf problem

Postby brynn » Fri May 11, 2012 8:13 am

You're welcome :D
Here are some tips for tracing by hand. Using the Pen tool, this is what works best for me. It is possible to control the Bezier curves "on the fly" using click + drag, but I have not found the proper mouse control to do that well. I keep my Pen tool in Straight Line mode. On a line drawing like the one you showed here, I place nodes (single click) at the apex of curves, the peaks and troughs. Then wherever I need curves, I select the nodes (all at once) and change them to smooth nodes. That will automatically make smooth curves. If you have sharp corners, like the claws on the lion or the tip of the sword, be sure not to select those, to keep them sharp. (If I'm tracing something out of something like a photo, I find it better to place many nodes, still in the peaks and troughs, but in something like a photo, it requires more nodes, and really looks better that way.) If you do need to tweak it further, you can adjust the node handles with the Node tool.

With the Pencil tool, I recently found the Smoothing slider on the control bar. If I set it at 50 or higher, I can achieve some pretty smooth lines and curves. Use it in Bezier mode with Shape: None. I still prefer the Pen tool, but the more I practice with the Pencil, I suspect the better I will get.

Well, good luck! Maybe someone else will have some better ideas :D

EricD
Posts: 5
Joined: Thu May 10, 2012 11:42 am

Re: Inkscape .dxf problem

Postby EricD » Sat May 12, 2012 11:50 am

Following your advise I gave it another try last night with the pen/pencil tools but that didn't work for me. I then tried it with the Bezier tool (Shape = None) setting nodes at about every 2-3 milimeters, it turned out pretty good but took quite a while to finish.

Thanks again for your help brynn.

yogi-2.jpg
yogi-2.jpg (32.34 KiB) Viewed 15375 times


Engraved on softwood.

P1010312.jpg
P1010312.jpg (61.49 KiB) Viewed 15375 times

Kento
Posts: 50
Joined: Wed Jan 19, 2011 6:19 am

Re: Inkscape .dxf problem

Postby Kento » Sat May 12, 2012 12:58 pm

Hi EricD lovely work, like you I would like to build a cnc router cutter to learn & pratice & eventually build a 4 axis machine as there some project I have in mind. I guess that you may be pass this stage akready but the following may be of interest to you : http://rainbowlazer.com/ & http://rainbowlazer.com/scripting-progr ... materials/ I found these during my research on building Cnc routers. BTW what kind of machine you've built, is it a 3 axis & if you don't mind how much did it cost you to build? Like you I need to build a machine very cheaply. Your dragon reminds me of a file for an aztec which someone an other forum cut on their cnc router would you be interested in it?

EricD
Posts: 5
Joined: Thu May 10, 2012 11:42 am

Re: Inkscape .dxf problem

Postby EricD » Sat May 12, 2012 9:40 pm

Hi Kento, thanks for the links and yes I would be very interested in the dragon file you mentioned please.

I've only been CNCing for about 3 months now, including building it, and not passed any stage yet, still have a huge amount to learn.

Originally I only wanted to build a small one for making PCBs but the more I found out what you can do with a CNC the more I got fascinated by it and ended up building a bigger one in the end. Actually, I build 3, first one was too big and not very good. The second was a lot better and just the right size but then we found out we have to move house (long story) so I took it apart and made a smaller one. It don't look pretty but it works andrews the job done.

You can see it here if you want. [url]ericd-cnc.blogspot.com[/

I've done some improvements on it but haven't updated the blog for a while. I'm not using a smaller router now, the one in the pics was too big and too heavy for the small machine. Also had to build a new 34v power supply as one of the ATX PSUs I was using blew up and I was running on 12V only.

I had most of the stuff I needed already so only had to buy the steppers, driver board and a few other bits and pieces, the total cost was around £120 (GBP) so didn't break the bank. Even the wife likes it now and gave me permission to spend more money on buying some cutting/engraving tools. lol

Thanks

Eric

Kento
Posts: 50
Joined: Wed Jan 19, 2011 6:19 am

Re: Inkscape .dxf problem

Postby Kento » Sun May 13, 2012 3:16 am

Hi EricD I will not be able to send you the file here as it is in eps format however the following is where I got the file: re: http://www.vinylforum.org/smf/show-your ... w-project/ please check page 3 re: reply #31 check out the site there & you will find the file, all the best.

EricD
Posts: 5
Joined: Thu May 10, 2012 11:42 am

Re: Inkscape .dxf problem

Postby EricD » Sun May 13, 2012 10:47 pm

Oh boy, I have never been classed as a "spammer" before but the vinyl forum has just announced me as one. :o and will not let me register. :cry:

I can't even open the guys webpage!

Kento, any idea how I can contact the forums admin please?

Thanks

ChrisS
Posts: 1
Joined: Wed Dec 12, 2012 1:02 am

Re: Inkscape .dxf problem

Postby ChrisS » Wed Dec 12, 2012 1:18 am

I came across this old post looking for something else but...

The original image is 24-bit (16.7 million colors and 256 unique colors). If you load it into Inkscape, click "Trace Bitmap" and use the option "Color Quantization" with a value of "2" then you'll get much, much better results (it looks perfect to me). You may need to click "invert image" as well. If you use scanned images (or other B&W images) always use a color depth of 2, otherwise you'll get vectors for black, near black, almost black, and so on.

Your double lines probably result from selecting "edge detection" which will locate both edges of the line. That can be useful if you want to have the line raised but it's not what you're looking for in this case.

Sorry for being late for the post.


Return to “Inkscape & Cutters/Plotters”