Hello Guest it is April 19, 2024, 08:51:40 PM

Author Topic: Subroutines  (Read 4364 times)

0 Members and 1 Guest are viewing this topic.

Subroutines
« on: October 23, 2007, 01:32:35 PM »
I've been a computer programmer for many years so I'm familiar with different constructs in programming languages.

Suppose I have a piece to cut and I need to operations on it. I need to cut a rectangular slot in the middle and then contour the outside of the shape. FlashCut (free demo) will write the code for me to do that but if I specify that a path be cut several times (say in 0.1" increments) it will write the entire code for that path several times.

What's the structure for using a subroutine for this? Like this...

z-0.1
call x-y-movement subroutine
z-0.2
call x-y-movement subroutine
z-0.3
call x-y-movement subroutine

etc

end program

Online Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Subroutines
« Reply #1 on: October 23, 2007, 04:32:30 PM »
Like this :-

O0001 (MAIN PROGRAM)
G00 G90 G43 X0 Y0 Z1.  Etc.
Z-.1
M98 P0002
Z-.2
M98 P0002
Z-.3
M98 P0002
Etc.
M30

O0002 (SUB PROGRAM)
G01 X-1. F10.
Y-1.
X0
Y0
M99

Graham.
Without engineers the world stops
Re: Subroutines
« Reply #2 on: October 23, 2007, 05:26:09 PM »
Thanks..

G00 G90 G43 X0 Y0 Z1.  Etc.

I know what G00 is and I know the x y and z commands.

What's G90 and G43 for?

Online Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Subroutines
« Reply #3 on: October 23, 2007, 05:49:05 PM »
G90 is absolute movements.

G91 is move incremental.

G43 is use height offsets, only if a Hnn is commanded.

Graham.

« Last Edit: October 23, 2007, 05:51:53 PM by Graham Waterworth »
Without engineers the world stops
Re: Subroutines
« Reply #4 on: October 23, 2007, 10:56:42 PM »
Ok, but what do they actually do?

Online Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Subroutines
« Reply #5 on: October 24, 2007, 04:57:59 AM »
They actually tell Mach how to move.

Actually, G90 Absolute says to Mach this dimension is from the datum.

Actually, G91 incremental says this dimension is from where you are now, move this amount.

Actually, G43 H1 says use offset 1 to compensate for the length of the tool.

Graham.  ;)

Without engineers the world stops
Re: Subroutines
« Reply #6 on: October 25, 2007, 12:37:54 AM »
So when using G43, how does it affect exactly how my machine is set up? Say I have a 3" long end mill in the spindle and 1.5" of that are inside. Do I measure from the bottom of my tool holder or what exactly? Do I run my mill head (with no tool) down to the top of my part surface and call that z0?

Online Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Subroutines
« Reply #7 on: October 25, 2007, 04:07:12 AM »
You set your tool onto the datum face and zero out as normal,  then if the depth of the cut needs to be changed e.g. a step depth is shallow then the tool offset is updated in the length part of the table to reflect the error amount.

So :-

Select tool 1.

Set the offsets table, tool length to Zero for tool 1

Touch the tool onto the datum face.

Zero out the Z DRO

Take a cut of a few thou.

Measure it.

Then adjust the offset length by the error

Remember to make the tool go deeper into the surface, you tell Mach that the tool is shorter.

Graham.
Without engineers the world stops