Macro B

I came across a bunch of old Macro B programs, from when I was on the shop floor and actually worked for a living.

Made me wonder if anyone still uses Macro B and / or manually programs anymore.

We don't here. For the most part everything comes from the CAM system. We pretty much just have operators on the machines now.

Back in the day we only used CAM for core / cavity work, all of the mold base and misc. components were manually programmed while you kept the machine running.

Following is a utility macro I kept in the control to zero out all the variable registers, maybe it's useful to someone.

% O9994(0-REGISTERS ) () (TOOL-OFFSET-REGISTERS) () #1=200 WHILE[#1GT0]DO1 G90G10P#1L10R0 G90G10P#1L11R0 G90G10P#1L12R0 G90G10P#1L13R0 #1=#1-1 END1 () (VARIABLE-REGISTERS-100-199) () #1=199 WHILE[#1GE100]DO1 #[#1]=0 #1=#1-1 END1 () (VARIABLE-REGISTERS-500-599) () #1=599 WHILE[#1GE500]DO1 #[#1]=0 #1=#1-1 END1 M30 %

Reply to
Kelly D. Grills
Loading thread data ...

Never used them except for renishaw probe routines that automsatically squared up angle plates set work coordinates inspected bore sizes etc, and those were all written by someone else so rarely did I ever actually have much of a need to gain anything but rudimentary knowledge about them.

However, more recently I could actually use something like that--specifically, in order to take a single known incremental distance ( from machine grid to a fixed point on a fixture) ( a base plate with 2 chick vises ) and have the macro automatically preset g54 g55 g56 and g57 for me at start of the program(s)..

The reason for this is because the part family runs in 2 chick vises that are mounted on a baseplate and comes in several different widths, so y axis setpoint varies on a per part basis...also, there are short and long versions which require moving pins ( actually they are brass screws ) for x axis..I added a hole to the center of the solid jaw I can indicate the vise on the left, currently I use cad/cam to calculate all of the other workstation positions but it sure would be nice to simply indicate the hole when the fixture is initially bolted to the table, input the hole loc as say..G59 and from then on simply let the machine calculate the rest...

Oftentimes, the fixture goes onto the machine and stays there for literally months at a time...As it is, I use g10 commands. tailored for each part program...which ( once established ) allows me to easily change from one part to another by simply changing over to the new program...but once the fixture comes off it's time to start all over again...

Reply to
PrecisionmachinisT
  • PrecisionmachinisT :

Inorder to make sure I understand correctly...

IOW we want G54 - G57 to be relative to G59?

G59 = Fixture reference hole G54 = Part #1, which is X1.Y1. from reference hole G55 = Part #2, which is X2.Y2. from reference hole G56 = Part #3, which is X3.Y3. from reference hole G57 = Part #4, which is X4.Y4. from reference hole

We mount our fixture and pick up our reference hole it happens to be at X10.Y10., G59=X10.Y10.

So our part origins would be: G54 = X11.Y11. G55 = X12.Y12. G56 = X13.Y13. G56 = X14.Y14.

Reply to
Kelly D. Grills

yup pretty much you got it...I'm in the shop now, looking at my cad drawing--and assuming 2in wide stock, the actual incremental distances from my indicated hole ( G59 ) are as follows:

G54= X-2.5 Y-.74 G55= X-2.5 Y 3.74 G56= X 7.5 Y 3.74 G57= X 7.5 Y -.74

The above values would change on a per-program basis, depending on how wide the stock is, and upon whether the brass screws are positioned for short or for long work..( for short work, they screws would be +2.00 from the above).....Which I should be able to deal with once I had a working basic macro template..

Actually this is on a Fadal but the code should be pretty much identical...

--Also I would likely eventually implement onto a 4 axis Fanuc multi pallet machine I've been re-tooling so as to use a pair of 8 station tower vises....

The vise jaws have already been cut in, with coordinates that were qualified off of the machines' physical origins ( X Z center of rotary table ) and since this machine has a 80 tool atc, the plan here is to leave the "jaw-cutting tools" intact and in the unfortunate event a crash occurs, simply put new jaws in, re-run the jaw-cut program and it's off to the races...

Reply to
PrecisionmachinisT

OOPS

G54= X-2.5 Y-.74 G55= X-2.5 Y 3.74 G56= X 5.5 Y 3.74

Reply to
PrecisionmachinisT

OOPs again, it's for 3in wide material...

Reply to
PrecisionmachinisT
  • PrecisionmachinisT :

An initial thought to make life simpler (til we hash something out) is to use your common fixture offset, rather than G59. You could then use the actual incremental values for G54 - G57. G92 comes to mind also, but may be more complicated.

What does the G10 statement(s) that you're currently using to populate the fixture offsets look like?

Reply to
Kelly D. Grills

FANUC:

P0=initial work offset--is dumped into the registers at refrence return

P1 ~ P6 corresponds to G54 thru G59

G10G90 L2 P0 X 00068870 Y-00098480 Z-00156530 B 00000000 G10G90 L2 P1 X 00000000 Y 00000000 Z 00000000 B 00000000 G10G90 L2 P2 X 00000084 Y 00000101 Z 00000000 B 00000000 G10G90 L2 P3 X 00000000 Y 00000000 Z 00000000 B 00000000 G10G90 L2 P4 X 00000000 Y 00000000 Z 00000000 B 00000000 G10G90 L2 P5 X 00000000 Y 00000000 Z 00000000 B 00000000 G10G90 L2 P6 X 00000000 Y 00000000 Z 00000000 B 00000000

Fadal is the same except the controller has an expanded offset table, and so :

P0=initial work offset--is dumped into the registers at refrence return

P1 ~ P48 corresponds to E1 thru E48

Reply to
PrecisionmachinisT
  • PrecisionmachinisT :

Alright, that's the usual G10 call. I'll have a look at it all again tomorrow. I'm just looking at this in between paths generating, verifying, etc. so bear with me.

Reply to
Kelly D. Grills

No prob.

--I'm not in any kind of a hurry whatsoever....

Reply to
PrecisionmachinisT
  • PrecisionmachinisT :

Just to get started I've hacked up a program that will (should!) set G54 - G57 relative to G59. It's not the best way and there is no error handling, but it'll be proof of concept.

I don't have Vericut or a machine available to prove this out, so you're gonna have to do the testing. There aren't any motion commands, so you're not gonna crash.

I originally intended to use G10 statements, as that's what you're currently doing, but it's just much more straight forward to directly access the system variables.

Pick up the machine coordinates of the fixture reference hole and edit the variable assignments for #102, #102, #103 (X,Y,Z) to reflect. These will be assigned to G59.

Edit the variable assignments for #111 - #143 to the required values (relative to the ref. hole). These will be added to G59 and assigned to G54 - G57.

Run the program and pray!

Check you're fixture offset page to see how I did.

Program follows:

% O1000(ASSIGN-WORK-OFFSETS) () (##########################) (###-CAUTION-NOT-PROVEN-###) (##########################) () (ASSIGN-WORK-OFFSETS-WITH-SYS-VARS) (MODIFY-#101-THROUGH-#143-TO-SUIT) () (G59-X-Y-Z-IS-REF-HOLE) () #101=100.0 #102=100.0 #103=100.0 () (G54-X-Y-Z-RELATIVE-TO-REF-HOLE) () #111=-2.5 #112=-0.74 #113=0.0 () (G55-X-Y-Z-RELATIVE-TO-REF-HOLE) () #121=-2.5 #122=3.74 #123=0.0 () (G56-X-Y-Z-RELATIVE-TO-REF-HOLE) () #131=7.5 #132=3.74 #133=0.0 () (G57-X-Y-Z-RELATIVE-TO-REF-HOLE) () #141=7.5 #142=-0.74 #143=0.0 () (##################################) (#####DO-NOT-MODIFY-PAST-HERE######) (##################################) () (G59) (SYS-VARS-#5321-#5322-#5323) (COMMON-VARS-#101-#102-#103) () #5321=#101 #5322=#102 #5323=#103 () (G54) (SYS-VARS-#5221-#5222-#5223) (COMMON-VARS-#111-#112-#113) () #5221=#5321+#111 #5222=#5322+#112 #5223=#5323+#113 () (G55) (SYS-VARS-#5241-#5242-#5243) (COMMON-VARS-#121-#122-#123) () #5241=#5321+#121 #5242=#5322+#122 #5243=#5323+#123 () (G56) (SYS-VARS-#5261-#5262-#5263) (COMMON-VARS-#131-#132-#133) () #5261=#5321+#131 #5262=#5322+#132 #5263=#5323+#133 () (G57) (SYS-VARS-#5281-#5282-#5283) (COMMON-VARS-#141-#142-#143) () #5281=#5321+#141 #5282=#5322+#142 #5283=#5323+#143 () M30 %

Reply to
Kelly D. Grills

Kelly,

Thanks, appreciate the effort, and it's probably good code...but I'm going to have to shelve it till I get the fanuc project further along.

Not all is lost though--while fanuc and fadal use the same call for g10; the macro # programming bears very little resemblance...so, after looking in my fadal book, I found out that it's actually pretty easy to do this..in fact, only takes 3 lines of code...

Tested this morning and for Fadal, the syntax is as follows:

N1 #FX1=FX48-2. N2 #FY1=FY48+1. N3 #FZ1=FZ48-.25.

The above code will read the current value of fixture offset # 48, and modify it by the amount and sign at far right of the expression, finally writing the result into the E1 (G54 ) offset register.

Reply to
PrecisionmachinisT
  • PrecisionmachinisT :

Basically the same thing I did. I just used the common variables to add flexibility for the future.

In Fanuc that would be:

#5221=#5321-2. #5222=#5322+1. #5223=#5323-.25

Oh well, was a fun diversion.

Reply to
Kelly D. Grills

Aww but it also served to clearly define the objectives in my own mind...

Which, on the Fadal is to implement a system where the operator only need set offset E48 and have the part program automatically update E1 through E4 as needed.on a per-program basis.

And on the Fanuc, it will basically be the same, except only G54 and G55 will be be used....also, thinking about it....really no need to use g59, instead use G53--which is always stable, having been preset by parameter uon initial grid return...leaving g56 through g59 as still available for use with other pallets..

Reply to
PrecisionmachinisT

PM, Antony who used to visit here wrote a nice article on Macro B for Fanuc at Practical Machinist. Here is a link:

formatting link
Best, Steve

Reply to
Garlicdude
  • PrecisionmachinisT :

Careful, yer startin' to think awful hard. ;-)

Reply to
Kelly D. Grills

Hopefully, my won't explode...

Reply to
PrecisionmachinisT

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.