Manual Toolpath Generation using G02/G03 Arcs

General MeshCAM Questions

Manual Toolpath Generation using G02/G03 Arcs

Postby Doug » Sat May 20, 2017 2:00 am

I recently became mildly fascinated with G02/G03 arc code and decided to have a go at producing a toolpath manually using arcs instead of relying on MeshCAM to generate code for me.

This was prompted by two situations:

(a) the realisation that it would be significantly more economical in code to drill 1/4" (6.35 mm) circular guitar fretboard marker holes with a 6 mm 2 flute slot drill using a circular arc G02 code with radius 0.175 mm than the equivalent tiny linear movements generated by most CAM software packages. While imperial sized solid carbide end mills are relatively easy to obtain in the U.K., it is not easy to obtain imperial sized ER11 collets so there is an advantage for me.

(b) I have experienced problems with the G Code toolpath for my Red Special pickguard. Actually, I think the problem lies with TurboCAD V19.2 Pro which has a bug/glitch that sometimes causes arcs to degenerate into line segments. Unfortunately this is not a simple display issue because it translates through to the geometry, STL and MeshCAM faithfully generates G Code for it. :roll:

No matter how I much I try, I couldn't work around it or design it out. Very frustrating. On this guitar build project, I built the geometries as regions in TurboCAD by placing circles, ellipses and line segments at specific rectangular co-ordinates then using 2D and/or 3D Boolean operations to create a region because this is how I believe Brian May originally designed his guitar (in particular there is an urban myth that he drew around household objects such as cups, saucers, plates, etc. to create the shapes). This usually works well unless there is a micro-scale overlap issue which creates a minute spike in the outline which cause TurboCAD to return error messages.

Still following me?

Anyway, I realised that my 2.5D geometries can be easily reproduced by manually specifying arcs and line segments (except in the case of the elliptical arcs unfortunately) using G02 and G03 codes for clockwise and counter-clockwise arcs.

I had a quick go at this for the Red Special's semicircular tremolo cover plate which is constructed from three arc segments and three line segments. The code is 10 lines instead of 188 lines ex MeshCAM. I attach the code to the following post if anybody is interested in trying this for themselves instead of relying on their CAM software to produce simple toolpaths consisting of circular arc segments and line segments.

If anybody knows a smart way of generating an elliptical arc segment, I'd like to hear it... A "four centre method" is commonly used by manual draughtsmen to draw approximate ellipses:

http://www.cnczone.com/forums/g-code-pr ... ipses.html

I had a quick go at using two sets of circles to approximate an ellipse (two at the left and right foci and two above and below the ellipse centreline) and it worked quite well with a few minutes spent iterating circle diameters and positions, but elucidating a formula for this relative to the original ellipse I was trying to replicate blew my mind.

I should point out that in the case of this pickguard outline cut, I use a 90 degree bevel cutter and the point follows the outline exactly, not at a distance equal to the radius of the cutter as with a normal type of cut. Further allowance would need to be made in the calculations with the arc size, etc. for normal cutters.

Regards.

Doug
Last edited by Doug on Sat May 20, 2017 2:08 am, edited 2 times in total.
STEPCRAFT 2/840 CNC machine with 4th axis, TurboCAD V19.2 Pro Platinum, MeshCAM, GWizard feeds & speeds calculator, UCCNC. Hobby use: guitar building (luthiery).
Doug
 
Posts: 51
Joined: Thu Oct 13, 2016 9:56 am

Re: Manual Toolpath Generation using G02/G03 Arcs

Postby Doug » Sat May 20, 2017 2:05 am

The board does not allow attachments of plain text files so here is the G Code:

CODE MANUALLY GENERATED USING ARCS


(FILENAME: Red Special Tremolo Cover Plate OUTER EDGE G02 Arcs.nc)
G17
(STOCK/BLOCK, 150.000, 100.000, 3.175, 75.000, 50.000, 3.175)
(X,Y,Z are relative to geometry centre, I,J,K are relative to X,Y,Z, not centre)
G0X0.0000Y0.0000Z2.0000
G0X53.9750Y21.8281
G1F30.0Z-0.5000
G2F1000.0X-53.9750Y21.8121I-53.9750J0.0000
G1F1000.0X-53.9750Y21.8281
G2F1000.0X-31.7500Y21.8281I11.1125J0.0000
G1F1000.0X-31.7500Y21.8281
G1F1000.0X-31.7500Y16.2719
G1F1000.0X31.7500Y16.2719
G1F1000.0X31.7500Y21.8121
G2F1000.0X53.9750Y21.8281I11.1125J0.0000
G0Z2.0000
(END)
(OF PROGRAM)


CODE GENERATED FROM MESHCAM


(FILENAME: Red Special Tremolo Cover Plate OUTER EDGE 1 Pass.nc)
G21
(STOCK/BLOCK, 150.000, 100.000, 3.175, 75.000, 50.000, 3.175)
G0X0.0000Y0.0000Z2.0000
G0X-0.5315Y-32.1492
G1Z-0.5000F30.0
G1F1000.0
X-4.6217Y-31.9740
X-9.1714Y-31.3859
X-9.2173Y-31.3795
X-9.5390Y-31.3098
X-13.7440Y-30.3935
X-18.1559Y-29.0278
X-22.4528Y-27.2821
X-26.4510Y-25.2428
X-26.5889Y-25.1710
X-30.4952Y-22.7353
X-33.5053Y-20.4806
X-34.2176Y-19.9456
X-37.6615Y-16.8694
X-40.8454Y-13.4916
X-43.6323Y-9.9759
X-43.7220Y-9.8610
X-43.7680Y-9.7921
X-46.2748Y-6.0007
X-48.4527Y-2.0025
X-48.4871Y-1.9379
X-48.4994Y-1.9106
X-50.3412Y2.2945
X-51.8312Y6.6833
X-52.9392Y11.1870
X-53.6529Y15.7367
X-53.6594Y15.8057
X-53.6838Y16.1503
X-53.9789Y20.3783
X-53.9983Y21.0217
X-53.9947Y21.3204
X-53.9552Y22.0098
X-53.9280Y22.2855
X-53.8281Y22.9749
X-53.7757Y23.2506
X-53.6300Y23.8710
X-53.5424Y24.1877
X-53.3291Y24.8361
X-53.2343Y25.0889
X-52.9787Y25.6863
X-52.8932Y25.8701
X-52.8372Y25.9850
X-52.5047Y26.6054
X-52.3676Y26.8352
X-51.9770Y27.4327
X-51.8276Y27.6395
X-51.3946Y28.1909
X-51.2366Y28.3748
X-50.7426Y28.9033
X-50.7160Y28.9298
X-50.5789Y29.0641
X-50.0037Y29.5797
X-49.8429Y29.7111
X-49.2454Y30.1599
X-49.0616Y30.2856
X-48.4182Y30.6862
X-48.2574Y30.7774
X-47.5680Y31.1286
X-47.3842Y31.2119
X-46.6948Y31.4905
X-46.6259Y31.5163
X-46.4880Y31.5644
X-45.7298Y31.7964
X-45.5689Y31.8380
X-44.7647Y32.0082
X-44.6268Y32.0312
X-43.8455Y32.1281
X-43.7996Y32.1324
X-43.6617Y32.1432
X-42.9724Y32.1683
X-42.8575Y32.1719
X-42.7885
X-42.6966Y32.1705
X-41.9383Y32.1324
X-41.8694Y32.1281
X-41.7545Y32.1174
X-40.9273Y32.0032
X-40.8124Y31.9824
X-40.0311Y31.8050
X-39.9622Y31.7885
X-39.8703Y31.7633
X-39.0661Y31.5056
X-38.9282Y31.4546
X-38.1699Y31.1357
X-38.1240Y31.1149
X-38.0091Y31.0582
X-37.3657Y30.7193
X-37.2967Y30.6826
X-37.2048Y30.6295
X-36.4695Y30.1563
X-36.4006Y30.1075
X-35.7055Y29.5696
X-35.6423Y29.5165
X-34.9759Y28.9011
X-34.8905Y28.8114
X-34.3261Y28.1909
X-34.2701Y28.1220
X-33.7279Y27.4097
X-33.6963Y27.3637
X-33.2030Y26.5825
X-33.1657Y26.5135
X-32.8088Y25.8242
X-32.7514Y25.7093
X-32.3916Y24.8361
X-32.3830Y24.8131
X-32.0958Y23.8940
X-31.8889Y22.9519
X-31.7654Y22.0098
X-31.7224Y21.0217
Y16.3112
X-31.7130Y16.2968
X31.7070
X31.7263Y16.3112
Y21.0217
X31.7680Y21.9868
X31.7816Y22.1017
X31.8929Y22.9519
X32.0997Y23.8940
X32.3798Y24.7902
X32.4530Y24.9740
X32.7553Y25.7093
X33.1819Y26.5365
X33.1941Y26.5595
X33.2659Y26.6744
X33.7003Y27.3637
X33.7341Y27.4097
X34.2920Y28.1450
X34.9368Y28.8573
X35.6362Y29.5072
X36.3945Y30.0996
X37.1988Y30.6230
X38.0490Y31.0769
X38.9451Y31.4596
X39.8642Y31.7605
X40.8063Y31.9802
X41.7484Y32.1159
X42.7135Y32.1712
X43.0352Y32.1619
X43.6786Y32.1425
X44.6207Y32.0326
X45.5858Y31.8344
X46.5049Y31.5601
X47.4011Y31.2061
X48.2513Y30.7825
X49.0785Y30.2777
X49.8519Y29.7075
X50.5721Y29.0742
X51.2406Y28.3748
X51.8488Y27.6165
X52.3859Y26.8122
X52.8469Y25.9735
X53.2376Y25.0889
X53.5449Y24.1927
X53.7797Y23.2506
X53.9291Y22.3085
X53.9980Y21.3434
X53.9829Y20.3783
X53.9722Y20.2175
X53.6605Y15.7597
X52.9432Y11.1870
X51.8639Y6.7982
X51.8352Y6.6833
X51.7964Y6.5684
X50.3452Y2.2945
X48.4933Y-1.9335
X46.2917Y-5.9777
X46.2752Y-6.0072
X46.2041Y-6.1156
X43.7246Y-9.8632
X40.8494Y-13.4916
X37.6878Y-16.8464
X37.6655Y-16.8694
X37.5434Y-16.9786
X34.2180Y-19.9485
X30.5121Y-22.7274
X26.5828Y-25.1775
X22.4467Y-27.2865
X18.1677Y-29.0249
X17.5064Y-29.2303
X13.7380Y-30.3957
X9.2342Y-31.3766
X9.1193Y-31.3931
X4.6156Y-31.9747
X0.0429Y-32.1708
X-0.0260Y-32.1715
X-0.5315Y-32.1492
G0Z2.0000
(END)
(OF PROGRAM)
STEPCRAFT 2/840 CNC machine with 4th axis, TurboCAD V19.2 Pro Platinum, MeshCAM, GWizard feeds & speeds calculator, UCCNC. Hobby use: guitar building (luthiery).
Doug
 
Posts: 51
Joined: Thu Oct 13, 2016 9:56 am

Re: Manual Toolpath Generation using G02/G03 Arcs

Postby ArchieF » Sat May 20, 2017 11:15 am

Doug,
you might try using a formula in a loop to create an ellipse if your control software can do that.

Richard
AMD Athlon II X2 215 Processor 2.7 GHz

4 GB RAM

Don't waste water - dilute it !
ArchieF
 
Posts: 195
Joined: Wed May 14, 2008 5:03 am
Location: Germany, Rehau

Re: Manual Toolpath Generation using G02/G03 Arcs

Postby Doug » Mon May 22, 2017 4:54 am

ArchieF wrote:Doug,
you might try using a formula in a loop to create an ellipse if your control software can do that.

Richard

Hello Richard.

Some guy has created a macro to generate ellipses but I apparently need to log in to the forum he has posted it on. I'm not currently a member of CNC Zone:

http://www.cnczone.com/forums/general-m ... ipses.html

UCCNC will allow parametric programming. I found the following piece of code:

(CHANGE AS NEEDED)
#100= 2 (RADIUS)
#101= 0.1 (Y SCALE)
#102= 1 (STEP ANGLE)
(----------------------)

#103= 0 (CURRENT ANGLE)
G1X[#100*COS[0]]Y[#101*#100*SIN[0]]

WHILE [#103 LT 360] DO1
G1X[#100*COS[#103]]Y[#101*#100*SIN[#103]]F10.0
#103=#103+#102
END1
G1X[#100*COS[360]]Y[#101*#100*SIN[360]]
GOX0.0Y0.0

The difficulty I face is that I want to generate elliptical arc segments and one of them is at an angle, so not just a simple whole ellipse.

Doug
STEPCRAFT 2/840 CNC machine with 4th axis, TurboCAD V19.2 Pro Platinum, MeshCAM, GWizard feeds & speeds calculator, UCCNC. Hobby use: guitar building (luthiery).
Doug
 
Posts: 51
Joined: Thu Oct 13, 2016 9:56 am

Re: Manual Toolpath Generation using G02/G03 Arcs

Postby ArchieF » Mon May 22, 2017 8:23 pm

Hi Doug,
found this macro working with a Fanuc control using similar variables like your UCCNC. Try to adapt it to UCCNC.

Adapt the values for the radii to your needs and play with the angle values.
#103 = 0 and #110 = 360 gives a full ellipse
#103 = 0 and #110 = 180 gives a semi ellipse above the x axis
#103 = 180 and #110 = 360 gives a semi ellipse below the x axis

#101 = 80.000 ; STARTRADIUS X AXIS
#102 = 40.000 ; STARTRADIUS Y AXIS
; SET BOTH VALUES THE SAME VALUE GIVES A CIRCLE
#103 = 0.000 ; ANGLE TO START WITH
#104 = 2.000 ; ANGLE STEP
#110 = 180 ; END ANGLE
N100
#105 = SIN [#103]
#106 = COS [#103]
#107 = #105 * #102
#108 = #106 * #101
G1 X+#108 Y#107 F100
#103 = #103 + #104
IF [#103 LT #110] GOTO 100
M2

Richard
AMD Athlon II X2 215 Processor 2.7 GHz

4 GB RAM

Don't waste water - dilute it !
ArchieF
 
Posts: 195
Joined: Wed May 14, 2008 5:03 am
Location: Germany, Rehau

Re: Manual Toolpath Generation using G02/G03 Arcs

Postby Doug » Wed May 24, 2017 11:01 pm

Many thanks Richard. I'll give it a try when I have time.

Regards.

Doug
STEPCRAFT 2/840 CNC machine with 4th axis, TurboCAD V19.2 Pro Platinum, MeshCAM, GWizard feeds & speeds calculator, UCCNC. Hobby use: guitar building (luthiery).
Doug
 
Posts: 51
Joined: Thu Oct 13, 2016 9:56 am


Return to General