What's new
What's new

Prevent Simulator from Changing Offsets with Probing Macros?

Isak Andersson

Aluminum
Joined
Nov 3, 2021
Hi. This is a pretty annoying problem I have with our Haas VF4 (NGC). I use a fair amount of probing macros with this machine and the macros themself work flawlessly. The problem is that the simulator will sometimes reset offsets after probing. Same thing will happen if setting 36 - Program Restart is on and you try to restart the program at any point. Is there any way of preventing this from happening? Maybe a setting that only allows offsets from changing while actually running the program? Thanks!

This is one of the macros that gives me this problem:

%
O19002 (ALIGN PART WITH PLANE IN 4TH AXIS)

G103 P1 (LIMIT LOOK-AHEAD TO ONE BLOCK)

(A #1 = PLANE ANGLE)
(B #2 = START ANGLE)
(W #23 = OFFSET NUMBER)
(X #24 = MEASURE POINT X)
(Y #25 = MEASURE POINT Y)
(Z #26 = MEASURE POINT Z TOP)
(U #21 = MEASURE POINT Z BOTTOM)
(V #22 = MEASURE DISTANS X)
(#10000 ANGLE)
(#10001 DIM1)
(#10002 DIM2)
(#10003 X DELTA)
(#10004 Z DELTA)
(#10188 DIM)
#10005= 3. (ROUGH TOLERANCE)
#10006= 0.01 (FINE TOLERANCE)
#10007= 0. (TOTAL ANGLE)
#10008= 4144 + 20 * #23 (A OFFSET SYSTEM VARIABLE NUMBER)

T30 M06
G00 G90 G53 Z0
G53 A [#1 - #2]
G#23 X#24 Y#25
G43 H30 Z100.
G65 P9832 (ACTIVATE PROBE)
N1
G65 P9810 X [ #24 + #22 ] Z#26 F3000 (SAFE MOVE)
G65 P9811 X#24 (MEASURE TOP POINT IN X)
#10001= #10188 (SAVE RESULT)
(IF POINT IS OUTSIDE ROUGH TOLERANCE. ALARM OUT.)
IF [ #10001 LT #24 - #10005 ] GOTO0
IF [ #10001 GT #24 + #10005 ] GOTO0
G65 P9810 X [ #24 + #22 ] Z#21 (SAFE MOVE)
G65 P9811 X#24 (MEASURE BOTTOM POINT IN X)
G00 Z100.
#10002= #10188 (SAVE RESULT)
(IF POINT IS OUTSIDE ROUGH TOLERANCE. ALARM OUT.)
IF [ #10002 LT #24 - #10005 ] GOTO0
IF [ #10002 GT #24 + #10005 ] GOTO0
#10003= #10002 - #10001 (X DELTA)
#10004= #26 - #21 (Z DELTA)
#10000= ATAN[ #10003 / #10004 ] (CALCULATE ANGLE)
#10007= #10007 + #10000 (ADD ANGLE TO TOTAL ANGLE)
G91 G00 A#10000 (GO TO CALCULATED ANGLE)
G90
(IF X DELTA IS OUTSIDE FINE TOLERANCE. MEASURE AGAIN)
IF [ #10003 LT - #10006 ] GOTO1
IF [ #10003 GT #10006 ] GOTO1
#[ #10008 ]= #10007 + #2 (ADD TOTAL ANGLE AND START ANGLE TO A OFFSET)
G65 P9833 (DEACTIVATE PROBE)
G103 (ACTIVATE LOOK-AHEAD)

M99

N0
G00 G90 G53 Z0
G53 Y0
#3000= 15 (ALIGN PART!)
M30
%
 
Last edited:

Booze Daily

Titanium
Joined
Sep 18, 2015
Location
Ohio
I'm gonna guess here...

In simulation it processes your macros using whatever values are currently in your user variables since you're not actually probing anything.

Same thing happenes with program restart. It procesess your program without using relevant data since you're not physically probing anything to make those variables current.
 

Isak Andersson

Aluminum
Joined
Nov 3, 2021
I'm gonna guess here...

In simulation it processes your macros using whatever values are currently in your user variables since you're not actually probing anything.

Same thing happenes with program restart. It procesess your program without using relevant data since you're not physically probing anything to make those variables current.
Yeah, that's definitely what's happening. The question is how to deal with it in a foolproof way. Of course, refraining from using the simulator after probing would work but the operator might not know this. Could end badly...
 

Booze Daily

Titanium
Joined
Sep 18, 2015
Location
Ohio
The only way I can think of is to not re-use any of the variables for the macros used in the program.
Even if it means making multiple versions of the same to be used
The variables need to remain unchanged til M30.
 

thesidetalker

Hot Rolled
Joined
Jan 11, 2015
Location
Bay Area, CA
Skip the probe section.
(if setting 36 is on)
IF [ #6036 EQ 1 ] GOTO123

You can also test to see if you're running in graphics by adding some dwell. Graphics processes it instantly, while running the program in memory or mdi will not. If I remember right I think you need look-ahead disabled for it to work. I had problems with a toolchange macro running incorrectly in graphics and this solved it (to skip the problematic section in graphics).

G103P1
#3001= 0
G04 P250
IF [ #3001 LT 200 ] GOTO123
(probe stuff)
N123 G103
 

Isak Andersson

Aluminum
Joined
Nov 3, 2021
You can also test to see if you're running in graphics by adding some dwell. Graphics processes it instantly, while running the program in memory or mdi will not.
That's kinda genius actually. Definitely gonna test this later.

Edit:
Just tried it. Works great. Thanks!
 
Last edited:








 
Top