Hello Guest it is March 28, 2024, 06:11:56 PM

Author Topic: Multi pass facing program  (Read 14186 times)

0 Members and 1 Guest are viewing this topic.

Multi pass facing program
« on: October 31, 2010, 07:56:03 PM »
    I have to clean up lots of top surfaces that need multiple passes to get flat. So I wrote this program to do what I needed. If nothing else it's a good example of doing multiple subroutines using variables. Hope it helps someone, I find it so much easier. I just enter in the width and Length of the face along with the number of passes I need to make to clean it up.
    Wish I could use if/then statements like I use with macro B but this does work well for me in Mach3. I tried to document to help ya. But I hope you will get the idea. Beats the Wizards for me.

Code: [Select]
   (CUTS Top Face of stock)
    (STARTED AT Z0 TOP OF rough PART)

    M03 (start spindle)
    G1G90X0Y0Z0.25F60. (Go to lower left corner of stock)
    Z0 ( Feed to face of rough stock)

    (load variables)
    #1000=[16] (Length in X in this case inches)
    #1001=[13] (Width in Y)
    #1002=[-0.1] (depth each of cut pass)

    #1004=0
    #1005=0.65 (offset cut distance smaller than .75 cutter diameter)
    #1006=[#1005*2] (Compute step over)
    #1007=[#1001/#1006] (Compute passes)

    M98 P5 L8 (call subroutine CUT DOWN IN Z in this case 0.1 * 8 = .8")
    M05 (stop spindle)
    G0G90Z.25 (move back up)
    X0Y0 (go home)
    M30 (All done)

    O5
    M98 P10 L1 (call sub to feed down)
    M98 P20 L1 (call sub to face part)
    G0G90Z0 (Move out of the way)
    X0Y0 (Go Home)
    M99

    O10
    #1004=[#1004+#1002] (Calculate New cut depth)
    G1Z[#1004] (MOVE TO CUT DEPTH)
    M99

    O20
    M98 P30 L[#1007] (call sub to cut reps ACROSS)
    M99

    O30
    (THIS IS THE SUB TO CUT FACE)
    G1 G91Y[#1005] (Increment over in Y)
    G90X[#1000]F80. (Cut across part)
    G91Y[#1005] (again increment over)
    G90X0 (Cut back across part)
    M99
« Last Edit: July 28, 2014, 10:05:09 PM by Ya-Nvr-No »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Multi pass facing program
« Reply #1 on: October 31, 2010, 10:33:38 PM »
HIYA YA-NO, Looks good, please drop off a copy of this in the MACH TOOLBOX it is a section setup to SAVE things such as this to help others

(;-) TP

Re: Multi pass facing program
« Reply #2 on: October 31, 2010, 11:03:17 PM »
Totally forgot about that section, Sorry, Hell to get old!!!
I would have had no problem with anyone moving it for me
Should or... can I, delete this topic?
I did re-post, now I'll probably get in hot water about that, LOL

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Multi pass facing program
« Reply #3 on: November 01, 2010, 06:25:52 PM »
You are fine(;-) I always encourage people to put a copy of their cool functions in the Mach toolbox. THat way it is easy to find WHEN you need it.

(;-) TP
Re: Multi pass facing program
« Reply #4 on: November 05, 2010, 07:42:19 PM »
Shoot, I didn't even know there was a Mach Toolbox. ??? ::)
Re: Multi pass facing program
« Reply #5 on: March 24, 2012, 12:20:29 PM »
Some reason can not find the Mach Toolbox again; Seems like a simple search would helped me locate it, But to no avail.
(Update Found it: Machsupport Forum\ Support\ Downloads section)

Had to sharpen my lawnmower blades for a new season, so mounted a Dumore tool post grinder on my Z axis head, made a blade fixture holder, then wrote a small script to solve the task. Now I don't have to deal with the grief and they are always balanced. Uses a 3" diameter grinding wheel and does one sweet job, no burning and less mess. Though it does take longer than by hand I can get back to more fun safer things. Like napping.
Code: [Select]
O01
#100=-0.05(X Initial Home Start Point)
#101=-0.01(Y Initial Home Start Point)
#102=0.0  (Z Start Point)
#104=5.0  (X End Point)
#105=25   (Depth of Cut 25 *.002" = .05")
#106=15   (Number of Passes 15 * .02" *.02"= .6")
#107=0.002(Depth of Z cut)
#108=0.02 (Step over Y amount)

M3(Grinder Started)
G90
G0 Z0.1
X#100 Y#101(Go to the Initial Start Point)
Z#102
M98 P10 L#105
M5
M30

O10
#100=-0.01(X resets Home Start Point)
#101=0    (Y resets Home Start Point)
#102=0
G0 X#100 Y#101
#102=[#102-#107]
G0 Z#102
M98 P20 L#106
M99

O20
#101=[#101-#108]
G1 Y#101 F90
X#104
#101=[#101-#108]
Y#101
X#100
M99
(Put comment here to make sure I have a carriage return on the last M99)
« Last Edit: July 28, 2014, 10:04:41 PM by Ya-Nvr-No »
Re: Multi pass facing program
« Reply #6 on: April 03, 2012, 01:10:43 PM »
Hi, here is the code I use. It calculates how many loops are necessary before a final pass at a finish feed rate.  This is just the cutting part of the code, you can add to it as you like... Enjoy

; Turn OD   4-1-12

; running in DIAMETER mode.

;Set Z to ZERO at face of part

T101 ;facing tool number
;
#10 = .500 ; starting OD
#20 = .375 ; finish OD
#30 = .003 ; Cut depth per pass
#40 = .750 ; LENGTH OF OD CUT FROM ZERO
;
#60 = 3 ; rough feed
#70 = 1 ; finish feed
;
;Calculations
#50 = [#40 * -1] ; length of turning from ZERO (negative towards headstock)
#90 = FIX[[#10 - #20] / [#30]] ; number of FULL loops for P001
;
;
G0 X[#10 + .5]
G0 Z0.050
G0 X [#10]
#100 = [#10]
F[#60]
;
M98 P001 L[#90]
#100 = [#20]
F[#70]
;
M98 P002
G0 X[#10 + .5]
G0 Z2.0
M30
;
O001
G0 X [#100]
G1 Z [#50]
G1 X [#100 + .020] Z [#50 + .010]
G0 Z .050
#100 = [#100 - #30]
M99

O002
G0 X [#100]
G1 Z [#50]
G1 X [#10 + .02]
M99

Re: Multi pass facing program
« Reply #7 on: April 03, 2012, 06:34:30 PM »
Thanks, nice to see a lathe routine. one of these days I will get my lathe build done and put your routine to use.
Re: Multi pass facing program
« Reply #8 on: April 03, 2012, 06:50:54 PM »
Thanks, with some simple revision it works great for face milling too. The point was to show how to not have to do any calculations. BTW you can "nest" m98/m99 code to do X-Y and Z.
Re: Multi pass facing program
« Reply #9 on: April 03, 2012, 07:01:10 PM »
I know, I been programming since 1984, Started this post for those that were new to sub programs and would like to see some examples of there use and how to apply them to their needs.