What's new
What's new

need help figuring out new position in a macro

acncguy

Aluminum
Joined
Dec 8, 2012
Location
WI, USA
Hello,

We have some housings we are repairing on an HMC that need bores opened-up. There are three bores on one side and we need to hold the bore-to-bore relationship. I'm looking for help writing a macro to calculate where to move one of the bores after finding the location of another bore to keep the bore-to-bore distances so we don't have to shim the part to get it lined-up. (We only have a B-axis on this HMC so we would need to shim the part for the C-axis unless a macro can be written for this.)

I've attached a drawing showing three bores, -A-, -B- and -C-. I will probe the -A- (X0Y0) and -B- bores. -A- & -B- should be 26.378" from each other in the X-axis and the same location in the Y-axis. If the -B- bore is off location in the Y-axis and the X-axis distance is good, how would I calculate what to move the -C- axis based on my drawing? They are not on the same radius from -A-, so I can't just calculate the angle and use G68 to rotate -C-.

On the drawing I was just messing around and the red dimensions are what the distances are supposed to be and the green was with the Y-axis for the -B- bore +.020 from where it should be, then I just figured the angle and rotated the -C- bore that amount and it didn't work out so well, because they are not on the same radius from -A-.

Anyway, thanks for any help.


Regards,

Paul



Rotate -C- from -B- position.jpg
 

Attachments

  • Rotate -E- from -G- position.jpg
    Rotate -E- from -G- position.jpg
    17.1 KB · Views: 140
Calculate the angle to bore C based on the print with A and B horizontal.

Probe A, call it G54.
Probe B, call it G55.
Calculate the angle that B is off horizontal. (It' going to be really small)
Add or subtract that angle from the calculated angle to bore C. (Depending if B is above or below horizontal)
Recalculate the new X,Y of bore C at the new angle. Call it G56.
Bore your holes at G54 X0Y0, G55X0Y0, G56X0Y0.

This is the basic logic. The macro and syntax is up to you.

You will still need to indicate the face square. That could be probed and calculated to rotate your B axis square too
 
Probe A and set as WCS zero.
Probe B and use position error X and Y values to determine angle.
Use condiional (IF) logic and sign of Y error to determine direction of rotation.
Apply G68 rotated about A bore /WCS zero
Bore all 3.
 
Thanks for the replies.

It was very simple, I got screwed up because I had the drawing wrong (datum -C- bore in the wrong location to start with), so when I rotated it the angle -B- was off to -A- and checked it -C-'s position, it wasn't in the correct location which threw me off thinking I had to do some added steps to calculate the position of -C- to -B-, when all I have to do is G68 the angle -B- was off to -A-.

Anyway, the first time we are going to do this the guy on the floor wants to indicate the position of -B- and do the calculation manually instead of using something like the feature-to-feature renishaw cycle (O9834) to calculate the angle, etc., so I'm going to attempt to write the macro for this later, I may need some help. If I get it to work without help, I'll post what I did for reference in case anyone who runs across this post wants to do something like this.

Thanks again for the replies.


Regards,

Paul
 
For what it's worth, here is the macro I wrote to calculate the angle of rotation based on what was found when indicating bore -B- from programmed X0Y0 (Bore -A-), so I can use G68 (coordinate rotation) to rotate the program to put bore -C- in the correct position:

Call Program:
G65P1234R23.378

Macro (just the formula's):
#601=[#5241-#5221]-#18 (G55 X-axis Position from G54 Pos)
#602=[#5242-#5222] (G55 Y-axis Position from G54 Pos)
#606=ASIN[#602/#601] (Angle of Rotation)

I also put some error traps in and a #3006=1 to stop the program with a message to indicate the c'bore.

In the main program, the line to activate the G68 would look like so:
G68X0Y0R#606 (X0Y0 is the C/L of rotation, R is the Angle of Rotation)
If you did work on the opposite side, the R value would become negative (G68X0Y0R-#606).

NOTE: Each bore was assigned a different work offset (G54 = -A-, G55 = -B-, G56 = -C-), however their positions were not all X0Y0 for each bore, hence the formula the way it was written.

For those that don't know, if you are using a renishaw probe for this with inspection plus software, you can use the feature-to-feature cycle (O9834)to calculate the angle. This is a no-movement macro that is used after two measuring cycles to determine feature-to-feature data. You can do it like this:

G65P9814D10.S1 (Probe 1st bore)
G65P9834 (Stores position data)
- Position to next bore -
G65P9814D5.
G65P9834X0.Y14.6455 (Comparing data and calculating angle. The X & Y values are the expected distances from the 1st bore to the 2nd.)
#601=#144 (The calculated angle is stored in common variable #144. This is volatile common variable so I move it to a non-volatile common variable so the value isn't lost on control reset, M30, etc.)

Then use the G68 as shown above.


Regards,

Paul
 








 
Back
Top