What's new
What's new

Macro Programming Fundamentals

Here you go.

O9010
#3003=1
IF[#2EQ#0]GOTO100
IF[#2EQ0.]GOTO010
IF[#2LT1.]GOTO104
#4=FIX[#2]
#2=#4
IF[#2LT0]GOTO102
IF[#2GE360.]GOTO103
N010IF[#4007NE40]GOTO106
IF[#1001EQ1.]GOTO105
IF[#1000EQ1.]GOTO008
IF[#13EQ#0]GOTO001
IF[#13NE6]GOTO101
M106
N001#30=#2-#550
IF[#30EQ0]GOTO030
#3=#4001
#5=#4003
G00G90
#6=#5021
IF[#30GT0]GOTO002
IF[#30GT-180]GOTO003
#30=#30+360
GOTO003
N002IF[#30LE180]GOTO003
#30=#30-360
N003IF[#4006EQ20]GOTO020
#31=ROUND[#30*1780.2358]/1000
#32=#5021+#31
IF[#32GT0.]GOTO004
IF[#32GT-610.]GOTO006
#33=-610.-#31
#32=-610.
GOTO005
N020#31=ROUND[#30*700.88025]/10000
#32=#5021+#31
IF[#32GT0.]GOTO004
IF[#32GT-24.01575]GOTO006
#33=-24.01575-#31
#32=-24.01575
GOTO005
N004#33=0.-#31
#32=0.
N005G53X#33
N006M123
G04P300
M122
G04P300
G53#32
M121
M124
IF[#5EQ90]GOTO0011
G53X#6
N011G#3G#5
N030IF[#2NE0]GOTO007
M120
N007#550=#2
IF[#13EQ#0]GOTO008
M107
N008#3003=0
M99
N100#3003=0
#3000=500
N101#3003=0
#3000=501
N102#3003=0
#3000=502
N103#3003=0
#3000=503
N104#3003=0
#3000=504
N105#3003=0
#3000=505
N106#3003=0
#3000=506
 
I changed #3003=1 to #3003=0, this allows me to use single block. I stepped through the entire program, line by line, and it did the exact same thing as it was doing in automatic mode. The pallet unlocks, locks, no rotation, no alarm, no error.
 
I changed #3003=1 to #3003=0, this allows me to use single block. I stepped through the entire program, line by line, and it did the exact same thing as it was doing in automatic mode. The pallet unlocks, locks, no rotation, no alarm, no error.
Hello Billet454,
That would depend on the setting of a parameter bit as to how #3003 has the control react. It still may not be actually progressing via Single Block when there are a number of consecutive Macro Statement. I wont have my hands on a parameter book until tomorrow to be able to advise what parameter it is.

As I said in an earlier Post, I believe that the index section of the program is that shown below. However, if this last listing of the program is a true representation of the program you have running, then it still has errors. The Block below G53#32 should be G53X#32, or is this a Typo of yours?

M122
G04P300
G53#32
M121
M124
IF[#5EQ90]GOTO0011
G53X#6

However, lets say that the program you're running does actually read as follows:
M122
G04P300
G53X#32
M121
M124
IF[#5EQ90]GOTO0011
G53X#6

then, as I stated in an earlier Post, put M00 in a Block immediately before G53X#32 as in the following and run the program. If the program doesn't stop at the M00, then you have a Conditional Statement that is making the program Branch to the end of the program, past that part of the program.

M122
G04P300
M00
G53X#32
M121
M124
IF[#5EQ90]GOTO0011
G53X#6

It will be probably easier for you to put an End Of Block in a Block by itself, between every Block in your program. To have the Program Single Block though every Block in the Program using #3003, you will have to change a parameter Bit.

If the program gets to the M00 above, the machine will surely index the pallet, for there are many iterations in your program to skirt around the above code if the index coordinate passed to the Macro is out of range or the same as the current position.

If you get to the point where the control is actually stepping through each and every Block in the program, you will definitely be able to see where the Local Variable #2 is Passed through to the Macro Program and where #2 is modified and passed on to #32. In Single Block through the Macro Conditional Statements, you will be able to identify if, when and why the program may be branching through to the end and not executing the Index part of the program.

Regards,

Bill
 
This is the download from the machine, and yes I agree with the missing "X" with the G53, and that makes perfect sense. The #3003 setting is for single block according to my programing manual, and yes his would be an entry error on my part. I will make the change today and try it again to see what happens, but I believe you have found the issue. I'll let you know as soon as I try it out. Thank you!
 
This is the download from the machine, and yes I agree with the missing "X" with the G53, and that makes perfect sense. The #3003 setting is for single block according to my programing manual, and yes his would be an entry error on my part. I will make the change today and try it again to see what happens, but I believe you have found the issue. I'll let you know as soon as I try it out. Thank you!
If the "X" was missing in the G53#32 Block, from the program you have been running, then I doubt that part of the program is being executed, meaning that a Conditional Statement upstream is branching past the Index part of the program. If the program had got to that part of the program, trying to execute G53#32 would have raised an alarm.

Yes, the setting of #3003 is to inhibit or allow Single Block in a program. For example, you may use #3003 set to inhibit Single Block in a Custom Macro for Continuous Threading, or some other program where to Single Block the Program would be detrimental. But the way in which #3003 behaves is determined by a parameter. I won't go into all scenarios, as you will find them in the Macro Programming section of your manual, but with the parameter bit set to the default setting, #3003 will only allow Single Block function in NC operations and not Macro Statements.

Accordingly, I suggest again that you add an EOB between each Block of your program and that way, Single Block will work for every Block in your program without having to change the parameter bit. Once you get to the point where you know for sure that Single Block is working with all Blocks in your Program, Single Block through your program, taking note of the values of Variables and then determine if the variable, if used in a Conditional Block would bypass the Index section of your program.

Before using the Single Block method to debug your program, I would put an M00 just before the G53 X#32 Block and run the program normally. If the program doesn't find its way to and stop at the M00, then the Conditional Blocks are directing your program to branch past that part of the program. If that is the case, then I would start with the Single Block method of debugging.

Regards,

Bill
 
Will do sir. Thank you for all your help and insight. I truly do appreciate you and your abilities. I will let you know what happens as I work through the steps you have outlined for me to follow. Thank you again very much.
 
If the "X" was missing in the G53#32 Block, from the program you have been running, then I doubt that part of the program is being executed, meaning that a Conditional Statement upstream is branching past the Index part of the program. If the program had got to that part of the program, trying to execute G53#32 would have raised an alarm.

Yes, the setting of #3003 is to inhibit or allow Single Block in a program. For example, you may use #3003 set to inhibit Single Block in a Custom Macro for Continuous Threading, or some other program where to Single Block the Program would be detrimental. But the way in which #3003 behaves is determined by a parameter. I won't go into all scenarios, as you will find them in the Macro Programming section of your manual, but with the parameter bit set to the default setting, #3003 will only allow Single Block function in NC operations and not Macro Statements.

Accordingly, I suggest again that you add an EOB between each Block of your program and that way, Single Block will work for every Block in your program without having to change the parameter bit. Once you get to the point where you know for sure that Single Block is working with all Blocks in your Program, Single Block through your program, taking note of the values of Variables and then determine if the variable, if used in a Conditional Block would bypass the Index section of your program.

Before using the Single Block method to debug your program, I would put an M00 just before the G53 X#32 Block and run the program normally. If the program doesn't find its way to and stop at the M00, then the Conditional Blocks are directing your program to branch past that part of the program. If that is the case, then I would start with the Single Block method of debugging.

Regards,

Bill
You were SPOT ON sir. Thank you again for your help, hopefully I can epay the kindness by helping someone else in need as well.
 

Camtasia 2022.2.0 Crack With Software Key [2022] Free Download​


Camtasia Studio Free DownloadThis tool is best for video editing. It is much more efficient than other programs that require a lot of information and do not give the best results. Moreover, you create new ideas from this tool. Camtasia Studio Serial Number Last has proven to be the most powerful. It gives you free access to great premium screenshot features. If you want to output a video of a particular quality, you do so.
Yes, well. That's entirely relevant to this Thread, "Macro Programming Fundamentals"; NOT!
Which part of the title didn't you understand? I do hope that the creators of this Software are a lot more on the ball than you seem to be.
 
I'm using DPRNT to write some macro results to the dataserver on my Fanuc30i machine. The files are automatically named PRNT0000.DAT, PRNT0001.DAT, etc.

Is there a way to specify the file name/number?

If I leave files in there, when the machine is power-cycled, it reverts back to PRNT0000.DAT and will alarm when trying to write data if the file is already there.

Or is it possible to change setting to overwrite existing file if the name is equal?
 
Is there a way to enter feed hold mode (not M0/M01 stops) by setting a variable? I see #3004 is override controls that can disable/enable feed hold, but what about activating it?
We have some cast parts that need to have vanes aligned properly. I'm brining a drill down near the part so operators can turn the part until it aligns with a hole, but they need to actually jog it down into the hole while turning the part for alignment.
In Haas-land we can use the "run-stop-jog-continue" function to do this mid program, but it must be done from feed hold state rather than M0; if you use it in M0 the program restarts. Right now I have an M0 to make sure we don't skip past the alignment stage, and then a dwell period to give operators a second to enter feed hold mode. I'd like to have it just go straight into hold by itself, is that possible?
 
Is there a way to enter feed hold mode (not M0/M01 stops) by setting a variable? I see #3004 is override controls that can disable/enable feed hold, but what about activating it?
We have some cast parts that need to have vanes aligned properly. I'm brining a drill down near the part so operators can turn the part until it aligns with a hole, but they need to actually jog it down into the hole while turning the part for alignment.
In Haas-land we can use the "run-stop-jog-continue" function to do this mid program, but it must be done from feed hold state rather than M0; if you use it in M0 the program restarts. Right now I have an M0 to make sure we don't skip past the alignment stage, and then a dwell period to give operators a second to enter feed hold mode. I'd like to have it just go straight into hold by itself, is that possible?

It'd help a lot if you told us what control...
 
Its a Haas, not the NGC tho
You can control Single block, block delete, optional stop with #3030, #3032, #3033

If you set #3030 to 1, this is the same as pressing the single-block button on the control. Put it wherever you want.

I think you can probably do something like
#3030=1
(empty line)
#3030=0

I think that will stop in singleblock mode. You'd still have to press feed hold to stop-jog-continue. Pressing start again should turn off singleblock and continue.
 
You can control Single block, block delete, optional stop with #3030, #3032, #3033

If you set #3030 to 1, this is the same as pressing the single-block button on the control. Put it wherever you want.

I think you can probably do something like
#3030=1
(empty line)
#3030=0

I think that will stop in singleblock mode. You'd still have to press feed hold to stop-jog-continue. Pressing start again should turn off singleblock and continue.
That'll do!
Didn't need the empty line because it stops on the single block line, just press feed hold to enter jog mode, then cycle start x2 to exit RSJ and turn SB off.
Its the same number of button presses but I like removing the dwell timer for hitting feed hold.
 
Examples of Macros for turning Sine curves, hyperbolas or similar shapes that I have come across do not include nose radius compensation in the programs, wouldn’t this result in the wrong shape being cut?

Also, macros for profiling radii with a endmill seems to have the calculations down correctly for the radii itself, but doesn’t take into account that the nose radius of the inserts must be taken into account for generating the correct profile.

Just finding it a bit confusing that’s all.
 
Examples of Macros for turning Sine curves, hyperbolas or similar shapes that I have come across do not include nose radius compensation in the programs, wouldn’t this result in the wrong shape being cut?

Also, macros for profiling radii with a endmill seems to have the calculations down correctly for the radii itself, but doesn’t take into account that the nose radius of the inserts must be taken into account for generating the correct profile.

Just finding it a bit confusing that’s all.
Many of the contributions are bare bone examples to demonstrate a method or concept. You learn little from being totally spoon fed.

Usually its not all that hard to enhance the Macro Program example given to include Tool Nose Radius, or Cutter Radius Comp and can generally be achieved by adding Start Up and Ending of Tool Nose Radius or Cutter Radius Comp by the Control, or, as in the following example, a simple addition or subtraction of the Tool Radius Value at the appropriate place or places in the Macro.

The following Macro example was in recent reply to a Forum Member, for a method of machining a Circular Pocket to a depth, where each Step Over out to the finished Radius had to be cut to depth before proceeding to the next. In this example, the Cutter Radius Compensation was hard coded in the Macro. If you search and find the Thread this reply was given in, you will find that I declared it as a "Bare Bones Example", with no error trapping and that the Macro could be enhanced to use Cutter Radius Compensation by the Control, or rather than registering the Cutter Radius Value in the Macro, the Macro could be enhanced to read the value from an Offset Registry.

#1 = 0.0 (Z START LEVEL)
#2 = -5.0 (Z DOC)
#3 = -18.0 (FULL DEPTH Z)

#4 = 15.0 (X START RADIUS)
#5 = 6.0 (X STEP OVER)
#6 = 55.0 (X FINAL RADIUS)
#7 = 16.0 (CUTTER DIAMETER)
#7 = #7/2 (CALCULATE THE TOOL RADIUS)

G90 G00 G54 X0.0 Y0.0
G43 Z10.000 H_ _ M08
G01 Z1.000 F1000

WHILE [#4 LT #6] DO 1
#4 = #4 + #5
IF [#4 GT #6] #4 = #6 (STOP OVERCUT OF RADIUS)
WHILE [#1 GT #3] DO 2
#1 = #1 + #2
IF [#1 LT #3] #1 = #3 (STOP OVERCUT IN Z)
G90 G01 Z#1 F_ _
G01 X[#4 - #7] F_ _ (FEED TO RADIUS - TOOL RADIUS)
G91 G03 X0.0 Y0.0 I-[#4 - #7]
END 2
G91 G01 X-1.0 (CLEAR RADIUS IN X)
#1 = 0.0 (Z START LEVEL)
G00 Z[#1 + 1.0] (RAPID TO CLEAR TOP OF WORPIECE)
END1
G00 Z10,000 M09

Following picture is the actual Back Plot of the attached file, which is the program output based on the Variable Values specified in the above example.


Z Depth and Radius1.JPG
 
Last edited:
Many of the contributions are bare bone examples to demonstrate a method or concept. You learn little from being totally spoon fed.

Usually its not all that hard to enhance the Macro Program example given to include Tool Nose Radius, or Cutter Radius Comp and can generally be achieved by adding Start Up and Ending of Tool Nose Radius or Cutter Radius Comp by the Control, or, as in the following example, a simple addition or subtraction of the Tool Radius Value at the appropriate place or places in the Macro.

The following Macro example was in recent reply to a Forum Member, for a method of machining a Circular Pocket to a depth, where each Step Over out to the finished Radius had to be cut to depth before proceeding to the next. In this example, the Cutter Radius Compensation was hard coded in the Macro. If you search and find the Thread this reply was given in, you will find that I declared it as a "Bare Bones Example", with no error trapping and that the Macro could be enhanced to use Cutter Radius Compensation by the Control, or rather than registering the Cutter Radius Value in the Macro, the Macro could be enhanced to read the value from an Offset Registry.

#1 = 0.0 (Z START LEVEL)
#2 = -5.0 (Z DOC)
#3 = -18.0 (FULL DEPTH Z)

#4 = 15.0 (X START RADIUS)
#5 = 6.0 (X STEP OVER)
#6 = 55.0 (X FINAL RADIUS)
#7 = 16.0 (CUTTER DIAMETER)
#7 = #7/2 (CALCULATE THE TOOL RADIUS)

G90 G00 G54 X0.0 Y0.0
G43 Z10.000 H_ _ M08
G01 Z1.000 F1000

WHILE [#4 LT #6] DO 1
#4 = #4 + #5
IF [#4 GT #6] #4 = #6 (STOP OVERCUT OF RADIUS)
WHILE [#1 GT #3] DO 2
#1 = #1 + #2
IF [#1 LT #3] #1 = #3 (STOP OVERCUT IN Z)
G90 G01 Z#1 F_ _
G01 X[#4 - #7] F_ _ (FEED TO RADIUS - TOOL RADIUS)
G91 G03 X0.0 Y0.0 I-[#4 - #7]
END 2
G91 G01 X-1.0 (CLEAR RADIUS IN X)
#1 = 0.0 (Z START LEVEL)
G00 Z[#1 + 1.0] (RAPID TO CLEAR TOP OF WORPIECE)
END1
G00 Z10,000 M09

Following picture is the actual Back Plot of the attached file, which is the program output based on the Variable Values specified in the above example.


View attachment 395452
Hello Bill,

Thanks for the example.
I wasn't really referring to this site in particular but more in general. And not really to critique but just making sure my understanding is correct. For example regarding turning, perhaps compensation isn't necessary when turning complex curves for example for some reason that I don't grasp. Because they are generated by small segments of linear moves or something like that.

But it is probably like you say, the point is just to get the general idea across.
 
Hello Bill,

Thanks for the example.
I wasn't really referring to this site in particular but more in general. And not really to critique but just making sure my understanding is correct. For example regarding turning, perhaps compensation isn't necessary when turning complex curves for example for some reason that I don't grasp. Because they are generated by small segments of linear moves or something like that.

But it is probably like you say, the point is just to get the general idea across.
With regards to turning, using TNR Comp by the Control can be troublesome when small segment moves are concerned in any concave feature of a profile and it wouldn't be that much more of a task for the author to include the calculations for the Tool Nose Radius of the tool and a Macro Variable for the TNR to be edited by the user, or to read an Offset Registry where the user can enter the TNR value. It would also be good practice by the author to include error trapping to ensure a TNR was not entered above a maximum value.

I practically never use TNR Comp at the control of a lathe, as its not all that difficult to calculate the true position of the tool based on the TNR used and size adjustment of the diameter of a turned part is generally irrespective of the TNR of the Tool. With a Mill Control, Tool Radius Compensation is the only way to size a feature that is machined using some type of End Mill, either by compensation by the control, or by including the compensation for the Cutter Radius in the Code. The same issues can exist when the profile generated by a User Macro program is made up of small moves and my comment relating to this issue with a lathe apply also with the Mill program.

Regards,
'
Bill
 








 
Back
Top