![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Parametric Programing (custom macro b, fadal macro, okuma user task) |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Gentlemen I was wondering if I can put a IF conditional branching statement inside a While looping statement. The reason I want to do this is to make sure my radius in my tornado macro does not be come a negitive value. I wanted to fire an alarm if the radius got to small. WHILE[#101LE#110]DO1 ***** ***** ***** ***** IF[#18LE.025]GOTO50 END1 N50 #3000=101(RADIUS TO SMALL) |
|
#2
| |||
| |||
| You sure can. I do this all the time. When I write loops there is usually a pick size and a depth of some sort specified by the operator. The pick and the depth are not always divisible so I have an IF statement to set it equal to the final depth if it exceeds with the stack of the pick. Then it will end the loop. If it permits then set it up so if the next pass is going to be a negative radius number have it set itself to the minimum radius you specify, using the THEN statement. A simple facing program from OD to ID #1=0(Z-START) #2=.354(FINAL DEPTH) #3=.03(PICK SIZE) #4=60(OD DIAMETER) #5=59(ID DIAMETER) G0G90G55X#4Z3.M4 WHILE[#1LT#2]DO1 #1=#1+#3 IF[#1GE#2]THEN#1=#2 G0Z-#1 G1X#5 G0U.025W.025 X#4M9 END1 Stevo |
|
#3
| |||
| |||
| Stevo Thanks for thr replie,but with your example you are not jumping out of the loop like I am and I could use a THEN statement if my control will let me. By the way it's a pro5 makino sorry about not tell you guys before. So I guess my question is can I jump out of the loop to fire an alarm? |
|
#4
| ||||
| ||||
Where: WHILE[#18LE.025]DO1 would start the whole thing off? (I don't program many macros, but this might inspire a better answer). D |
|
#5
| |||
| |||
| Beege, That's a good idea, it will depend on what he is actually trying to acheive. ggborgen, The only way you are going to know is to try it. Do a simple WHILE loop moving the machine in incremental but cut in with the GOTO statement before the WHILE is satisfied. #1=0 WHILE[#1LT5]DO1 G0G91X1. #1=#1+1 IF[#1EQ3]GOTO100 END1 N100M30 If your machine incrementally moves 5” then it never jumped out. If it moved 3” and the program ended then it jumped out of the loop with the IF statement. You don't need to actually move the machine. You could use a dwell or something if you wanted. Or just use variables to count +1 and compare values. Stevo |
| Sponsored Links |
|
#6
| ||||
| ||||
Last edited by beege; 06-23-2009 at 12:13 PM. Reason: Reword query |
|
#7
| |||
| |||
| If the WHILE statement gets satisfied meaning it never jumps out of the loop with the IF statement then it just goes to the next block proceeding the END1 which is a M30. If the IF statement works and it jumps out of the loop it will go to N100 which is a M30. WHILE statements only run between the WHILE and the END until the WHILE block is satisfied. Anything outside of that does not matter. Once it has left the loop it will not go back to it or care about any of its conditions unless you specify to return to it with a GOTO. To answer your question no it is not going to look for the END1. Good question...you are making me think for the first time today. I have jumped out of loops before conditions were met and don't recall any problems but for 99% of the time I use THEN conditions when in a loop as wrote in post2. This works on any machines I have worked on. Mainly Fanucs. It's macro programming so I see no reason why it should not work in this control. IIRC with the Fanucs you can have up to 3 WHILE statements within 1. Stevo |
![]() |
| 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 |
| Is this a valid statement...IF[#19NE1]OR[#13NE1]GOTO3000?? | theemudracer | Fanuc | 104 | 02-24-2009 08:18 AM |
| LOOPING? with Camsoft?? | nelZ | CamSoft Products | 15 | 10-15-2008 03:56 PM |
| Need Help!- Fanuc O-T looping cycle | Billet Sean | General Metalwork Discussion | 5 | 04-28-2008 02:11 PM |
| Program Looping | Bohemund | CamSoft Products | 7 | 05-26-2007 11:08 AM |
| Sub Looping | murphyspost | Daewoo/Doosan | 8 | 12-27-2006 10:28 AM |