Jump to content
spiderartist

Bezier curves vs. segmented curves

Recommended Posts

spiderartist

I am looking for an explanation between smooth "bezier" curves and the curved shapes comprised of short straight lines. Thanks.

Share this post


Link to post
Share on other sites
spiderartist

I guess I'm looking for the difference between the two in their creation and application, especially when using CNC. When I receive files for laser cutting that are bezier shapes, they cut smoothly. However, often when I receive files (dxf) that are segmented, they cut in a jerky fashion and not as smooth. Upon magnification, the bezier shapes are curves but the other ones are comprised of short, straight segments. How do I instruct my clients to produce the smooth curves in their CAD software?

Share this post


Link to post
Share on other sites
SEANT

Quite possibly, the short segmented curve was originally an AutoCAD Spline (Nurbs curve) that the was converted to a polyline. Many CAM packages do not support interpolated curve entities, Nurbs or Beziers, thus AutoCAD users tend to supply curve types with which they have had previous success.

 

It sounds like your setup can handle Beziers, at least: Does it offer any conversion Nurbs/Spline to Beziers? If so, tell the customers to leave the curves as splines, and you will deal with them on your end.

 

Get back to us. I'd be interested to know if your setup does allow for the conversion. An add-in is possible that would allow AutoCAD to reproduce the curves as Beziers.

Share this post


Link to post
Share on other sites
lrm
I am looking for an explanation between smooth "bezier" curves and the curved shapes comprised of short straight lines. Thanks.

 

If you convert a polyline to a spline using the PEDIT S option you are creating a curve known as a B-spline. A B-spline can be considered as a series of Bezier splines connected end to end. Both Bezier and B-spline splines are defined in the database by their Control Vertices (CV’s) not the points through which they pass when created in AutoCAD. A Bezier spline is an nth ordered polynomial. If you convert a polyline created with 4 CV’s in AutoCAD to a spline you will get a 3rd ordered Bezier spline. A major difference of a B-spline and a Bezier spline is that you can do some local editing of a B-spline without affecting the total B-spline. Bezier and B-spline splines are smooth curves but for display and toolpath purposes are evaluated as small straight segments. You can see the precision to which they are evaluated on polyline splines by changing the splinsegs value (the default is 8).

 

In reality, a CNC tool is approximating all smooth curves as a series of straight segments. Some machine tools can use a smooth spline as input and determine appropriate spline evaluation parameters (similar to splinesegs) to generate segments as small as necessary to yield a curve that is smooth enough. If a “segmented curve” is given to the machine tool then it must use the segments it is given and cannot calculate a finer approximation.

 

NURBS are a more sophisticated type of curve than B-splines that provide additional benefits such as the ability to exactly represent an arc, contain sharp corners, straight segments, and other features.

~Lee

 

splines.PNG

Share this post


Link to post
Share on other sites
spiderartist

My machine works fine with curves created in vector illustration software, such as CorelDraw or Adobe Illustrator. Sometimes when I import a dxf file into either program, it works fine and sometimes it doesn't. I would love to find out what to tell clients with files created in CAD software how to prepare them before sending them to me so that it eliminates the problems.

Share this post


Link to post
Share on other sites
spiderartist

This is more illuminating about the distinctions in terminology that I'm not familiar with since I'm using vector illustration software to design for the CNC machine. If I understand you correctly, any curved vector line sent to a CNC machine is interpreted as tiny straight segments when it cuts the shape, regardless of how many or few points/nodes are on the curve, yes? My objective is to import dxf/dwg files that are ready to cut smoothly without my having to re-draw them in my illustration software.

Share this post


Link to post
Share on other sites
SEANT

As a test, what shows up in your CAM software after importing this file?

SplineConversion.dxf

SplineBezier.jpg

Share this post


Link to post
Share on other sites
lrm
... If I understand you correctly, any curved vector line sent to a CNC machine is interpreted as tiny straight segments when it cuts the shape, regardless of how many or few points/nodes are on the curve, yes? ...

 

Yes. At a very basic level a machine tool drives the cutter from one location to the next location in a straight line. Those two locations may be calculated from smooth curves that may be defined mathematically in a variety of ways including, Bezier, B-spline, NURBS, or from a definition of an arc (center, radius, start angle, end angle for example).

I believe Adobe Illustrator uses Bezier splines. When you manipulate a direction line in Illustrator you are actually changing the location of one of the Bezier spline’s control vertices (CVs).

 

http://www.dummies.com/how-to/content/how-to-create-a-curve-using-adobe-cs5-illustrator.html

 

I created two splines in AutoCAD. One of them I used the convert polyline to spline technique and for the other I used the spline command. Thus, the first is a B-spline and the second is a NURBS spline. I then created a dxf file. The dxf file outputs the chords of the B-spline. For example,

 

...  (a portion of the DXF file)
AcDbVertex
100
AcDb2dVertex
10
4.330213794252784
20
20.04452757003263
30
Etc.

 

The ends of each chord approximating the smooth curve are define with vertex statements.

 

For the “spline” splines (NURBS), DXF outputs the CVs of the NURBS Spline. For example,

...
AcDbSpline
210  (210 refers to the normal vector of the plane, in this case 0,0,1
0.0
220
0.0
230
1.0
70

…
10      (this is the first CV)
4.330213794252784
20
10.06624276901642
30
0.0
10   (this is the 2nd CV)
7.195453161635128
20
16.82283924633528
30
0.0
10
12.92593200081521
20
16.73334787835272
30
0.0

 

I suspect your post-processor doesn’t know how to handle AutoCAD NURBS splines and requires the explicit x,y,z coordinates of each chord of the spline.

 

Lee

Share this post


Link to post
Share on other sites
scj

Sometimes ago I got the request for changing a SPLINE into a LWPOLYLINE consisting of tangential ARCs considering a given tolerance.

So I suppose NC-machines can handle LWPOLYLINES more easy than SPLINES.

Regards

Jochen

spl2arcs.dwg

Share this post


Link to post
Share on other sites
lrm

We need to think of AutoCAD as having two type of splines, “old” splines and “new” splines. An old spline is created by using the spline option with a polyline (PEDIT S). A “new” spline is created with the SPLINE command. The old splines are mathematically known as B-splines and the new splines are NURBS (non-uniform rational B-splines).

 

The red spline in your drawing is a new spline. Your goal is to make an old spline from a new spline. To do this we need to know the location of the Control Vertices (CVs) of the new spline.

 

To see the location of the CVs select the spline and click the pull-down (red down arrow).

s1.png

Note that Fit is checked. This was the method used to define the spline.

 

Change the method to Control Vertices and you should see something like this.

s2.png

 

We now want to create a LWPolyline using these 7 CVs. I do not know a method for using OSNAP to access the CV’s so we can use the LIST command to get the CV coordinates.

 

Command: LIST

Select objects: 1 found
Select objects:

                 SPLINE    Layer: "SPLINE"
                           Space: Model space
                  Handle = 1b0
                          Length: 3065.2641
                           Order: 4
                      Properties: Planar, Non-Rational, Non-Periodic
                Parametric Range: Start   0.0000
                                    End2970.0202
        Number of control points: 7
                  Control Points: X = 541.6263 , Y = 768.4563 , Z = 0.0000
                                  X = 621.0883 , Y = 1130.7741, Z = 0.0000
                                  X = 803.7368 , Y = 1963.5846, Z = 0.0000
                                  X = 1615.7148, Y = 263.7842 , Z = 0.0000
                                  X = 2083.8971, Y = 1586.3669, Z = 0.0000
                                  X = 2443.1443, Y = 1280.3963, Z = 0.0000
                                  X = 2561.1183, Y = 1179.9179, Z = 0.0000

You can type these coordinates in to create the polyline or use notepad to create a script. I created a script file that looked like this.

 

pline
541.6263,768.4563
621.0883,1130.7741
803.7368,1963.5846
1615.7148,263.7842
2083.8971,1586.3669
2443.1443,1280.3963
2561.1183,1179.9179

 

The file is a text file but has the extension .scr. The file starts with the pline command. Make sure there are no blank characters and that there are two blank lines at the end of the file so the pline command will terminate. Use the SCRIPT command to create the polyline. You should see something like this.

s3.PNG

 

Using PEDIT with the S option will convert the polyline to a spline and will look something like this.

s4.PNG

 

 

Notice that there is a difference between the two splines. This is because some of the NURBS parameter values (not the location of the CV values) used in the creation of the new spline (red) are not compatible with the pline spline. The slope at the beginning at end of the spline should be good. We can fudge the shape of our pline spline to better approximate the orginal by moving some of the CVs (but not the first two or the last two). For example, moving the 4th CV up a bit will provide a closer match between the two splines.

s5.PNG

 

 

s6.PNG

 

Here is the final result.

s7.PNG

 

Your CNC machine should be able to handle this “old” spline. Delete the original red spline and check it out.

Note, fi you would rather not go through the hassle of creating a script file you could just create a polyline of where you think the CVs should be. You can use OSNAP END for the start and end of the polyline. Note that the location of the second CV defines the slope of the spline at the beginning. Its distance from the spline start defines the radius of curvature at the start. Take a guess where the other CVs are and then modify their location as needed. With a little practice you will get a good feel for where the CVs need to be.

 

Good luck.

Lee

spl2arcs-lee.dwg

Share this post


Link to post
Share on other sites
spiderartist
As a test, what shows up in your CAM software after importing this file?

 

I will check it out and let you know.

Share this post


Link to post
Share on other sites
SEANT

Even if the processing software balks at the format, try importing to your illustration software. This is what I get when importing to CorelDraw 12.

 

The curves on the left - the original AutoCAD spline - looks like it might be problematic. The subdivided group of curves on the left look like native CorelDraw curves. If your illustration software native curves work well with the CNC processor, then perhaps these will as well.

 

P.S. Maybe a CorelDraw - Arrange - Combine would further assist the process.

Import.zip

Share this post


Link to post
Share on other sites
SLW210

Can you post an example .dxf and/or .ai of what works and what doesn't?

 

What software does your CNC use?

 

Did you try the LISP in Post #10?

Share this post


Link to post
Share on other sites
SEANT

I’d like to continue this discussion despite what may be an OP that “has left the building”.

 

I’ve prepped numerous files destined for outsourcing to CNC shops, though have never had direct access to the CAM/Post Processing/G-code/Hardware (hence to be called “Pipeline”).

 

Not all the shops had similar requirements. Certainly that could be due to differing components of the Pipeline. I’m sure the older the setup, the less capabilities it was likely to have.

 

My concern was that some of vendors had hardware Pipelines with plenty of capability, but operator Pipelines hampered by the unwillingness to venture from what was already known. None of the vendors that I’ve dealt with were willing to test alternate methods of dealing with free-form cutting paths. The excuse was always heavy workloads (probably true, good for them).

 

It would be helpful to find a CNC programmer that’s very interested in exploring all the options of the Pipeline, as well as the extended pipeline including file prepped by customers.

Share this post


Link to post
Share on other sites
SEANT

There was a previous statement that all curves are eventually reduced to some incremental straight line. Be that as it may, I think the CAM/CNC manufactures understand arcs, at least, well enough to eliminate unnecessary Acceleration/Decelerations, to produce smooth cuts from the linear movement. Perhaps that built in processing extends through tangential curve connections, thus allowing scj’s routine or a splined poly with appropriate Splinesegs setting to smooth out the cutting process.

 

In addition, it sounds like some CAM/CNC manufactures understand spline style curves as well. Well enough to play with the Accel/Decel to facilitate smooth cuts. Certainly Beziers are the most basic, and should be the first to be included. But it is not hard to imagine all types of Nurbs Curves would eventually be processed in a similar fashion. Or maybe they are already included, but the operators need some additional training and/or a more open mind.

Share this post


Link to post
Share on other sites
Quik&Easy

Our CNC waterjet is vintage 2000, running a Windows 98 based program. It is an ESAB table, original software was Sigmanest and WinPost G-code generator. It will not read a spline curve, it wants arcs and lines. The posting process provides a line of code for each machine movement so if you have 200 tiny short straight lines forming a single arc, as often happens when clients provide me drawings done in Corel Draw, that is 200 lines of code for a single arc. Machine movements smaller than the kerf allowance of the tip are problematic, in my experience.

 

My understanding of G-code for our purposes is there are 3 basic machine movements; a straight line, a counter-clockwise arc and a clockwise arc G1, G2, G3. The arcs are based on the centerpoint of the arc, need a radius, a length of arc and a direction, G2 or G3, CW or CCW. All contours are defined this way. Other machine functions, such as process on and off, traverse, kerf on and off are also controlled with other G and M codes from the posting process.

 

Splines don't seem to have this basic information (CP, radius, arc length) and our setup will not read them. We are a 3 axis shop, X,Y and Z (Z being vertical height). Newer software and posting processors may be able to. In addition, 5 axis movement at the head of whatever machine may require splines and perhaps the software and posting process will recognize them without fuss.

 

This is simplified as I am not a programmer, merely an operator, and lack the education and terminology to go much beyond this point. If I provide a drawing for a client to have processed by someone else, it is always lines and arcs, no splines.

Share this post


Link to post
Share on other sites
lrm

As I mentioned earlier, CAD systems and machine tools approximate smooth curves as a series of straight lines when they are drawn on the screen, printed on paper, or cut with a machine tool. This is true for arcs as well as splines. This is true even when the arc or spline is stored in the computer file as a smooth curve. For arcs there is a variety of ways that it can be stored such as its center location, the radius, the start angle and the final angle. The way an arc is stored is not related to the way it was defined by the user. For example, an arc can be specified by a user by giving a start point, an end point, and a radius (this method assumes either a CCW or CW direction) but it will still be stored in the format defined by the CAD system.

 

In the picture below you can see that the number of straight line segments need to make an arc look smooth depends on how large it will appear when it is drawn on the screen. Small radius arcs can be sufficiently approximated with a smaller number of chords than a larger radius arc.

 

Arcs.PNG

 

Most post processors for machine tools include software that can be handed the definition of an arc and generate a series of straight line segments that will produce a cut that is sufficiently smooth enough to be an acceptable arc. This software knows how many chords are needed to approximate the arc to yield sufficient precision. The smaller the radius the fewer the chords.

 

Splines are similar to arcs in that they are stored as smooth curves but instead of using a center point, radius and angles, splines use points known as Control Vertices (CVs). A long smooth spline can be represented by just a small number of CVs.

 

Now, here is where things get messy with AutoCAD. As I mentioned in a previous post (#11) there are two types of splines in AutoCAD, “old” splines and “new” splines. The DXF output for old splines is a series of chords specified as a series of vertex statements (see post #9). You can search the DXF file and you will see a series of statements that look like this:

AcDb2dVertex
10
4.330213794252784
20
20.04452757003263
30
0.0 

 

“AcDb2dVertex” indicates that what follows is an AutoCAD Database 2D Vertex (point). The number following the 10 is the x coordinate, the number following the 20 is the y value, and the 0.0 after the 30 is the z value. A post processor given this type of information does not need to know how to handle a spline since it has a series of points. Note, you can adjust the total number of points that are used to approximate the shape of the spline by changing the value of splinesegs before using pedit to create the spline (you must use pedit decurve after changing the splinesegs value then the spline option). Increasing the value of splinesegs will create more “vertex” statements in the DXF file.

 

It is interesting to note that the AutoCAD software automatically create more chords (segments) where the spline has a small radius of curvature and fewer chords where the spline curvature is flatter.

 

If the DXF file contains the definition of a “new” spline the file will have the location of the CV points instead of a series of vertices. In this case, if the post processor does not include software for converting CV points into a series of chords it will not be able to cut the smooth curve.

 

How do you tell the difference between an old and new spline? If you select a spline and the properties window indicates “2D Polyline” it is an old spline (a B-spline). If “spline” is indicated it is a new (NURBS) spline.

 

Lee

Share this post


Link to post
Share on other sites
SEANT
Our CNC waterjet is vintage 2000, running a Windows 98 based program. It is an ESAB table, original software was Sigmanest and WinPost G-code generator. It will not read a spline curve, it wants arcs and lines . . . .

 

Most of the vendors I’ve dealt with have Software/Hardware of similar vintage. And they have all made similar statements. No DWG/DXF splines (nor Ellipse unless PELLIPSE is set to 1). Oddly enough, though, and similar to the OP, Bezier Curves from Adobe Illustrator usually were fine.

 

As I mentioned earlier, CAD systems and machine tools approximate smooth curves as a series of straight lines when they are drawn on the screen, printed on paper, or cut with a machine tool. This is true for arcs as well as splines. . . . .

 

 

 

 

Most post processors for machine tools include software that can be handed the definition of an arc and generate a series of straight line segments that will produce a cut that is sufficiently smooth enough to be an acceptable arc. This software knows how many chords are needed to approximate the arc to yield sufficient precision. . . . .

 

Now, here is where things get messy with AutoCAD. As I mentioned in a previous post (#11) there are two types of splines in AutoCAD, “old” splines and “new” splines. The DXF output for old splines is a series of chords specified as a series of vertex statements (see post #9). . . . .

 

 

It is interesting to note that the AutoCAD software automatically create more chords (segments) where the spline has a small radius of curvature and fewer chords where the spline curvature is flatter.

 

If the DXF file contains the definition of a “new” spline the file will have the location of the CV points instead of a series of vertices. In this case, if the post processor does not include software for converting CV points into a series of chords it will not be able to cut the smooth curve.

 

. . . .

 

Lee

 

I’m willing to accept that the current state of the art translates any curve to incremental linear movements. But clearly there is more to it than that. None of the CNC shops ever complain about Arcs and Circles. They would complain about faceted curves (Fonts geometry converted to polys, for example) because the constant accel/deccelerations at the vertices was tough on the equipment and/or the material being cut (again, similarly as stated by the OP).

 

The processor must interpret the micro- faceting of the G02-G03 in such a fashion as to eliminate the harsh accelerations. I suspect that the same applies to Bezier curves.

 

Even if a Pipeline’s processor could handle Beziers, though, it may not handle B-Splines through Nurbs Splines. Hence the rejection of any AutoCAD based file containing such. And, consequently, the mad scramble by the CAD jockey to reduce everything back to short line segments (Let the vendor complain that I’m vibrating his CNC equipment to death).

 

So this raises the question: If a CAD jockey uses splines, what format to use? If you’re saying an “Old Spline” is just a bunch of straight segments – that doesn’t help the CNC vendor (though, the jockey could set SPLINESEGS to a negative value and at least send tangent arcs). But is there any way to generate curved geometry in AutoCAD that mimics what comes from Adobe Illustrator, i.e., CNC compatible Bezier Curves?

Share this post


Link to post
Share on other sites
lrm
is there any way to generate curved geometry in AutoCAD that mimics what comes from Adobe Illustrator, i.e., CNC compatible Bezier Curves?

 

Can you post an output file of a single "S" shaped spline from Illustrator?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×