G Code for Arc Cuts (G02, G03)

General MeshCAM Questions

G Code for Arc Cuts (G02, G03)

Postby Doug » Sat Nov 19, 2016 8:32 pm

Perhaps this isn't the most appropriate forum to be asking questions about G Code but I'll try my luck anyway... ;)

I noted a thread or two discussing fretboard/fingerboard slotting in MeshCAM:

viewtopic.php?f=3&t=15707

viewtopic.php?f=3&t=15650

viewtopic.php?f=3&t=15660

I figured that it might be educational and even fun to try to write the G Code manually for this using a spreadsheet to calculate the coordinates. I started by having a look at the quick CNC Cookbook arc tutorial because their site is really informative and I have their G Wizard feeds & speeds calculator bought bundled with MeshCAM! :)

http://www.cnccookbook.com/CCCNCGCodeArcsG02G03.htm

However, I found it difficult to translate this simple example into what I wanted to do. Would anybody be able to give me some guidance?

I would normally cut fret slots on the flat stock manually using a Japanese fret saw and StewMac fret slotting mitre box with bearing guides and an appropriate fret slotting template. I have a simple toolpath to then CNC cut the fretboard outline and radius it to my desired radius (in this case 7.25" or 184.15 mm).

However, I guess that it would save time to cut radiused fret slots with a 0.5 mm mill using G02 and G03 codes for clockwise and counter-clockwise arcs.
Last edited by Doug on Sat Nov 19, 2016 8:39 pm, edited 1 time 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). http://www.facebook.com/DougShortGuitarBlog/
Doug
 
Posts: 55
Joined: Thu Oct 13, 2016 9:56 am

Re: G Code for Arc Cuts (G02, G03)

Postby Doug » Sat Nov 19, 2016 8:39 pm

So the plan would be to cut at an appropriate speed (I haven't run this through GWizard feeds & speeds calculator yet) so I arbitrarily chose 90 mm/minute and cut a clockwise arc left to right across the board then a counter-clockwise arc back right to left at successively deeper Z values (0.25 mm seems appropriate) down to maybe -1.75 mm from the top (yielding seven cuts per slot) then move on to the next slot position and repeat the process.

(x,y) zero would be at the center of the stock and z axis zero at the top surface as normal.

I tried to use the XYZ IJK method to establish relative offsets from the starting point of the arc to the center and here's what I came up with for the zero fret which is at a Y distance of 230.9687 mm from the fretboard centreline:

G02 F90.0
X23.0625 Y230.9687 Z-0.2500 I-23.0625 J0.000 K-183.9000
G03 F90.0
X-23.0625 Y230.9687 Z-0.5000 I23.0625 J0.000 K-183.6500
G02 F90.0
X23.0625 Y230.9687 Z-0.75000 I-23.0625 J0.000 K-183.4000
G03 F90.0
X-23.0625 Y230.9687 Z-1.0000 I23.0625 J0.000 K-183.1500
G02 F90.0
X23.0625 Y230.9687 Z-1.25000 I-23.0625 J0.000 K-182.9000
G03 F90.0
X-23.0625 Y230.9687 Z-1.5000 I23.0625 J0.000 K-182.6500
G02 F90.0
X23.0625 Y230.9687 Z-1.75000 I-23.0625 J0.000 K-182.4000

...but when I ran this through GWizard editor, it generated many error messages and the "plain English" definition of the instruction didn't bear any resemblance to what I was trying to do.

I guess one of the things that's confusing me is whether I should use the arc G Code instructions to deal with incrementing the cut depth by 0.25 mm (as in the example above) or whether I should just use the arc instruction to describe the arc across the x distance (in this case 46.125 mm) and use a separate linear G Code instruction to increment the depth...

I've clearly got this very wrong!
Stepcraft 2/840 CNC machine with 4th axis, TurboCAD V19.2 Pro Platinum, MeshCAM, GWizard feeds & speeds calculator, UCCNC. Hobby use: guitar building (luthiery). http://www.facebook.com/DougShortGuitarBlog/
Doug
 
Posts: 55
Joined: Thu Oct 13, 2016 9:56 am

Re: G Code for Arc Cuts (G02, G03)

Postby Doug » Sat Nov 19, 2016 8:55 pm

I think that there is a more fundamental problem ahead of me in that my machine controller software (UCCNC) user manual states that it can only interpret arcs in the XY plane. My proposed arcs for this job are in the XZ plane I suppose. :(

"Arc at Feed Rate : G2 and G3
A circular or helical arc is specified using either G2 (clockwise arc) or G3 (counterclockwise arc). The arc lies on the XY plane, other planes for arcs are currently not supported. A Z axis offset can be also programmed, in this case the Z axis will do a linear motion and will start to move the programmed distance when the arc interpolation starts and finishes the movement when the arc interpolation ends. If the Z axis offset is programmed then the movement will be a helix instead of an arc."
Stepcraft 2/840 CNC machine with 4th axis, TurboCAD V19.2 Pro Platinum, MeshCAM, GWizard feeds & speeds calculator, UCCNC. Hobby use: guitar building (luthiery). http://www.facebook.com/DougShortGuitarBlog/
Doug
 
Posts: 55
Joined: Thu Oct 13, 2016 9:56 am

Re: G Code for Arc Cuts (G02, G03)

Postby ArchieF » Sun Nov 20, 2016 4:57 pm

Hi Doug,
doing some changes - setting G2 to G3 and I- to I+ and viceversa - gives the attached result .
G18 F90
G03 X23.0625 Y230.9687 Z-0.2500 I23.0625 J0.000 K-183.9000
G02 X-23.0625 Y230.9687 Z-0.5000 I-23.0625 J0.000 K-183.6500
G03 X23.0625 Y230.9687 Z-0.75000 I23.0625 J0.000 K-183.4000
G02 X-23.0625 Y230.9687 Z-1.0000 I-23.0625 J0.000 K-183.1500
G03 X23.0625 Y230.9687 Z-1.25000 I23.0625 J0.000 K-182.9000
G02 X-23.0625 Y230.9687 Z-1.5000 I-23.0625 J0.000 K-182.6500
G03 X23.0625 Y230.9687 Z-1.75000 I23.0625 J0.000 K-182.4000


Richard
Attachments
G2_G3 using G18.png
Arcs on the G18 plane
G2_G3 using G18.png (4.29 KiB) Viewed 5361 times
AMD Athlon II X2 215 Processor 2.7 GHz

4 GB RAM

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

Re: G Code for Arc Cuts (G02, G03)

Postby Doug » Mon Nov 21, 2016 2:20 pm

Wow Richard, that looks excellent!

Many thanks. So I was on the right lines it seems.

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). http://www.facebook.com/DougShortGuitarBlog/
Doug
 
Posts: 55
Joined: Thu Oct 13, 2016 9:56 am

Re: G Code for Arc Cuts (G02, G03)

Postby ArchieF » Wed Nov 23, 2016 1:56 pm

Ok Doug,
My proposed arcs for this job are in the XZ plane I suppose

so you will have to break the arcs into small line segments.
Attached you will find a spreadsheet created with LibreOffice Calc we can start with to do this.

Don't ever delete the cells G3 or I3 They know how to calculate the coordinates :D

How to use it :
1. Set in C5 the width of your fretboard (mounted parallel to the X axis!)
2. Set in C6 the radius you want to use
3. Set in C23 the amount of lines you want to be calculated ( I think the same value as the width would be fine)
4. Now click once in cell G3 . You'll see a small square at bottom right of the cell frame. Grab this square with the mouse and drag it down till you reach the line in Column E having the same value as C23. Hit F9 for calculation.
5. Click once in cell I3, grab the little square bottom right and drag it to the same line as in 4. Hit F9 again for recalculation.
6. Now click once in cell F3 , scroll down to the line you ended in 5. , hold down the shift key and click the last calculated cell in the column I.
All coordinates including the axis names should be selected. Copy and paste the whole selection into your favourite text editor and remove the spaces between the axis name and the numbers.
Add the movements to the first point in that list and add a G1 at the beginning and the feed you want to use and save the whole thing.
You should now have a working nc code.
If you have any questions just ask -
If you can't open the file I'll try saving it in a different format LibreOffice knows.
And perhaps you'll have to replace the decimal commas with decimal points
Edit:
New version of the spreadsheet. Now with forward and backward coordinates. Makes zigzag moves possible.
Screenshot shows backplot of the G1 moves and two arcs with the same radius to proof the calculations.
Zip file contains the new spreadsheet, a screenshot and the nc code of the screenshot.

Richard
Attachments
Arc2LinesV2.png
Arc2LinesV2.png (60.86 KiB) Viewed 5318 times
Arc2LinesV2.zip
Version 2
(56.94 KiB) Downloaded 102 times
Last edited by ArchieF on Wed Nov 23, 2016 10:18 pm, edited 2 times in total.
AMD Athlon II X2 215 Processor 2.7 GHz

4 GB RAM

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

Re: G Code for Arc Cuts (G02, G03)

Postby Doug » Wed Nov 23, 2016 7:26 pm

Thank you Richard, that spreadsheet will be very helpful indeed. I am a little too busy to study it at the moment, I'm sorry.

I normally use Microsoft Excel 2003 version on PC and we have 2011 version of a MacBook Pro if that helps with file formats.

I started designing a spreadsheet to build the (incorrect) G Code I quoted in my original post.

Just out of interest, does Mach 3 cope with arcs in other planes than XY?

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). http://www.facebook.com/DougShortGuitarBlog/
Doug
 
Posts: 55
Joined: Thu Oct 13, 2016 9:56 am

Re: G Code for Arc Cuts (G02, G03)

Postby ArchieF » Sat Dec 03, 2016 8:25 pm

Found a short manual that can tell you perhaps more :

https://www.machsupport.com/forum/index ... tach=43059

I don't have Mach3 ! :(

Richard
AMD Athlon II X2 215 Processor 2.7 GHz

4 GB RAM

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

Re: G Code for Arc Cuts (G02, G03)

Postby Randy » Mon Dec 05, 2016 5:48 pm

Doug wrote:Just out of interest, does Mach 3 cope with arcs in other planes than XY?g

Doug, I'm sorry, I missed this question. Mach3 does handle X-Z (G18) and Y-Z (G19) arcs. I run my Tormach under Mach3, and have done hand-programmed Y-Z arcs on a couple of occasions.

Randy
All opinions in this post are mine alone. I am not a MeshCAM employee, I do not have a financial interest in MeshCAM, nor do I speak for MeshCAM. MeshCAM user since Beta 5 in 2003. viewtopic.php?f=11&t=15333 :ugeek:
Randy
 
Posts: 1812
Joined: Wed May 14, 2008 9:50 am
Location: North Texas, USA

Re: G Code for Arc Cuts (G02, G03)

Postby Doug » Tue Dec 06, 2016 4:14 pm

Thanks for the support guys.

I am still having machine related setup problems but software wise looks good.

I clicked on the UCCNC help tab and it displayed a list of supported G Codes. Despite the statement in the user manual, G18 and G19 codes appear there so I imagine that they are supported! :-)

I will try a dry run with no stock and no bit when I finally get up and running. Doing the fretboard radiusing, outline cut, fret marker drilling or routing and fret slot radiusing sounds like a suitable lightweight job for it which would otherwise take ages by hand.

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). http://www.facebook.com/DougShortGuitarBlog/
Doug
 
Posts: 55
Joined: Thu Oct 13, 2016 9:56 am

Next

Return to General

cron