![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
I'm trying to write a simple macro to cut a series of through holes at variable depths based on the number of cycles, basically trying to use all the flutes on my endmill before changing it. I'm running it on a Haas TM-1P. The maximum depth is .650, the initial depth is .05, and the number of cycles before the step down is 20. #100 is my cycle counter and #101 is my depth variable. Here's the code: IF [#101 LT 0.05] THEN #101=0.05 #100=#100+1 IF #100=20 THEN #101=#101+0.05 IF #100=20 THEN #100=0 IF [#101 GE 0.650] THEN GOTO 10 ... (This represents the cutting routines) G13 Z-#101 I0.14 D03 F12. ... N10 (ALARM MACRO) #3000=115 (CHANGE TOOL) M30 Does it look sound or does it need changes? |
|
#3
| |||
| |||
| Wish we had a Haas just so I would know how the code works on that brand. That code wouldn't work on a Fanuc control. It would have to read IF [#101 LT 0.05] THEN #101=0.05 #100=#100+1 IF [#100EQ20] THEN #101=#101+0.05 IF [#100EQ20] THEN #100=0 IF [#101 GE 0.650] GOTO10 |
|
#6
| |||
| |||
| Good points. You're probably right about the syntax for Haas as well. I just cobbled this together out of examples they had in the manual. They do require you to bracket statements using Booolean operators, but in some samples they wrote it simply using "=" in others it was bracketed with "EQ" representing the operator. I suppose I'll find out if the processor doesn't like it when I run it the first time. And yeah, I shouldn't have used GE in the maximum depth statement. Good call. Thanks for the feedback fellas. |
|
#7
| ||||
| ||||
| I think HAAS uses mostly Fanuc code anyways -with a few alterations. Don't forget to reset the one common variable at the end, otherwise it could start as 0.65 on the next run -right? Or am I looking at it wrong? N20 #101=0; ~before the M30. |
|
#8
| |||
| |||
| You are absolutely right. I am guilty of looking at the syntax and not the logic. Good catch. |
|
#9
| |||
| |||
|
You don't generally want to use automatic resets. As it is it will track usage across parts. If he just changed it for the last hole of a part it would still keep the correct count on the next part rather than reset automatically. |
|
#10
| |||
| |||
I'm not familiar with mills. On our lathes if it machined 20 holes to .650 depth, and then alarmed, another operation or 2 or whatever was run, and then came back to this operation on the next part, the #101 would still read .650 unless the machine had been powered off.What am I missing? |
| Sponsored Links |
|
#11
| |||
| |||
| Medm was suggesting to automatically reset #101 (effectively the life counter) at the end of the program. Thus you lose track of the tool usage at the end of each cycle. Even if my tool SHOULD always end it's life at the end of the program, I would not automatically reset it. That just means if they forget to change the tool it will NOT alarm, and produce bad parts and/or break. |
|
#12
| ||||
| ||||
| If you properly examine the code, the variable #101 is not the life counter. That is variable #100 -which is reset in the line; IF [#100EQ20] THEN #100=0 The role of #101 is to change the 'Z' depth. If it is not reset, you will eventually run into a situation where the 'Z' is beyond the usable flute length and therefore a potential crash situation. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help!- My Milling OKK with fanuc 6M can't recognize G-code & M-code | nessei | Fanuc | 4 | 03-29-2011 08:39 AM |
| Newbie- Takeout Unused G Code commands in Mastercams Generated G Code | shneek | Mastercam | 8 | 12-15-2010 02:32 PM |
| learning g code or cad-cam code output? | slow_rider | G-Code Programing | 3 | 02-27-2010 08:48 PM |
| Need Help!- G-Code viewing source code | Hussam | Visual Basic | 3 | 03-15-2009 12:15 PM |
| looking for g code 3d from bobcadcam or simmilar for indexer lpt v5 with g code soft | troyswood | Ability Systems - LPT Indexer and G-Code | 2 | 12-24-2006 09:21 PM |