What's new
What's new

Help With Fanuc Subprograms/Routines To Repeat Parts

kazlx

Hot Rolled
Joined
Nov 22, 2010
Location
Tustin, CA
I have a pretty old ('89) drill/tap machine that doesn't have any way to drip feed code. The control is a Fanuc OM-Mate I'm trying to figure out if I can sort of get around this by programming one/two parts and then using that as a subroutine inserted into a short master program telling the machine to go to different work offsets and repeat at different vises/locations. This way I can use my two vises to run duplicate parts and maximize spindle time. Does anyone have a sample of this that would help? I'm currently using Fusion 360. Posts run fine and machine runs good parts, I'm just not sure how the logic/programming should go to achieve this.

I found that it looks like you call a subroutine for a program by using P instead of O with the appropriate program number.

Disclaimer: I'm not super savvy with manual code entry, but trying to learn.
 
%o0001
M6 T1
M3S6000
M8
G90 G54
M98 P002
M98 P003
G91G28G0Z0
G28Y0
M30

O0002
G90 G0 X0 Y0
G43 H1 Z.1
G81 Z-.1 F10. R.1
G80
M99

O0003
G52 X1. Y0.
M98P002
G52 X2. Y0.
M98P002
G52X0Y0
M99
%
m98 calls the sub program

the g52 code in the 003sub routine will add the given value to the active workshift. repeat as necessary and dont forget to cancel at the end with the g52 x0y0 command. Im assuming you can follow the rest of the code but dont hesitate to ask if there is a question or I fudged something up.

or

%o0001
M6 T1
M3S6000
M8
G90 G54
M98 P002
G90 G55
M98P002
G90G56
M98P002
ETC...
ETC...
ETC...
G91G28G0Z0
G28Y0
M30

O0002
G90 G0 X0 Y0
G43 H1 Z.1
G81 Z-.1 F10. R.1
G80
M99

here you will have to set a value for each workshift presented
 
Ok, I think I follow that. I'm basically looking to post out the code from fusion for my part, run at my G54, then shift everything over say 10" to the right or whatever and run the exact same thing again in the second vise.
 
So the G52 adds to whatever is active. So if I post out to the 54, the G52X10Y0 would just move 10" in X?
 
So the G52 adds to whatever is active. So if I post out to the 54, the G52X10Y0 would just move 10" in X?

Yes the G52 X10 will bump you over 10" from whatever is in g54.. you can do the same for Y and Z if need be.

Usually if im going vice to vice or station to station or fixture to fixture I would use the 2nd method I posted and pick up each WCS. the first method is how I would run multiple pcs on a strip of material. I should have probably elaborated but Im also in the middle of a setup so excuse me for being brief

If you dont have extended workshifts in the machine then the g52 will be very very handy
 
You could also find your offset positions and write them in the program.

G90
G10 L2 P1 X-20. Y6.000 Z-5.400(Made up work offset. L2 P1 is G54, P2 is G55, etc. Then L20 P1 starts the G54.1's. )
M98 P0001 (machining program)

G90
G10 L2 P1 X-10.000 Y6.000 Z-5.400 (rewrite G54 with a new position.)
M98 P0001
M30
 
Or just leave the work offset out of the sub program and call:

G54
M98 P2 L1
G55
M98 P2 L1
G56
M98 P2 L1

You can get fancy and post each tool as a program (T1 is O0001, T2 is O0002) and the run code as program O0100 (just so tools match their respective program number) Then:

O0100 (Run File)
(normal start code)
G54
M98 P1 L1
G55
M98 P1 L1
M98 P2 L1
G54
M98 P2 L1
M98 P3 L1
G55
M98 P3 L1
(FINISH CODE)

That will save tool changes and positioning time. Call T1 on side 1, then side 2. Then tool 2 on side 2 then side 1 etc
 
How's this look if I wanted to run a facing routine at my normal G54 in talons and add a G56 in another set of talons? I already have G55 set for my soft jaws.

%
O1001
G90 G54
M98 P1002
G90 G56
M98 P1002

G91G28G0Z0
G28Y0
M30


---------------------------------------------------------

%
O1002
(T1 D=3. CR=0. - ZMIN=0.74 - FACE MILL)
(T2 D=0.375 CR=0. - ZMIN=0.085 - FLAT END MILL)
(T3 D=0.25 CR=0. TAPER=90DEG - ZMIN=0.69 - SPOT DRILL)
(T9 D=0.125 CR=0. - ZMIN=0.69 - FLAT END MILL)
(T10 D=0.1094 CR=0. TAPER=118DEG - ZMIN=-0.03 - DRILL)
(T12 D=0.138 CR=0. - ZMIN=0.085 - RIGHT HAND TAP)
N10 G90 G94 G17 G49 G40 G80
N15 G20
N20 G28 G91 Z0.
N25 G90

(FACE1)
T1 M06
T2
S2500 M03
G54
G00 X1. Y1.4277
G43 Z1.35 H01
G00 Z0.95
G01 Z0.74 F65.
Y0.7777
Y-2.7777 F50.
G00 Z1.35
M05
G28 G91 Z0.
G90
G49


M09
G28 G91 Z0.
G49
G28 X0. Y0.
 
No need to position, turn off spindle or coolant at the end of the sub, and you need a M99 at the end of the sub to return it to the main so it can go on to the next line in the main code.

Move this to the main program:

M05
G28 G91 Z0.
G90
G49


M09
G28 G91 Z0.
G49
G28 X0. Y0.


And replace it with:
G28 G91 Z0.
G90
G49
M99

that way the spindle and coolant don't turn off between parts, or waste time running back and forth from G28 X0. Y0.
 
the coolant and spindle will turn off when you m6 or m30... its written in the macro....and believe it or not it does take an XXX amount of time for the machine to process that code and it does cut cycle time when you take it out of your post. And If im not mistaken the OP can use all the mem he can get ;) :cheers:
 
I’ve got 32K max to work with and can’t drip feed so trying to chop as much as possible to help.

assuming you generated your toolpath in CAM...

One down fall of CAM, is it generates messy code. Almost looks like in cam, you extended your toolpath 2" in Y and CAM needlessly posts out a y.777 when it has to hit that value to get from Y1.4277 to Y-2.7777 anyway. Some CAM will also break up arcs on the quadrant. So it generates a tone of code just to make one pass on a diameter. You maybe able to change this depending on your CAM software.

Ditch your block numbers remove spaces and all the title block stuff that isnt important.
 
What alloutmx said. There is a TON of unnecessary code here. Tool numbers/names I use, but if limited you can make one small note and remove 'corner radius' call out on a spot drill. It's none ;)

%
O1001
G90 G54
M98 P1002
G90 G56
M98 P1002

G91G28G0Z0
G28Y0
M30


---------------------------------------------------------

%
O1002
(T1 D=3. CR=0. - ZMIN=0.74 - FACE MILL)
(T2 D=0.375 CR=0. - ZMIN=0.085 - FLAT END MILL)
(T3 D=0.25 CR=0. TAPER=90DEG - ZMIN=0.69 - SPOT DRILL)
(T9 D=0.125 CR=0. - ZMIN=0.69 - FLAT END MILL)
(T10 D=0.1094 CR=0. TAPER=118DEG - ZMIN=-0.03 - DRILL)
(T12 D=0.138 CR=0. - ZMIN=0.085 - RIGHT HAND TAP)

N10 G90 G94 G17 G49 G40 G80
N15 G20
N20 G28 G91 Z0.
N25 G90

(FACE1)
T1 M06
T2
S2500 M03
G54
G00 X1. Y1.4277
G43 Z1.35 H01
G00 Z0.95
G01 Z0.74 F65.
Y0.7777
Y-2.7777 F50.
G00 Z1.35
M05
G28 G91 Z0.
G90
G49
M99

M09
G28 G91 Z0.
G49
G28 X0. Y0.
 








 
Back
Top