What's new
What's new

B-axis correction Macro question

acncguy

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

I have a question regarding B-axis correction (straightening) Macro below(I think it was originally written and presented by PROBE here on PM).

On the two lines "G31Z[#30]F20.", will the machine stop feeding right at that expected surface position, or will it travel beyond the expected position to search for a surface to contact? I'm guessing it will stop, and then what? Give an error? Should I just give a deeper number for the Z-axis variable that's passed in the Macro call, ensuring the probe will contact the surface? The only thing is these are large castings and can vary quite a bit.

The Macro call line would look like this: G65P7438X78.11Z24.8S1.

This horizontal machining center uses a Fanuc Series 15M control. The probing software is NOT renishaw inspection plus software, and it doesn't have a 4th axis correction macro cycle like renishaw's inspection plus Macro O9817, therefore I want to try this Macro. In Macro cycle O9817, there is a default overtravel distance of 10mm - the distance the probe travels beyond the expected position when it searches for a surface. I guess that brings up another question: How would this be written into this Macro?

Thanks for any help.

Regards,

Paul



#30=#26-#5023
G91
#1=#5023
G0X-[#24/2]
G1Z[#30+1.]F100.
#30=#26-#5023
G31Z[#30]F20.(Using skip signal G31 to feed the probe to hit the work surface)
#2=#5023
G0Z.75
#3004=2
G31Z[#2-#5023]F2.
#3=#5063
#3004=0
G0Z[#1-#5023]
X#24
()
G31Z[#30]F20.
#2=#5023
G0Z.75
#3004=2
G31Z[#2-#5023]F2.
#4=#5063
#3004=0
G0Z[#1-#5023]
#5=ATAN[[#4-#3]/[#24]]
G90
#[5204+[20*[#19]]]=#[5204+[20*[19]]]+#5
M99
 
Hello,

I have a question regarding B-axis correction (straightening) Macro below(I think it was originally written and presented by PROBE here on PM).

On the two lines "G31Z[#30]F20.", will the machine stop feeding right at that expected surface position, or will it travel beyond the expected position to search for a surface to contact? I'm guessing it will stop, and then what? Give an error? Should I just give a deeper number for the Z-axis variable that's passed in the Macro call, ensuring the probe will contact the surface? The only thing is these are large castings and can vary quite a bit.

The Macro call line would look like this: G65P7438X78.11Z24.8S1.

This horizontal machining center uses a Fanuc Series 15M control. The probing software is NOT renishaw inspection plus software, and it doesn't have a 4th axis correction macro cycle like renishaw's inspection plus Macro O9817, therefore I want to try this Macro. In Macro cycle O9817, there is a default overtravel distance of 10mm - the distance the probe travels beyond the expected position when it searches for a surface. I guess that brings up another question: How would this be written into this Macro?

Thanks for any help.

Regards,

Paul



#30=#26-#5023
G91
#1=#5023
G0X-[#24/2]
G1Z[#30+1.]F100.
#30=#26-#5023
G31Z[#30]F20.(Using skip signal G31 to feed the probe to hit the work surface)
#2=#5023
G0Z.75
#3004=2
G31Z[#2-#5023]F2.
#3=#5063
#3004=0
G0Z[#1-#5023]
X#24
()
G31Z[#30]F20.
#2=#5023
G0Z.75
#3004=2
G31Z[#2-#5023]F2.
#4=#5063
#3004=0
G0Z[#1-#5023]
#5=ATAN[[#4-#3]/[#24]]
G90
#[5204+[20*[#19]]]=#[5204+[20*[19]]]+#5
M99

What are the values in your command line G65P7438X78.11Z24.8S1.? Absolute (expected position of the surface) or incremental (distance to go to meet the surface)? Is tool offset applied or not ?
 
What are the values in your command line G65P7438X78.11Z24.8S1.? Absolute (expected position of the surface) or incremental (distance to go to meet the surface)? Is tool offset applied or not ?

Hi PROBE,

Thanks for the reply!

The command line is in absolute, which is the expected position of the surface (Z24.8).

And, yes, the tool offset is applied.

Also, just curious if in the line that is calculating the angle, do I need the brackets the way they are, or could it be written like this: #5=ATAN[#4-#3]/[#24]? I believe the way you had it programmed was #5=ATAN[#4-#3]/[50.+50], so I'm sure the brackets are set correctly, I just wasn't 100% certain so I added the brackets around the math after the ATAN just to be sure (or will that do something I don't want?).

Thanks for your help.


Regards,

Paul
 
In your program, ATAN has an illegal extra bracket. On newer control versions (model D) ATAN can be used in several ways.
 
In your program, ATAN has an illegal extra bracket. On newer control versions (model D) ATAN can be used in several ways.

Hi sinha,

Thank you.

So the ATAN line should be: #5=ATAN[#4-#3]/[#24], not #5=ATAN[[#4-#3]/[#24]]?


Regards,

Paul
 
On the two lines "G31Z[#30]F20.", will the machine stop feeding right at that expected surface position, or will it travel beyond the expected position to search for a surface to contact? I'm guessing it will stop, and then what? Give an error? Should I just give a deeper number for the Z-axis variable that's passed in the Macro call, ensuring the probe will contact the surface? The only thing is these are large castings and can vary quite a bit.
Hello Paul,
The machine will stop at the position specified with G31 if the Skip Signal is not Input during the move. If the Skip Signal is Input, execution of the command is interrupted and the next block is executed. Accordingly, you should have a contingency for the Skip Signal NOT being input, as well as the expected result. The tool position where the Skip Signal is turned on in a G31 block is held in variables #5061 to #5068. When the skip signal is not turned on in a G31 block, the end point of the specified block is held in these variables.

Have you tested your program at all, or are you asking the questions before doing so? The reason I ask is that I would expect #5023 to be a Minus value and therefore #30=#26-#5023 would result in #30 being a Plus value; subtracting a Minus value is the same as adding the Absolute of the Minus value. Accordingly, G1Z[#30+1.]F100. would result in a Positive Incremental Move and G31Z[#30]F20 a Negative Incremental Move less that the previous Positive Move.

Regards,

Bill
 
When the skip signal is not turned on in a G31 block, the end point of the specified block is held in these variables.

I was not very sure about this. Never tested it. Error message would have been a better logic.
 
Hello Paul,
The machine will stop at the position specified with G31 if the Skip Signal is not Input during the move. If the Skip Signal is Input, execution of the command is interrupted and the next block is executed. Accordingly, you should have a contingency for the Skip Signal NOT being input, as well as the expected result. The tool position where the Skip Signal is turned on in a G31 block is held in variables #5061 to #5068. When the skip signal is not turned on in a G31 block, the end point of the specified block is held in these variables.

Have you tested your program at all, or are you asking the questions before doing so? The reason I ask is that I would expect #5023 to be a Minus value and therefore #30=#26-#5023 would result in #30 being a Plus value; subtracting a Minus value is the same as adding the Absolute of the Minus value. Accordingly, G1Z[#30+1.]F100. would result in a Positive Incremental Move and G31Z[#30]F20 a Negative Incremental Move less that the previous Positive Move.

Regards,

Bill


Hi Bill,

Thank you for your reply. After a closer look, this Macro is not PROBE's Macro, I wish I had it because I'm sure his would work perfectly. I think I started with his though, and modified it, not sure why, but anyway...

I haven't tested this program at all yet. I see what you mean about #30=#26-#5023 resulting in a plus value, which is not what I want since this is supposed to be the incremental distance from the current position to the expected surface position in the Z-axis. And the contingency for the Skip Signal not being input ... that's a good point, I'm going to have to think about what I could do for that.

With this information, I'm going to rethink this Macro tomorrow when I get some time and post something different and hopefully continue to get help on it here until it is functioning properly.

I appreciate your helpful comments, as always.


Regards,

Paul
 
Hi Bill,

Thank you for your reply. After a closer look, this Macro is not PROBE's Macro, I wish I had it because I'm sure his would work perfectly. I think I started with his though, and modified it, not sure why, but anyway...

I haven't tested this program at all yet. I see what you mean about #30=#26-#5023 resulting in a plus value, which is not what I want since this is supposed to be the incremental distance from the current position to the expected surface position in the Z-axis. And the contingency for the Skip Signal not being input ... that's a good point, I'm going to have to think about what I could do for that.

With this information, I'm going to rethink this Macro tomorrow when I get some time and post something different and hopefully continue to get help on it here until it is functioning properly.

I appreciate your helpful comments, as always.


Regards,

Paul

Hi Paul, it seems that the macro you're dealing with is based on what I wrote. Instead of "repairing" it I'll present the original one, including the following additions: check if the probe touched the surface during first Z approach, and optional setting home in desired WCS number (table is always moved to level position). I assume that the probe is switched on and the tool offset is applied (although this has no importance during the execution of the measuring routine). You will have to bring in main program the probe tip the to the middle of the measuring span, let say 1 inch above the surface, and then call the subroutine O7438.

G65 P7438 X4. Z2. S54
(X4. - MEASURING SPAN)
(Z2. - INCREMENTAL Z MOVE AMOUNT)
(S54 - WCS NUMBER)

O7438
IF[#26LT0]GOTO20
#26=-#26
N20
G91
#1=#5023
G0X-#24/2
G31Z-#26F400
G53
IF[#5043NE#5063]GOTO30
#3000=95 (PROBE FAIL)
N30
#2=#5023
G0Z0.1
#3004=2
G31Z[#2-#5023]F1
G53
#3=#5063
#3004=0
G0Z[#1-#5023]
X#24
G31Z#26F400
G53
IF[#5043NE#5063]GOTO40
#3000=95 (PROBE FAIL)
N40
#2=#5023
G0Z0.1
#3004=2
G31Z[#2-#5023]F1
G53
#4=#5063
#3004=0
G0Z[#1-#5023]
#5=ATAN[#4-#3]/[#24]
M? (UNCLAMP B)
B-#5
M? (CLAMP B)
G90
IF[#19EQ#0]GOTO999
#[5204+20*[#19-53]]=#5024
M99
%
 
I was not very sure about this. Never tested it. Error message would have been a better logic.
Hello sinha,
How I have described the action is correct. Its up to the author of the Macro to decide how this situation should be handled and whether an Error message is appropriate for how G31 is being used.

There are those who swear that executing G53 without arguments is a sure way of halting the execution of a number of consecutive Macro Statements. Others swear by the use of G04, or a number of consecutive EOBs to interrupt the execution of many consecutive Macro Statements. Although these strategies work on older Fanuc Controls, I can say with certainty that they all fail with late model controls with AI functions and extended Block Buffering. HAAS has the Function G103 to specify the maximum number of Blocks buffered; a very handy function when working with Macro Statements.

Although I've not had a chance to test it, my Fanuc colleagues tell me that G31 strategically placed with no argument, irrespective of whether an External Skip Signal is wired, will interrupt the execution of Macro Statements. In this case there is also no Error Condition raised.

Regards,

Bill
 
Hello sinha,
How I have described the action is correct. Its up to the author of the Macro to decide how this situation should be handled and whether an Error message is appropriate for how G31 is being used.

There are those who swear that executing G53 without arguments is a sure way of halting the execution of a number of consecutive Macro Statements. Others swear by the use of G04, or a number of consecutive EOBs to interrupt the execution of many consecutive Macro Statements. Although these strategies work on older Fanuc Controls, I can say with certainty that they all fail with late model controls with AI functions and extended Block Buffering. HAAS has the Function G103 to specify the maximum number of Blocks buffered; a very handy function when working with Macro Statements.

Although I've not had a chance to test it, my Fanuc colleagues tell me that G31 strategically placed with no argument, irrespective of whether an External Skip Signal is wired, will interrupt the execution of Macro Statements. In this case there is also no Error Condition raised.

Regards,

Bill
G5.1Q0 supposably should stop buffering caused by AI. It should be placed at the beginning of the measuring program. I use G53 after each G31 block, this stops the look forward for this particular block only and assures that variables 506* used later on are correct.
 
... G31 strategically placed with no argument, irrespective of whether an External Skip Signal is wired, will interrupt the execution of Macro Statements.

Nice. Yet another thing we learnt from you. Thank you.
 
Hi Paul, it seems that the macro you're dealing with is based on what I wrote. Instead of "repairing" it I'll present the original one, including the following additions: check if the probe touched the surface during first Z approach, and optional setting home in desired WCS number (table is always moved to level position). I assume that the probe is switched on and the tool offset is applied (although this has no importance during the execution of the measuring routine). You will have to bring in main program the probe tip the to the middle of the measuring span, let say 1 inch above the surface, and then call the subroutine O7438.

G65 P7438 X4. Z2. S54
(X4. - MEASURING SPAN)
(Z2. - INCREMENTAL Z MOVE AMOUNT)
(S54 - WCS NUMBER)

O7438
IF[#26LT0]GOTO20
#26=-#26
N20
G91
#1=#5023
G0X-#24/2
G31Z-#26F400
G53
IF[#5043NE#5063]GOTO30
#3000=95 (PROBE FAIL)
N30
#2=#5023
G0Z0.1
#3004=2
G31Z[#2-#5023]F1
G53
#3=#5063
#3004=0
G0Z[#1-#5023]
X#24
G31Z#26F400
G53
IF[#5043NE#5063]GOTO40
#3000=95 (PROBE FAIL)
N40
#2=#5023
G0Z0.1
#3004=2
G31Z[#2-#5023]F1
G53
#4=#5063
#3004=0
G0Z[#1-#5023]
#5=ATAN[#4-#3]/[#24]
M? (UNCLAMP B)
B-#5
M? (CLAMP B)
G90
IF[#19EQ#0]GOTO999
#[5204+20*[#19-53]]=#5024
M99
%


Hi PROBE,

Thank you for sharing this Macro. Saved me a bunch of time. It looks perfect, with contingencies and all! I will employ it later today or tomorrow. This will save the operator from having to manually indicate each part straight and will also eliminate gage cuts, so it is a big help.

Thanks again.


Regards,

Paul
 
I've made a couple small changes to the B-axis Macro, one of them is because the distance from the start position to the probe touch is large so I added some code to feed faster until a certain distance away from the expected touch; this R-number (#18) is passed in the Macro Call Block.

I'm having an issue, though. For some reason with the following code, the machine only takes one hit. However, it records the position in #3 & #4, which is after it is supposed to take the second hit. Taking the one hit at a fast feed is saving positions that are not accurate.

The program seems clear enough to me, but it obviously has to be something causing this. I've added notes where it should take the first hit as fast feed then another at slow feed. I was going to watch it in single block mode to see if I could figure it out, but I won't have the chance for a while so I thought I'd ask the forum.


IF[#26LT0]GOTO20
#26=-#26
N20
G91
#1=#5023
G0X[-#24*.5]
G1Z[#26+#18]F100.0
G1G31Z-#18F20.0 (Using Skip Signal G31, feed the Probe to touch the work surface at fast feed)
G53
IF[#5043NE#5063]GOTO30
#3000=95(PROBE DID NOT TOUCH PART)
N30
#2=#5023(Record the current Z Machine Coordinate for fast feed touch)
G0Z0.25 (Rapid away from work surface)
#3004=2 (Disable feed override)
G1G31Z[#2-#5023]F1.0 (Calculate an Incremental move that will ensure a hit in Z and make the touch at slow feed)
G53
#3=#5063 (Record the Skip Signal Z Machine Coordinate)
#3004=0
G1Z[#1-#5023]F50.0
()
( MOVE TO OTHER SIDE FOR 2ND TOUCH )
()
G0X#24
G1Z[#26+#18]F100.0
G1G31Z-#18F20.0
G53
IF[#5043NE#5063]GOTO40
#3000=95(PROBE DID NOT TOUCH PART)
N40
#2=#5023
G0Z0.25
#3004=2
G1G31Z[#2-#5023]F1.0
G53
#4=#5063
#3004=0
G0Z[#1-#5023]
#5=ATAN[#3-#4]/[#24]
G0G90G53Z0.W-10.
M11
G1G91B#5F20.
M10
G90
IF[#19EQ#0]GOTO50
#[5207+20*[#19]]=#[5207+20*[#19]]+#5
GOTO60
N50
#3000=54(NO WORK OFFSET # ASSIGNED)
N60
M11
G0G90G56B180.000
M10
M99


Thanks for any help.


Regards,

Paul
 
Hello sinha,
How I have described the action is correct. Its up to the author of the Macro to decide how this situation should be handled and whether an Error message is appropriate for how G31 is being used.

There are those who swear that executing G53 without arguments is a sure way of halting the execution of a number of consecutive Macro Statements. Others swear by the use of G04, or a number of consecutive EOBs to interrupt the execution of many consecutive Macro Statements. Although these strategies work on older Fanuc Controls, I can say with certainty that they all fail with late model controls with AI functions and extended Block Buffering. HAAS has the Function G103 to specify the maximum number of Blocks buffered; a very handy function when working with Macro Statements.

Although I've not had a chance to test it, my Fanuc colleagues tell me that G31 strategically placed with no argument, irrespective of whether an External Skip Signal is wired, will interrupt the execution of Macro Statements. In this case there is also no Error Condition raised.

Regards,

Bill


Hi Bill,

What does AI stand for in your reply?

We have a G & L Boring Mill (2015) with a Fanuc 31i Model B control, and this is what the MTB sent me on the topic of halting the execution of a number of consecutive Macro Statements on this control: First, they said, "When it does nothing but calculations I don't believe it can be stopped unless you put a G53 (stop look ahead) on a block by itself." Attached, was this example:

The control can look one or several blocks depending on the options. This can cause problems when writing macro programs and storing variables. The G53 programmed alone can be used to prevent looking ahead.

N100 #2=5;
N110 #3=5*#2;
N120 G53;
N130 G00 X[#3] Y[#2];

On line N130, when the control reads #2 and #3, it will not position correctly unless G53 is programmed between the calculated values and the position commanded. This is because the control is looking ahead. This G53 is referred to as a suppression of multi buffer.


This is OT but I am curious about this. I want to single block through a macro program I wrote on this control and asked them what I would have to do to have the ability to do this. (I suggested maybe it would require a parameter change).

They don't seem very certain with their answer. Maybe they misunderstood what I was asking for. I thought I read where you mentioned this can be enabled by changing a parameter, am I mistaken?


Regards,

Paul
 
Hi Bill,

What does AI stand for in your reply?

We have a G & L Boring Mill (2015) with a Fanuc 31i Model B control, and this is what the MTB sent me on the topic of halting the execution of a number of consecutive Macro Statements on this control: First, they said, "When it does nothing but calculations I don't believe it can be stopped unless you put a G53 (stop look ahead) on a block by itself." Attached, was this example:

The control can look one or several blocks depending on the options. This can cause problems when writing macro programs and storing variables. The G53 programmed alone can be used to prevent looking ahead.

N100 #2=5;
N110 #3=5*#2;
N120 G53;
N130 G00 X[#3] Y[#2];

On line N130, when the control reads #2 and #3, it will not position correctly unless G53 is programmed between the calculated values and the position commanded. This is because the control is looking ahead. This G53 is referred to as a suppression of multi buffer.


This is OT but I am curious about this. I want to single block through a macro program I wrote on this control and asked them what I would have to do to have the ability to do this. (I suggested maybe it would require a parameter change).

They don't seem very certain with their answer. Maybe they misunderstood what I was asking for. I thought I read where you mentioned this can be enabled by changing a parameter, am I mistaken?


Regards,

Paul

Hello Paul,
There is available AI Contour Control and AI Advanced Preview Control. Contrary to popular belief, AI does not refer to "Artificial Intelligence" . AI represents FANUC's Alpha I Series Servo System. There are differences between the two AI modes. However, the syntax for using them is exactly the same.

I also used G53 to interrupt the execution of Macro Statements. I did that right up to when it didn't work on a client's control and it had nothing to do with not using G5.1 to stop AI mode.

In the Fanuc Manual there is actually a reference to using G31. "The Macro Statement existing next to the block which does not buffer the next one (block of non-buffering M code, or G31 block) is executed after that block is executed." My Fanuc colleagues (factory trained application specialists) confirmed that G31 should be used with no arguments.

For your control, Bit 5 of parameter 6000 set to "1" will cause the control to halt execution after each Macro Statement when Single Block Mode is selected.

Regards,

Bill
 
Last edited:
Bill,
G31, without arguments, can be used for stopping the buffering/execution of the macro statements.
But, can it be used after a probing G31?

G31 Z_ F_;
G31;
<macro statements>;
 








 
Back
Top