View Full Version : Macros


cncfreak
06-03-2003, 04:15 PM
Hi, I'd love to talk to people about Macros used in programming. I've created some of my own for use on a Haas VF-2. I have found little info in the web other than Haascnc.com and people that want to sell you something. It would be great to get something going here to share macros and come up with ideas for new macros.
Thanks
:cheers:

MPE racing
06-03-2003, 06:24 PM
Hi CNCfreak, I've done some macro programming. Mostly I've used it for changing tool diameters between loops to create tapers. I've also written one that does pocketing.

Go to www.programmingunlimited.com
This is a pretty good site. I would suggest you buy the book off him.

MachineSMM
06-03-2003, 06:48 PM
I have made a lot of Macros. Email me tomorrow and I can send you a whole bunch of them that I have made and gotten from other people.

Any questions in particular that I can help with. If there is anything that you do all of the time in your shop, you must make a macro for it. It can make your life much easier.

I use a Cad/Cam package called VX, www.vx.com. They have an internal macro language that I used to automate the programming fo some of are standard molds. It use to take about 2-4 hours to program these molds but now All you do is enter a couple of variables and presto the program is ready for the CNC.

Please fell free to contact me anytime

hardmill
06-03-2003, 09:29 PM
Who said macro?
Cool, what do you got in mind?:cool:

cncfreak
06-04-2003, 08:32 AM
Well I have two macros now one for face milling and one for side milling on a Haas mill. This mill is used in our Toolroom and we are always taking sawed stock and milling it square. When ever I write a cnc program I alway assume the stock is already milled to size and square. Becouse I never know what size of stock the toolmaker will grab. This way the toolmaker can grab any size stock they want and use the macros to quickly mill it to size and square. Then my Cad/Cam program will do the rest. I'm looking to do some macros on the Haas lathe but have found out that you cann't use macros in canned turnning cycles.

cncfreak
06-04-2003, 08:34 AM
If anyone has found a good use for macros for a lathe, I would love to hear about it.

Turbine
06-04-2003, 10:38 PM
I emailed ya a good un. I have more.:D

Turbine
06-04-2003, 10:50 PM
Here's a mill one to blast a circle pocket without a start hole. It has slick helical motion. :cool: My favorite lathe one is in your email. (Sorry guys... It wouldn't be right for me to post that one here as I did not write it.)

O9001
(VERSION 1.1 - 2/17/03)
(X=X CENTER)
(Y=Y CENTER)
(Z=FINAL DEPTH)
(B=BORE DIAMETER)
(C=CUTTER DIAMETER)
(D=DIRECTION, 2 OR 3)
(W=DEPTH PER PASS)
(R=START PLANE OF MATERIAL)
(F=FEED RATE)
#30=#4001
#31=#4003
#32=#4109
#33=#5043-#5083
IF[#24EQ#0]THEN#24=#5041
IF[#25EQ#0]THEN#25=#5042
IF[#18EQ#0]THEN#18=#33
IF[#9EQ#0]THEN#9=#32
IF[#26EQ#0]OR[#2EQ#0]OR[#3EQ#0]OR[#7EQ#0]OR[#23EQ#0]THEN#3000=1(INSUFFICIENT INFORMATION SUPPLIED)
IF[#23LE0]THEN#3000=1(ILLEGAL W SPECIFIED)
IF[#2LE0]OR[#3LE0]THEN#3000=1(BOTH BORE AND CUTTER DIA MUST BE GREATER THAN ZERO)
IF[#26GE#18]THEN#3000=1(DEPTH MUST BE LESS THAN START POINT)
IF[#26GT[#18-#23]]THEN#3000=1(W VALUE TOO GREAT)
IF[#3GE#2]THEN#3000=1(CUTTER CAN NOT BE BIGGER OR EQUAL TO BORE DIAMETER)
IF[#7EQ2]OR[#7EQ3]GOTO5
#3000=1(ILLEGAL DIRECTION SPECIFIED)
N5#29=#2/2-#3/2
G00G90X#24Y#25
Z[#18+#23]
#18=#18-#23
G01G91X#29Z-#23F#9
N10G#7X0.Y0.Z-#23I-#29J0.
IF[#18EQ#26]GOTO15
#18=#18-#23
IF[#18GT#26]GOTO10
#23=#18+#23-#26
#18=#26
GOTO10
N15G#7X0.Y0.I-#29J0.
G#7X-#29Y0.I-[#29/2]J0.
G00G90Z#33
G#30G#31F#32
M99

cncfreak
06-05-2003, 11:13 AM
Hay, Turbine I didn't recieve your e-mail.
and I cann't e-mail you through this board.
Thanks.

Turbine
06-05-2003, 10:21 PM
freak,
The program is too long.
I could not PM it either. There is a 3000 char. limit.
Check your PM anyways I sent you my email. :rolleyes:

ty1295
07-04-2003, 07:37 PM
If anyone has found a good use for macros for a lathe, I would love to hear about it.

I have developed at work a macro for turning aerospace piston rings. Basically you give info on raw material, tooling, speeds/feeds, and finshed part size. Macro then machines rings, keeping both turretts (4 axis lathe) in sync.

I also have sub running that double check operator has not changed chuck barriers or X offsets on machine, and either automatically fixes them, or throw up an alarm.

Program is now 4 subs, and the main totalling 6-7 pages. In the 2 + years it has been used, I bet it has machined close to a 1/2 million rings. Has saved MANY hours, and prevented several crashes.

I can't post the program, since it belongs to work, but I can guide in developing yours.

All mine was done on an Okuma, but other controls all operate similar.

I find myself using small macros even when doing simple 1 off parts. For example I tend to leave my math in the programs.

(G1 X=3.0+.05)

Helps me when I come back later, remeber where the numbers are coming from.

nocamhere
08-11-2003, 09:36 PM
Has anyone written a macro to repeat a subprogram x number of times? We do alot of repeated work at our shop. we'll load a large piece of stock into the machine and machine a profile into the stock. We then repeat the profile over in x...then the whole row down in y. we'll get like 8 parts froma single piece of stock....


has anyone written a macro to write the repeats for this? I've tried, but i keep getting illegal macro operation errors (fanuc 0i-ma)

Turbine
08-11-2003, 10:11 PM
nocamhere (good grief lad)
Does it need to be macro?
Can you take the profile/contour (whatever it is you're doing) and
make it a sub-program, and in the sub have a G91 X.... then when calling the sub just loop it.
M98P....L6

Ahh......You could use a G65 line to store XY incremental positions.
to make it quicker to change the positions.

....OR G10 it and use offsets.

To answer you question ...no. I like to mess with this kinda thing too. But as of tomorrow I'm on vacation for two weeks. :D
Hope you find what you need before that, but if not I'll try somthing when I get back.

hardmill
08-12-2003, 10:24 PM
I've tried, but i keep getting illegal macro operation errors (fanuc 0i-ma)

Why don't you show us a copy of what your trying to accomplish
and maybe someone can tweak it for you. Maybe like one
of the programs you said failed.

PEACE:D

nocamhere
08-13-2003, 07:54 PM
here's what i was trying


-------------------------------------
O8010

(CALLED AS FOLLOWS)

(G66 P8010 D_ C_ U_ V_ A_ B_ W_)
(WHERE)
(D = TOOL DIAMETER)
(C = CLEARANCE BETWEEN REPEATS)
(U = NUMBER OF X REPEATS)
(V = NUMBER OF Y REPEATS)
(A = X REPEAT DISTANCE)
(B = Y REPEAT DISTANCE)
(W = SUBPROGRAM TO REPEAT)

#10=#5003 (STORE PRESENT Z-POSITION)
#11=#4003 (STORE POSITION MODE G90/G91)
#1=#4001 (STORE G00/G01)
#4=#4109 (STORE FEEDRATE)
#15=#21 (STORE NUMBER OF X REPEATS)
#12=#5201 (STORE G54 X VALUE)
#13=#5202 (STORE G54 Y VALUE)
#14=#5203 (STORE G54 Z VALUE)

WHILE(#22GT0)DO1

WHILE(#21GT0)DO2
M98 P#23
#5201=#5201+#7+#3+#1
#21=#21-1
END1

#5201=#12
#5202=#5202-#7-#3-#2
IF(#21EQ0)THEN#21=#15
#22=#22-1
END2

G00 Z#10
#5201=#12
#5202=#13
#5203=#14
G#1 G#11 F#4
M99
------------------------------------

there's basically 2 while loops. The outside loop (1) handles all the y repeats. The inside loop handles all the X repeats. So it runs the subprogram you input, returns to the macro, shifts the coordinate system by the tool diameter plus some clearance...then increments the number of x repeats remaining. It then repeats the loop checking if there are any more repeats. If there are no more repeats in that row, it moves into the processing in the second loop....which shifts the machining orgin back to the start x position, moves it down in Y then ends....sending the loop back to the 2nd loop where it does the x repeats again.


I'm not sure where the error occurs


hope my explination wasn't too confusing.

MetLHead
08-13-2003, 08:41 PM
nocamhere,

Without actually trying it, I would say it's because you have the END1 before the END2. Try switching these around and see if that helps.

Regards,
Scott

Atom
08-19-2003, 05:50 PM
Syntax line =

G65 P9002 X10. Y-10. B4. C2. M10.

This will repeat sub O0010 in X direction 4 times, pitching 10mm and 2 times in Y at -10mm pitch.


:O9002 (G52 MACRO)
(X = X PITCH)
(Y = Y PITCH)
(B = REPEATS IN X)
(C = REPEATS IN Y)
(M = SUB PROGRAM TO CALL)
#1=0
WHILE [#1LT#3]DO1
#4=0
WHILE [#4LT#2]DO2
G52 X[#24*#4] Y[#25*#1]
M98 P#13
#4=#4+1.
END2
#1=#1+1.
END1
G52 X0 Y0
M99

Atom.

I.C.O.N.
12-04-2003, 01:08 PM
Has anyone used macros in probing? I have just begun studying and I am amazed at the possiblilties. I work in a short run job shop with a lot of nickle alloys, so tool wear is a big issue. We have two machines that can check and offset tools, although utilization is very minimal. Any encouraging stories welcome.

motomitch1
12-05-2003, 03:56 AM
will macros work with fadels VMC

I.C.O.N.
12-05-2003, 07:54 AM
Yes fadal has thier own langauge called Macro.
your machine must be equipped though. it is an option on many machines and I'm sure there are some without the option.

Brian J
12-08-2003, 12:41 AM
If it is a newer Fadal the Macro capability comes standard. I have written serveral programs for Fadals using macros, from simple offset writing, to a complete JIT process that an operator scans in a barcode and asks them to input the length of the blank they are using and the number of components they are making. The machine will then prompt the operator for the tooling required, calculate the offests based on the length of the part machined, and what operations need to be preformed on the blank to finish the part.

kraig
03-11-2004, 06:55 PM
Anyone having any macro's? I would be glad to exchange the 50 or 60 I have for any you have.

kraig
03-11-2004, 06:59 PM
I have 50 or 60 macros I will exchange with anyone who shares what they have.

Thanks Kraig

Al_The_Man
03-11-2004, 07:42 PM
I.C.O.N. I just picked up a Heidenhain probe for a steal on ebay and am looking at writing some standard probe routines, I don't no wether to reverse engineer some Renishaw ones or start from scratch.
Al

sjbailey
05-06-2005, 06:04 PM
Three questions:

1. Are Fadal macros written within the G code?

2. What Fadal controller models can accept macros?

3. Anyone got a Fadal macro for parts counting?