Fanuc macro B thread....

wow...on topic..imagine that?
Im writing a macro for the milling dept that takes a program processed off UG and runs the first tool in all the positions, then runs the second tool
in all the positions, etc... As opposed to run all tools position 1, then run all tools position 2 etc... The tuff part is the mills are always running, so im having trouble getting debug time on the machines. SO.. when i do get to the mill I need my proggy real close to good, because I wont have the luxury of spending a lot of time debugging. The machines are makinos, a few different models, all with the macro b option and a hardrive (m198) I downloaded a few simulators, and im still in the process of seeing if any of those will help. so far no. So I figured Id post it here and anybody with skills, or just hates me can pick it apart and insult me. Even spelling, be mean!!! kind of a pre debug.
Here is the main proggy.... ************************* % O0010
#100 = 10 ; ENTER PROGRAM NUMBER FROM SETUP SHEET #101 = 8 ; ENTER NUMBER OF POSITIONS 1-8 #102 = 1 ; ENTER STARTING TOOL FROM SETUP SHEET #103 = 10 ; ENTER ENDING TOOL FROM SETUP SHEET
N40 IF [#102 GT 8] GOTO 50 G00 G54.#101 X0. Y0. M198 P#100 #101= #101 - 1 #102=#102 + 1 GOTO 40 N50 (YOU ENTERED TOO MANY POSITIONS) M30 %
*****************
In the gcode sent from UG.... ***************************** % O0020 ;
IF [#102 > #103] GOTO 100 GOTO #102 *****add this to top of program******
N1 T1 M99 N2 T2 M99 N3 T3 M99 *****m99 at end of each toolchange and n numbers at toolchanges only******
N100 ****add n100 before ending blocks******* G91G28Z0 M20 %
***************************************** ***************************************** This is version 3, its 90% shorter than version 1. If you have a better way, hell ill scrap the whole thing in the name of progress. Id love to have a version 4. if someone gets to version 4, ill put their name on the first line of the main program. Youll be famous......kinda.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

off

tool

There's no need to use macro b for multiple fixturing, all you need is a 2 line sub program to update G54 coordinates for each fixture location that contains nothing but a g10 statement, (along with a subprogram containing the actual toolpath)
% :5511(SETUP COORDINATES fixture 1) G90G10L2P1X-2.5Y5.4875Z4.51 M99 % :5512(SETUP COORDINATES fixture 2) G90G10L2P1X-3.5Y5.4875Z4.51 M99 % :5513(SETUP COORDINATES fixture 3) G90G10L2P1X-4.5Y5.4875Z4.51 M99 % :5514(SETUP COORDINATES fixture 4) G90G10L2P1X-5.5Y5.4875Z4.51 M99 % :5515(SETUP COORDINATES fixture 5) G90G10L2P1X-6.5Y5.4875Z4.51 M99 % :1301 (subprogram for T11 toolpath) X0Y0 Z3. (MILL OFF TOP) X-0.19Z0.3746 G1Z0.27468F20. X0.19F9. Z0.3746F200. (MILL CIRCULAR PROTRUSION) G1X0.2375Z0.4746F150. G41X0.05Z0.2746F12.42 Y0 G2X0.05Y0I-0.05J0Z0.2721 G2X0.05Y0I-0.05J0Z0.2696 G2X0.05Y0I-0.05J0Z0.2671 G2X0.05Y0I-0.05J0Z0.2646 G2X0.05Y0I-0.05J0Z0.2621 G2X0.05Y0I-0.05J0Z0.2596 G2X0.05Y0I-0.05J0Z0.2571 G2X0.05Y0I-0.05J0Z0.2546 G2X0.05Y0I-0.05J0Z0.2521 G2X0.05Y0I-0.05J0Z0.2496 G2X0.05Y0I-0.05J0Z0.2471 G2X0.05Y0I-0.05J0Z0.2446 G2X0.05Y0I-0.05J0Z0.2421 G2X0.05Y0I-0.05J0Z0.2396 G2X0.05Y0I-0.05J0Z0.2371 G2X0.05Y0I-0.05J0Z0.2346 G2X0.05Y0I-0.05J0 G1G40X0.2375Z0.4746F150. X-0.19Z0.3746 G1Z0.27468F230. X0.19F9.5 Z0.3746F200. G0Z3.M9 M99 %
====:O100 (main program) T11 (T11= EM 1/2 X .120 R D82) G0G54G91G28H0Z0G80G40 T11M6 G90 S6260M3 Z3.H11M8D82 G00X0Y0 M98P5511 < update g54 for position 1 M98P1301 < execute toolpath M98P5512 < update g54 for position 2 M98P1303 < execute toolpath M98P5514 < update g54 for position 3 M98P1301 < execute toolpath M98P5515 < update g54 for position 3 M98P1301 < execute toolpath
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

There's no need to use macro b for multiple fixturing, all you need is a 2 line sub program to update G54 coordinates for each fixture location that contains nothing but a g10 statement, (along with a subprogram containing the actual toolpath)
********** Thanks for the reply, but what im trying to do is reach into the gcode program and select tool one and run it thru all the positions. Then reach into the gcode again, and grab tool 2 and run it thru all the positions, etc... till all the tools have been ran. The current way is it calls up the program and runs all the tools on that first position, then runs all the tools on the next position. The owner hates all the toolchanges. 90 toolchanges as opposed to 9. Plus the added benefits of rpm control. Nothing worse than each position running from 2000 to 30000 rpm before it goes to the next position. the parts they are cutting (electrodes) are all over the place in x y and z.
thanks again.
The only problem I see is the gcode is on a hardrive in the makino. It takes an m198 to call it up. Not sure yet if the variables pass to the harddrive.
Hopefully today I can get some machine time for debug.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload


I just showed you how to do exactly that.

There's this thing called a text editor.

You're welcome.

I'm not using variables.
> Hopefully today I can get some machine time for debug.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I have a repeating job that is programmed like what you want. 4 vises on the table. 10 tools used.
T1 G54 (vise 1) G0 X Y Z do work G0 Z(clear) G55 (vise 2) G0 X Y Z do work G0 Z(clear) G56 (vise 3) G0 X Y Z do work G0 Z(clear) G57 (vise 4) G0 X Y Z do work Z (clear) Go to toolchange T2 G54 Blah Blah Blah
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Nice. But not exactly what Im looking for. I got the positions, everyone is zooming in on the multiple fixturing positions. The thing im trying to do is take a short generic main program in memory, and have it get tool 1 from a gcode program on the hardrive and run that tools code thru 8 positions....then, get tool 2 from the gcode program on the hardrive and run it thru all 8 positions, etc... untill its ran all the tools on the gcode program on the hardrive. This needs to be done without any editing, cutting or pasting. The program on the hardrive is posted out of the cam system by programmers, and the mill operators never see that code. All they do is edit a tiny main proggy in the memory. Your program works fine if the operator edits the gcode. Something im trying to avoid. Seriously, thanks for the reply.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Why would I buy ncplot? It only does simple macros and has no m198. Its useless. Now you would know this if you used it as opposed to memorizing the guys name who made it.
You jb are a POZER.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload


I would have fired his ass long ago...
--anyone who'd waste nearly a weeks time trying to come up with a way to avoid two minutes of copy/pasting is either an idiot, on drugs, or both.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Sat, 2 Aug 2014 16:06:04 -0700, "PrecisionmachinisT"
<snip>

</snip>
If this is a one off, probably yes, but I have the impression that "the boss" wants to minimize tool change time on all the programs, so Vinny is looking for a template to "automate" without having to manually edit every program.
Is there any way to revise the post so Vinny doesn't have to manually do this in the future?
Would a stand-alone program that would parse the gcode program, and then write/sort the blocks into separate files by tool no, then recombine the blocks in sequence be helpful? There would still be some manual editing required.
--
Unka' George

"Gold is the money of kings,
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

Yep. exactly. 1 electrode typically has 8 tools average, times 8 positions.64 tool changes. Thats for a 3 hour run. they run 20 hrs a day 7 days a week, 3 machines. The wear alone is a major factor. But, the other benefit is quality. The machine runs 8 tools thru an electrode, from 2000rpm to 35000 rpm, then does the next part etc... You cant hold a tenth or two in a situation like that. So this will get tool 1, and warm up the spindle for seconds relative to rpm, The LASER probe the tool for depth and size, then run at that speed thru all 8 parts.
Im down to testing time. its hard when you dont run the machines you need to test in. All im doing here is cutting down on debug time. Well trying anyway.
Last thing to add is the laser probe code, but i need to look at the toolpickup program to steal the line of code that does it.

Sure. The post processors are written in tcl, you could do anything. I thought about that at first, it would be simple to hardcode an index or loop at the begining of the post processor to do this. But then I thought the operator still has to tell how many positions, and what tool he wants to start on etc...and the gcode is too large to fit in memory, so nobody wants them editing that, even to change a few variable prompts at the top. So they are staying with the easy to edit main program in ram at this point.
You could do it in the cam system, simply actually. The post needs set up for sub programs, and they look like they are visually. You get done cutting, and make the 8 copies of your cut. Not the toolpath, just a symbolic reference....done. Now the program posts out sub calls to the interior of the program and does the 8 positions however you defined them, in variables or in offsets. But....the operator might want to cut less or more positions, start and end on different tools, etc... again, loss of flexability.
SO far...a tiny macro calling up the gcode from the programmers seems the easiest, fastest and most flexible.
The main benefits are the programmers are not involved, and the mill guys keep doing things the way they always have, with a few new options. And I get some damn trodes I can use!
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Pretty well describes the overwhelming majority of my work, except my cycle times are on the order of a few minutes instead of several hours.
Which is to say I'd that I'd have gone broke a long time ago had I not figured out how to machine multiple workpieces before changing to the next tool, which is the strategy you appear to still be struggling with here.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yet, it works...(unlike yours)

Have fun finding a new job...
--can't be many shops left that aren't drug testing these days...
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload


Considering the parameters of the project was to not cut and paste for an hour, no...yours did not work. Hell, why not just cut and paste the main and not even have a sub if your going to cut and paste your ass off every single friggen run you make? I dont understand why any machinist, no matter how little skilled would opt for wasting time over making time?

? Now you sound exactly like jb. Next you will call me a pot head or a drunk.

The one Im at does drug tests? Your point? Am I going to be called a drunk in your next reply? How about pointing out I cant spell a word? (predictable)
You actually try harder than jb to deflect attention off your skills. You get an A for effort.
The real problem is at your age if you havnt learned how to be productive by now, you never will.
There...cut and paste that gcode boi.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload


Write the main program once and from then on all you need is to provide a sub containing each tool's toolpath.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload


cut and pasting?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload


As if you didn't use cut paste to produce your abortion....
Easy enough write by hand, in it's entirety...and the main program would never change again, once written. And all you'd need to supply after that is a set of subprogram for each cutting tool's toolpath.
But you're an idiot and an asshole; and so you'll have to just figure it out on you're own, like I did.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
> Easy enough write by hand, in it's entirety...and the main program would

Im not going to argue this forever. The parameters of the project was the nc file never gets touched or even seen by the operators. The UG programmers continue with no changes in their programming. It has to be easy to run each time.
Yours did not meet those requirements. Why would you want to post out 8-10 programs per part?
Whatever man.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Fri, 1 Aug 2014 22:18:35 -0700 (PDT), jon_banquer
<snip>

</snip> 299$US http://www.ncplot.com/ordering.htm
they got some free stuff too http://www.ncplot.com/freetools.htm
--
Unka' George

"Gold is the money of kings,
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
vinny wrote:

[ snip ]

I don't think you can append a variable to a numeric value, as you've done with the G54.

I'm no expert (and I'm a turner, not a miller), but here's a stab at it:
------------------------------------------------ % O0010 (MAIN PROG) #27 = 20 (ENTER PROGRAM NUMBER FROM SETUP SHEET) #28 = 8 (ENTER NUMBER OF POSITIONS 1-8) #100 = 1 (ENTER STARTING BLOCK FROM SETUP SHEET) #30 = 10 (ENTER ENDING BLOCK FROM SETUP SHEET)
IF [#28 LT 1] GOTO 50 IF [#28 GT 8] GOTO 50 WHILE [#100 LE #30] DO 1 (BLOCK/TOOL LOOP) #31 = 1 WHILE [#31 LE #28] DO 2 (POSITION LOOP) G00 G[54 + #31 / 10] X0. Y0. M198 P#27 #31 = #31 + 1 END 2 G91 G28 Z0. M20 #100 = #100 + 1 END 1 M30
N50 #3100 = 2 (INVALID NUMBER OF POSITIONS) % ===============================================% O0020 (CALLED PROG) GOTO #100
N1 T1 M99 N2 T2 M99 (...) N10 T10 M99 % ------------------------------------------------
Can think of a few variations on the same theme, but the above code should be enough to get you started at least.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

#########################################################################
You rock man!!!!!!!!!!!!!!!!!
Here's my new proggy incorporating your stuff.... SUWEEEEEEEEEEEETTTTT!!! The g54. stuff is sweet!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*******Main proggy in memory********** % O0001
#100 = 10 ; ENTER PROGRAM NUMBER FROM SETUP SHEET #101 = 8 ; ENTER NUMBER OF POSITIONS 1-8 #102 = 1 ; ENTER STARTING TOOL FROM SETUP SHEET #103 = 10 ; ENTER ENDING TOOL FROM SETUP SHEET
N40 IF [#101 GT 8] GOTO 50 G00 G[54 + #101 / 10] X0. Y0. M198 P#100
#101= #101 - 1 #102=#102 + 1 GOTO 40 N50 #3000=5(YOU TYPED IN TOO MANY POSITIONS); % *****************************************
******posted program from ug cam system********** % O0010 ;
IF [#102 GT #103] GOTO 100 GOTO #102
N1 T1 S3000 M03 #104 = #4119 / 50 G04 P#104 (laser pickup code here) (gcode here) M99
N100 G91G28Z0 M20 % ***************************
Now thats more like it....i feel smarter! thanks wrecker. WHAHOOOOOOOOOOOOOO!!!!!!!!!!! Now im glad I didnt get debug time, no wine before its time!!!!!!!!!!!!!!!!!
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.