Exploding Splines
Moderator: andrew
Exploding Splines
Splines are convenient drawing elements to represent non-circular, non-elliptical curves. Unfortunately, when drawings are further processed for example through CAM (G-Code or similar), splines often need to be broken down into simpler elements. Since most CNC machines do not support splines, splines are often automatically converted into tiny line segments which has the potential to slow down the machine substantially.
To prevent this, you can convert splines in QCAD before handing the file to the CNC processor. QCAD can convert splines into polylines with tangentially connected arc segments (fewer nodes, guaranteed smoothness, i.e. no "kinks").
First, please check your preferences under:
Edit > Application Preferences > Modify > Explode
Make sure that Explode splines to polylines with line segments is unchecked as shows in this screenshot:
Adjust the spline approximation tolerance (maximum error). The larger this value, the fewer nodes you will get. Try a value of 0.01, 0.1 or 1.0 and check the different results.
To convert splines into polylines with arc segments, simply select the splines and choose Modify > Explode.
Original spline (top) and exploded spline with 14 nodes (bottom).
To prevent this, you can convert splines in QCAD before handing the file to the CNC processor. QCAD can convert splines into polylines with tangentially connected arc segments (fewer nodes, guaranteed smoothness, i.e. no "kinks").
First, please check your preferences under:
Edit > Application Preferences > Modify > Explode
Make sure that Explode splines to polylines with line segments is unchecked as shows in this screenshot:
Adjust the spline approximation tolerance (maximum error). The larger this value, the fewer nodes you will get. Try a value of 0.01, 0.1 or 1.0 and check the different results.
To convert splines into polylines with arc segments, simply select the splines and choose Modify > Explode.
Original spline (top) and exploded spline with 14 nodes (bottom).
Re: Exploding Splines
Hi Andrew
Thank you
Ross
Thank you
Ross
Re: Exploding Splines
Hint
Keep a copy off your spline(-s) to revert to.
There ain't no easy way back from polys to splines exept undoing all the changes you made in between.
nor after closing.
Keep a copy off your spline(-s) to revert to.
There ain't no easy way back from polys to splines exept undoing all the changes you made in between.
nor after closing.
-
- Junior Member
- Posts: 11
- Joined: Mon Aug 20, 2018 4:23 pm
- Location: Berlin, Germany
Re: Exploding Splines
Hello, exploding splines to polylines with arcs is still unsatisfying.
Either I set the tolerance to below 0.1 and I get too many segments or I set the tolerance above 0.1 and I get a path with a too big offset.
Any solution?
As a reference I put a polyline aside, which I converted with a CAD called eMachineShop
Cheers. Benny
Either I set the tolerance to below 0.1 and I get too many segments or I set the tolerance above 0.1 and I get a path with a too big offset.
Any solution?
As a reference I put a polyline aside, which I converted with a CAD called eMachineShop
Cheers. Benny
- Attachments
-
- 180803_Scherenschnitt_2-2-forum.dxf
- (361.97 KiB) Downloaded 1350 times
Re: Exploding Splines
Mentioned this too halfway this post:
https://www.qcad.org/rsforum/viewtopic.php?t=5566
https://www.qcad.org/rsforum/viewtopic.php?t=5566
Re: Exploding Splines
The eMachineShop algorithm compromises on tangency. I.e. you are getting 'corners' at nodes and the curve is no longer smooth. It's quite possibly the simplifying step that does that. QCAD does not have a simplification algorithm that compromises on tangency.
-
- Junior Member
- Posts: 11
- Joined: Mon Aug 20, 2018 4:23 pm
- Location: Berlin, Germany
Re: Exploding Splines
Ok, really good to know, but as a matter of facts, these corners created by emachine are not visible for us at this scaling and we can ignore them because our woodworking tools are a lot rougher than the given offset tolerance. Do you know any script which compromises on tangency? Or could this be a »checkbox-option« for future releases?
Re: Exploding Splines
Unfortunately not, no.
We don't have any plans in that direction. Perfect tangency (smoothness) is usually the deciding factor for choosing splines..benjamindahl wrote: ↑Tue Aug 21, 2018 8:22 amOr could this be a »checkbox-option« for future releases?
-
- Junior Member
- Posts: 11
- Joined: Mon Aug 20, 2018 4:23 pm
- Location: Berlin, Germany
Re: Exploding Splines
Hey andrew.
On your site it's told that the CAM-addon seems to have some options regarding that problem. How could that maybe help with our problem?
https://www.qcad.org/en/qcad-documentat ... d-features
On your site it's told that the CAM-addon seems to have some options regarding that problem. How could that maybe help with our problem?
https://www.qcad.org/en/qcad-documentat ... d-features
Is there any way to convert the path to CAM code and then back to dxf?CAM Export:
Tool radius compensation:
as G41/G42
computed coordinates
Entity conversion:
Splines as tangentially connected arcs
Ellipses as arc segments
Arcs as line segments (optional)
Other complex entities as lines and arcs
Postprocessors:
G-Code (generic)
DXF (output toolpaths in correct order to DXF)
output splines as splines or arcs
output ellipses as ellipses or arcs
optionally flatten output
optionally open output after conversion
configure DXF version
Re: Exploding Splines
Presumably, you are referring to "output splines as splines or arcs". That's exactly the same that QCAD does when exploding splines, i.e. creating exactly tangentially connected bi-arcs.
-
- Junior Member
- Posts: 11
- Joined: Mon Aug 20, 2018 4:23 pm
- Location: Berlin, Germany
Re: Exploding Splines
Yeah of course, that wouldn't help eather.
B
B
Re: Exploding Splines
Andrew, all,
I don't think a simplifying step as that of eMachineShop will induces sharp corners.
Simplifying or smoothing for CNC is to get rid of corners, short segments and enhance tangency.
About earlier posts,
Guys!? The accuracy scale, please.
Better than 0.05 on a piece that is 2800 high and 1200 width.
Thats less than 0.004%. And this for artwork.
With this accuracy demand even the runout of the spindel starts to matter.
Yes I know, I am an engraver and making pockets and/or inserts with CNC can be troublesome.
Especially in the sub mm range.
These are not the problems that are solved only with the accuracy of curve fitting in CAD.
That's the design itself and sure we want the spline to be properly approximated to start with.
Once translated to G1 an G2/G3 it is the CNC side that has to be conserned. Again interpollation occurs.
Path trajectory strategy plays a role but mostly the mechanics and its real tolerance and stiffness are important.
Investigated G61 vs G64 P.. or equivalent and what 'Look ahead feed' is and how it is translated to motion.
CNC Feed mostly is not of a consern, acceleration is.
Without a plan to accelerate in the given path no Feed-speed can be obtained.
I can tune for high speed with small to very small line segments.
The trajectory planner will accelerate through corners like it was butter below a certain tangency error limit.
To do so, the small corners will be cut in an unknown manner, the real hard corners in a controlled manner.
Need real corners, use a different path trajectory strategy that will be slower.
About the spline approximation.
Nevertheless, as -benjamindahl- points out the approximation is off.
Looking in detail it becomes more and more obvious.
Read about my findings in the pdf. New drawing added. Results & calcs in BiarcFitting.xls added.
My findings in short are:
+ In this example QCAD explodes splines with the given approximation criteria met.
Q: What accuracy does QCAD uses when it auto explode? That of the AppPrefs or a fixed value?
+ QCAD returns Biarcs that connect in perfect tangency for the same spline segment.
+ On the other hand QCAD preserves the tangent angles at the spline knotpoints.
- QCAD may cast arcs for Biarc-fitting in an odd way.
Q: What is the QCAD approach and how is this coded?
Lots of quadratic equations opens lots of choises and are prone to errors.
- Biarc solutions are returned as soon as the given approximation criteria is met.
-- QCAD does not find the best solution in a Biarc-fitting solution field.
Regards,
CVH
I don't think a simplifying step as that of eMachineShop will induces sharp corners.
Simplifying or smoothing for CNC is to get rid of corners, short segments and enhance tangency.
About earlier posts,
Guys!? The accuracy scale, please.
Better than 0.05 on a piece that is 2800 high and 1200 width.
Thats less than 0.004%. And this for artwork.
With this accuracy demand even the runout of the spindel starts to matter.
Yes I know, I am an engraver and making pockets and/or inserts with CNC can be troublesome.
Especially in the sub mm range.
These are not the problems that are solved only with the accuracy of curve fitting in CAD.
That's the design itself and sure we want the spline to be properly approximated to start with.
Once translated to G1 an G2/G3 it is the CNC side that has to be conserned. Again interpollation occurs.
Path trajectory strategy plays a role but mostly the mechanics and its real tolerance and stiffness are important.
Investigated G61 vs G64 P.. or equivalent and what 'Look ahead feed' is and how it is translated to motion.
CNC Feed mostly is not of a consern, acceleration is.
Without a plan to accelerate in the given path no Feed-speed can be obtained.
I can tune for high speed with small to very small line segments.
The trajectory planner will accelerate through corners like it was butter below a certain tangency error limit.
To do so, the small corners will be cut in an unknown manner, the real hard corners in a controlled manner.
Need real corners, use a different path trajectory strategy that will be slower.
About the spline approximation.
Nevertheless, as -benjamindahl- points out the approximation is off.
Looking in detail it becomes more and more obvious.
Read about my findings in the pdf. New drawing added. Results & calcs in BiarcFitting.xls added.
My findings in short are:
+ In this example QCAD explodes splines with the given approximation criteria met.
Q: What accuracy does QCAD uses when it auto explode? That of the AppPrefs or a fixed value?
+ QCAD returns Biarcs that connect in perfect tangency for the same spline segment.
+ On the other hand QCAD preserves the tangent angles at the spline knotpoints.
- QCAD may cast arcs for Biarc-fitting in an odd way.
Q: What is the QCAD approach and how is this coded?
Lots of quadratic equations opens lots of choises and are prone to errors.
- Biarc solutions are returned as soon as the given approximation criteria is met.
-- QCAD does not find the best solution in a Biarc-fitting solution field.
Regards,
CVH
- Attachments
-
- 180803_Scherenschnitt_Adapted.dxf
- (394.77 KiB) Downloaded 1305 times
-
- BiarcFitting.xlsx
- (12.71 KiB) Downloaded 1275 times
-
- CurveFitting_expl_spline.pdf
- (191.67 KiB) Downloaded 1360 times
-
- Junior Member
- Posts: 11
- Joined: Mon Aug 20, 2018 4:23 pm
- Location: Berlin, Germany
Re: Exploding Splines
Well, thanks for all the explanation and I admit the accuracy is maybe a bit high for this particular purpose. But sometimes we also have really small pieces of about 10 cm or have artworks with scale of 1:100 and then the accuracy matters a bit more. And yes … corners do matter, because we like to have control over them. And yes, cvm,
We know, it's an artistic approach and we want the curve »to look« identically and have as few segments as possible to get there.
Cheers
Benny
And to be clear, we don't want higher accuracy than 0.05. We want less deformation on particual points on the curve at an accuracy of let's say 0.1.That's the design itself and sure we want the spline to be properly approximated to start with.
We know, it's an artistic approach and we want the curve »to look« identically and have as few segments as possible to get there.
Cheers
Benny
Re: Exploding Splines
For this Biarc-fitting should be done optimal.benjamindahl wrote: ↑Thu Aug 23, 2018 12:04 pmWe want less deformation on particual points on the curve
Regards.
Last edited by CVH on Tue Jun 23, 2020 7:14 pm, edited 1 time in total.
-
- Junior Member
- Posts: 11
- Joined: Mon Aug 20, 2018 4:23 pm
- Location: Berlin, Germany
Re: Exploding Splines
Well, should'nt be impossible, right? A quick google says somebody already tried with QCAD
https://wiki.hive13.org/view/BezierSpli ... tingScript
And for other applications there seem to be endless recources
http://www.ryanjuckett.com/programming/ ... rpolation/
https://hakantiftikci.wordpress.com/200 ... e-fitting/
https://sourceforge.net/p/dxf2gcode/wiki/ImportExport/
So how do we get there?
https://wiki.hive13.org/view/BezierSpli ... tingScript
And for other applications there seem to be endless recources
http://www.ryanjuckett.com/programming/ ... rpolation/
https://hakantiftikci.wordpress.com/200 ... e-fitting/
https://sourceforge.net/p/dxf2gcode/wiki/ImportExport/
So how do we get there?