PDA

View Full Version : A little bit of G code help please!



njhussey
05-11-2015, 07:56 PM
I've just started to look into the g code in the programs (because I wanted to send the machine back to Z25 X0 Y0 (G0 Z25X0Y0) after the program had stopped cutting) so bear with me if I'm being a little thick. It's been 15 years since I've done any computer programming of any sort so am more than a bit rusty!!

I'm trying to drill a few holes in my work piece (3mm lite ply) so I can put some hold down screws in to stop it from lifting (yes I know get some spiral down cutters) but I'm not sure what command to use. Basically I want to spiral drill the holes with the 2mm single flute bit I'm using and then send the spindle back to X0Y0 and wait until I've finished screwing in the screws, then when I've finished I want to be able to click the start button again and it carry on the program. I'm using CamBam but not sure if it has an option to do this?

Can anyone help?

Cheers :eagerness:

Lee Roberts
05-11-2015, 10:43 PM
Hi Neil,

Sorry I don't know what or if there is a g code command to do a pause, however you could use Feed hold in mach?, this is the same as a pause, if you wanted to you could go as far as setting up your own switches connected to inputs or if you went with OEM triggers rather than inputs you could then use hotkeys and enter the OEM numbers. So 1000 is Start, 1001 is Feed hold or you can just click the Feed hold on the Mach3 screen.

I know this isn't really what your wanting as you want to it all to be automated, I'm just trying to help with what I can, it is a start/compromise, you could just have the machine go to Z25 X0 Y0 by adding this code to your job g code, then just pause the machine while you do the screwing down.

I'm sure the others will be along to help you where I can't though.

.Me

Lee Roberts
05-11-2015, 10:51 PM
Neil,

For a pause with resume (timed pause), you can use G4, this is a dwell and supports decimals, so for a dwell of of 120 seconds you would use the line G4 P120.

.Me

JAZZCNC
05-11-2015, 10:52 PM
Ok so lets get a bit more detail.?
#1 Do you want to make one hole then move away and screw one screw down. Then cycle start move to next hole and repeat.?

#2 Do you want to make all the holes then move out the way and wait for screwing down then carry on with cutting rest of the job.? Has in 2 operations with in one G-code file.?

One is much easier than the other.! Both are relatively easy with Cam software but ones is harder than the other if hand coding but still not challenging coding so to speak if your G-code savy.

Also do you want holes larger than the 2mm bit.? If not then just use a simple peck drilling cycle with small pecks.

If #2 with same size hole then it's simple enough has the G83 peck drill cycle is classed has one operation even thou many holes in different locations.
After the Peck cycle ends you send the machine to the loaction out the way then Issue a M6 tool change. This will wait for tool change and just don't change the tool and push cycle start when finished screwing down.

CharlieRam
06-11-2015, 03:57 AM
Does Mach support M00 ? I haven't used it yet but it is just. Cycle interrupt, which waits for cycle start to carry on. Much safer than a timed pause.

Sent from my XT1072 using Tapatalk

njhussey
06-11-2015, 07:07 AM
Thanks guys, hopefully the below picture will show what I'm trying to do. There are lots of nested parts and I want to put in supporting screws to help keep the ply stable and not moving all over the place so the pieces get ruined, yes vac hold down would be nice but that's not going to happen...yet! Neither do I want to be cleaning double sided tape from the parts.

Dean, #2 is what I want to do. I currently drill the holes (3mm from memory) using a spiral mill operation (I think!) and then want to send the spindle out the way back to X0Y0 whilst I get my cordless drill and screw in the screws. Then I want to be able to set the machine back on its merry way cutting the next operation etc. etc. till it's finished.

Charlie, the M00 option I presume would just pause the program with the tool still over the last drilled hole?

Lee, the feed hold runs on a bit after pressing (tried it a few times...) so not really suitable and I'm not sure I want a timed delay as I know it will either be too short or far too long....

16466

sinnsvak
06-11-2015, 07:39 AM
When I want a small pause, I add a tool-change, without really changing anything. I can then jog it away and put in screws, when I hit run again it will go to position and continue.

magicniner
06-11-2015, 09:03 AM
Daft question but why aren't you edge clamping the work and running a job to put in all the hold-down screw holes in one go first, then cutting your profiles?

njhussey
06-11-2015, 09:38 AM
When I want a small pause, I add a tool-change, without really changing anything. I can then jog it away and put in screws, when I hit run again it will go to position and continue.

What code do you put in to do that? I put in M6 and it didn't flinch, just ran straight past it?!


Daft question but why aren't you edge clamping the work and running a job to put in all the hold-down screw holes in one go first, then cutting your profiles?

I do edge clamp it (see above pic, I use masking tape...:hopelessness:) and do the drilling operation first...I want to know (being a complete noob) how to stop the code so I can put the screws in.

jamesgates1000
06-11-2015, 11:01 AM
As someone has said above, an M0 is the best way to pause the program.

An example would be...
(this is based on fanuc/has g code but the format will be the same)

...
G83 Z-10 R3. Q3. G99 (drilling cycle)
X4. Y6. (hole position 1)
X44. Y46. (hole position 2)
G0 Z50. (rapid away from job in z)
X0. Y0. (rapid to home/change position)
M0 (program stop)
... Continue program

The M0 will pause the program until you press the green cycle start button again.

njhussey
06-11-2015, 11:23 AM
As someone has said above, an M0 is the best way to pause the program.

An example would be...
(this is based on fanuc/has g code but the format will be the same)

...
G83 Z-10 R3. Q3. G99 (drilling cycle)
X4. Y6. (hole position 1)
X44. Y46. (hole position 2)
G0 Z50. (rapid away from job in z)
X0. Y0. (rapid to home/change position)
M0 (program stop)
... Continue program

The M0 will pause the program until you press the green cycle start button again.

Thanks James, I'll "air cut" a small program with this in and try M0! The list of G-code commands I have just says program stop and nothing about a re-start so I didn't want to use this, certainly not in anger.

magicniner
06-11-2015, 01:14 PM
(see above pic, I use masking tape...:hopelessness:

I saw the tape and suggested clamping the edges because you were taping, not clamping the work.
Masking tape is specifically designed to be removable and doesn't offer much hold down capability in the face of a persistent force such as the lift from spiral flute milling or routing.
Swapping to a good commercial grade of gaffer tape and ensuring the tape runs down the vertical side of the work and contacts the spoil board at the edge of the work will give you a big improvement in hold,

- Nick

njhussey
06-11-2015, 01:26 PM
I saw the tape and suggested clamping the edges because you were taping, not clamping the work.
Masking tape is specifically designed to be removable and doesn't offer much hold down capability in the face of a persistent force such as the lift from spiral flute milling or routing.
Swapping to a good commercial grade of gaffer tape and ensuring the tape runs down the vertical side of the work and contacts the spoil board at the edge of the work will give you a big improvement in hold,

- Nick
Hi Nick, plans are to make some ali clamp blocks a bit like inverted T nuts that will clamp the edges which will also mean that I can then machine multiple balsa strips in one go....however as with everything I'm running before I can walk.... I know, I'm heading for a fall! Will be catching up on everything over the Christmas period....[emoji15]

JAZZCNC
06-11-2015, 04:27 PM
What code do you put in to do that? I put in M6 and it didn't flinch, just ran straight past it?!

Well then your problem is that you haven't turned on tool changes in General Config. See pic.

16471

If the file your using is made up of two or more operations, whether that be 2 milling op's or Drill and then mill etc and each operation uses a different tool number then M6 will stop at the new tool and wait for cycle start.
If like in your case your using same tool for both Op's then still give a separate T number to the second tool and it will do what you want and you won't have to mess around inserting M codes etc. (You have to do this to trick your Cam Post processor into inserting M6 other wise it will see same tool number for both tools and leave M6 out because it thinks you don't need to change tools)

Lee Roberts
06-11-2015, 04:44 PM
Thanks James, I'll "air cut" a small program with this in and try M0! The list of G-code commands I have just says program stop and nothing about a re-start so I didn't want to use this, certainly not in anger.
Yeah that's what I thought as well, thats why i suggested instead the timed paused because my list did say programme will then resume, at least we know now :).

.Me

njhussey
06-11-2015, 04:49 PM
Well then your problem is that you haven't turned on tool changes in General Config. See pic.

16471

If the file your using is made up of two or more operations, whether that be 2 milling op's or Drill and then mill etc and each operation uses a different tool number then M6 will stop at the new tool and wait for cycle start.
If like in your case your using same tool for both Op's then still give a separate T number to the second tool and it will do what you want and you won't have to mess around inserting M codes etc. (You have to do this to trick your Cam Post processor into inserting M6 other wise it will see same tool number for both tools and leave M6 out because it thinks you don't need to change tools)

I've had a look into it and as you say you need to specify the different tools first i.e. T1=1, T2=2 and then It'll wait...if you just put M6 in there like an idiot that I am then of course it won't do anything as it doesn't see a different tool...... :stupid:

JAZZCNC
06-11-2015, 05:05 PM
I've had a look into it and as you say you need to specify the different tools first i.e. T1=1, T2=2 and then It'll wait...if you just put M6 in there like an idiot that I am then of course it won't do anything as it doesn't see a different tool...... :stupid:

No if you insert it your self manually then it should still stop because Mach's STANDARD M6 macro doesn't Know or care about the tool number it just stops and waits for cycle start. Then enters the next tool number has the current tool in Mach's Tool DRO.

It doesn't do any checks to see if the current tool is same has the next tool so if you insert M6 before the next tool then even if that tool has the same number it will stop and wait. Then it enters this same number again, obviously on screen it looks like nothing changed because it's same number but it did still do the change.

It's the Cam post processor that leaves the M6 out if tools have the same number. So if it's missing M6 then it's because the tool change is turned off in General Config.

njhussey
06-11-2015, 05:09 PM
No if you insert it your self manually then it should still stop because Mach's STANDARD M6 macro doesn't Know or care about the tool number it just stops and waits for cycle start. Then enters the next tool number has the current tool in Mach's Tool DRO.

It doesn't do any checks to see if the current tool is same has the next tool so if you insert M6 before the next tool then even if that tool has the same number it will stop and wait. Then it enters this same number again, obviously on screen it looks like nothing changed because it's same number but it did still do the change.

Cheers Dean I'll check on Monday as I'm off oop norf to see the bin lids this weekend so no CNC, though I'll be doing the CAM for the next batch of parts for my new plane!!

njhussey
15-11-2015, 07:27 PM
Dean, as usual you were spot on....went into General Config and changed it to tool change and works a treat...thank you!

JAZZCNC
16-11-2015, 02:36 PM
Dean, as usual you were spot on....went into General Config and changed it to tool change and works a treat...thank you!

No Probs neil pleased it's working.