I want the control to calculate fixture offsets for me by using macros (fanuc macro . I'm not quite sure how to write the formula for this.

What I have is a horizontal machining center with a rotary B-axis. I want to manually enter the X-axis and Z-axis numbers (for the work offsets) at B0 (G54), then run the program and have the formula in the program enter in the rest of the work offsets at the other B-axis angles.

For instance, if I entered in ".0500" for X-axis and "9.0000" for Z-axis, the offsets at B180.000 would be just the opposite signs (-.0500 & -9.0000, respectively). That would be easy enough to write. But I need the formula to be able to calculate at "odd" B-axis angles, like say 103.250 (The answers would be X-8.7719, Z-2.0141), using trigonometry.

So for an example, if I had a G54 (B0) offset with the X & Z-axis numbers given (I enter and these numbers represent distance from c/l of index), I would want to calculate for the X & Z-axis numbers for G55 (@B103.250). I would want the formula to consider what is in the G54 X & Z work offsets (#5221 & #5224), then calculate for the new X & Z work offsets based on what's in the B-axis offset for G55 (#5246), and automatically enter in the table. I know I need to use SIN and COS, but I'm not sure exactly how and where...

I hope I explained that well enough.

Any help is appreciated....