Converting Splines to Lines and Arcs

      CNC control software can understand lines and arcs, but not splines. Here's advice on how to convert information into useable form. June 28, 2010

I am trying to burn out metal with our new CNC plasma table. I have converted a raster stencil like image to a vector using Inkscape. I then try to open the .dxf in nesting software. My computer says cannot read splines. I am familiar with what splines are. How do I get my CNC to do what I want it to do?

Forum Responses
(CNC Forum)
From contributor K:
Splines are S shaped curves. You will probably have to replace all splines with arcs.

From contributor M:
Check out WinTopo. Set properly it works pretty well.

From the original questioner:
Is there a quick way to convert all splines to arcs?

From contributor M:
Depends on what program you are using. Splines are by their nature a dynamic entity. That means they can change their shape depending on the location of their vertices and the parameters like endpoint direction angles. CNC machines are set up to understand setting toolpaths to lines or arcs, but not splines. Alpha Cam for example converts them easily. I don't use Master Cam, but I can't imagine it isn't in there too. Those are probably the two most widely used CNC CAM packages, they are both excellent.

AutoCad allows you to convert a spline to a polyline too. Rhino does as well. I am almost certain that Vellum converts. These are all examples of programs that primarily create geometry. They use vectors - that is lines and arcs and surfaces and solids. Seems that you are starting with a raster file, right? Raster essentially means a collection of points with color and location assigned to them. Examples are bitmaps jpegs, GIF and TIFF. Cameras use raster images, and TVs use more complicated ones.

You can proceed in two ways easily. One is to convert your raster image directly to real vectors, that is don't get involved with splines. There are a hundred programs out there that will do that, possibly even Inkscape, but I have no experience with it. WinTopo will take say a jpeg and convert it to vectors with very little effort. There is a free version available which is pretty powerful and easy to use. Get the settings just right and it is pretty powerful too. The paid for version has even more bells and whistles and is pretty cheap. Again there are a lot of them out there. These programs recognize the borders between sets of point attributes, like light and dark and create vectors along these borders. You can adjust the sensitivity of recognition and well as the "fineness" or scale of the vectors created.

Another way is to use the vector file you have including splines, and as you say convert the splines to lines and arcs. AutoCad (free trial for one month is available), Alphacam, MasterCam, Rhino (a free trial version of this excellent program is also available). All of these have help menus to explain how to convert the splines to lines and arcs. In AutoCad 2010 for example, import the DXF, then _u SPLINEDIT then use the convert to Polyline option.

What software do you have at your fingertips besides Inkscape? I just looked over the Inkscape website and I bet you could avoid the splines altogether just with Inkscape.

From the original questioner:
Thanks for the extremely helpful post. Iíve learned a lot from it. The other night I downloaded magic tracer. It converts rasters to vectors and during this conversion it will ask you what you want to use - splines, arcs, or lines. One thing I donít quite understand is a poly line. I was able to get a .dwg and a .dxf image produced. I have yet to see if it will work in our cam program.

From contributor M:
A polyline is simply a group of lines and arcs with common endpoints, all connected together into one object. In other words, join together a group of 4 lines all equal length at their ends and you can have a closed polyline in the shape of a square. Join a line with a half circle and you can have an open polyline in the shape of a cane. I don't know Magic Tracer, but it seems to be asking you the right questions, and it will likely give you what you are after.

From the original questioner:
Magic Tracer is doing everything I need it to. Though you are not familiar with the program you probably are with these terms. Can you help with the difference of these and how they affect the finished product? After clicking on vector convert it brings me to a contour detection window. Within this there are four options: none, linear edge detection, non linear edge detection, and contour detection. Rather than wasting material, knowing what these mean will help me make the best vector possible for the burn table.

After choosing a contour detection it then brings me to the vector conversion window. Here I know to shut off curve detection because this is like a spline correct? Iím not sure if itís my burn table or cam software that doesnít like these. At this vector conversion window I can produce a vector using lines and arcs instead of curves or splines. Please correct me if there is a difference between a curve and spline. After the vector is created I go to file, save vector file, then choose dxf. In this window I can save curves as lines, b-spline curves, or bezier curves.

What is the difference of the two curves? I can also choose to save lines as two point lines, polylines, or light weight poly lines. I understand what a poly line is but how about the other two? I imagine because I shut off the curves option when converting to a vector that save curves as (lines, b-spline curves, and bezier curves) has no affect when saving the dxf but I do think how I save the lines will change the finished product.

From contributor M:
I took a look at Inkscape, it is pretty neat for drawing random shapes. It seems to work with vectors, not rasters, and it seems to encode all of the information as splines or bessier curves. I haven't figured out how to output the curves directly as a DXF consisting of lines and arcs, but I would post the question to the developers. I bet there is a simple way to do it.

I can't tell you how your particular program uses the terms none, linear edge detection, non linear edge detection, and contour detection. Apart from context they may be used in different ways in different programs, experimentation may be best here. Incidentally, you can run programs in air and learn a lot, or with plasma you may have the ability to run a low power trace, leaving a faint mark without cutting anything. In either case these have to do with converting the raster to a vector and the way borders are recognized.

Yes, use lines and arcs. Most good cam packages utilize the splines or curves just fine, but really the post processor and controllers are set up for lines and arcs. When you output the geometry for use it should just be lines and arcs connected together into polylines.

Strictly speaking, for flat 2-D space (which is what we are talking about here) a line is defined by two points. It's just the shortest distance between them. An arc is a portion of a circle that is a point representing the center and a distance from that center. It is not a piece of an ellipse or a part of a French curve, but just the collection of points equidistant from the center of a circle or a portion thereof.

Splines, B-splines, bessier curves, etc, are all well defined mathematical constructs, but they are much more complex. They contain information that in principle cannot be easily conveyed to your controller. To utilize them for creating geometry is fine, even elegant at times, but before making shapes from them on a CNC you need to approximate them by representing them as a collection of lines and arcs connected into a polyline. This is not as bad as it sounds, because the accuracy to which you approximate the curve is arbitrary, and all you have to do is ask the computer to do it for you. In Alphacam there is a command that says literally "convert splines to lines/arcs." Lastly a line or polyline has no thickness or width in a purely mathematical sense. Your graphics program may interpret a "lineweight polyline" as just a polyline having width.

The comments below were added after this Forum discussion was archived as a Knowledge Base article (add your comment).

Comment from contributor C:
Convert your spline to a polyline using the pedit command. The pedit command will ask for your accuracy when it converts to a polyline. Once your spline is a polyline use the explode command to turn it to line and arcs. Normally the explode command is set to a system default of just line segments. You can change the default set to line and arcs by typing in ďplineconvertmodeĒ. It will then ask for a number 1 or 0. 1 will change the default to lines and arcs. 0 will make only line segments. Note: If the accuracy is too small when you convert to a polyline you will only get line segments.

Would you like to add information to this article?
Interested in writing or submitting an article?
Have a question about this article?

Have you reviewed the related Knowledge Base areas below?
  • KnowledgeBase: Knowledge Base

  • KnowledgeBase: Computerization

  • KnowledgeBase: Computerization: CNC Machinery and Techniques

    Would you like to add information to this article? ... Click Here

    If you have a question regarding a Knowledge Base article, your best chance at uncovering an answer is to search the entire Knowledge Base for related articles or to post your question at the appropriate WOODWEB Forum. Before posting your message, be sure to
    review our Forum Guidelines.

    Questions entered in the Knowledge Base Article comment form will not generate responses! A list of WOODWEB Forums can be found at WOODWEB's Site Map.

    When you post your question at the Forum, be sure to include references to the Knowledge Base article that inspired your question. The more information you provide with your question, the better your chances are of receiving responses.

    Return to beginning of article.

    Refer a Friend || Read This Important Information || Site Map || Privacy Policy || Site User Agreement

    Letters, questions or comments? E-Mail us and let us know what you think. Be sure to review our Frequently Asked Questions page.

    Contact us to discuss advertising or to report problems with this site.

    To report a problem, send an e-mail to our Webmaster

    Copyright © 1996-2016 - WOODWEB ® Inc.
    All rights reserved. No part of this publication may be reproduced in any manner without permission of the Editor.
    Review WOODWEB's Copyright Policy.

    The editors, writers, and staff at WOODWEB try to promote safe practices. What is safe for one woodworker under certain conditions may not be safe for others in different circumstances. Readers should undertake the use of materials and methods discussed at WOODWEB after considerate evaluation, and at their own risk.

    WOODWEB, Inc.
    335 Bedell Road
    Montrose, PA 18801

    Contact WOODWEB

  • WOODWEB - the leading resource for professional woodworkers

      Home » Knowledge Base » Knowledge Base Article