![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| CamSoft Products Discuss Camsoft PC based CNC controller products here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
How do I put these 2 on the same line? They are to be run inside an Mcode. !IF \21=GET STAGE 1 THEN[GetStage1] !IF \21=GET STAGE 2 THEN[GetStage2] Nothing I do seems to work.. ELSEIF, ELSE IF, ORIF, OR IF, bla bla bla.. When I put them on the same line, only the first IF statement will run... I can not get the 2nd one to work.. They work fine if they are on different lines. Thanks for the help with all my quesitons.. ![]() Murphy |
|
#2
| ||||
| ||||
And if I'm wrong, just forget it. ![]() Yoram |
|
#4
| ||||
| ||||
| I agree with Yoram, !IF \21=GET STAGE 1 THEN[GetStage1] <---ends !IF \21=GET STAGE 2 THEN[GetStage2] <---ends if 21 is "GET STAGE 1" then is "true" so it assigns a certain value to memory, when it executes the next line the first result is cleared from memory since you are refering to the same "21" and writes no value to memory or might retain original value since is "false" Is all about logic, I do not know Mcode but most programing languages all abide by the same rules. I know a little Visual basic and I do alot of functions in excel. What you are trying to do is a "nested statement" (two logical checks on the same line)....you need to connect the two. my guess would be something like this: !IF \21=GET STAGE 1 THEN[GetStage1],!ELSEIF \21=GET STAGE 2 THEN[GetStage2] !END IF 3 nested checks: !IF \21=GET STAGE 1 THEN[GetStage1],!ELSEIF \21=GET STAGE 2 THEN[GetStage2],!ELSEIF \21=GET STAGE 3 THEN[GetStage3] !END IF I used a comma to connect the two statements I am positive is wrong. take a look at other Mcodes that have two or more checks and see how they are connected. If your only two choices are stage 1 and stage 2 then I would simplify by using one check that would satisfy a true or false if is true then this, if is not then this Maybe: !IF \21=GET STAGE 1 THEN[GetStage1] !ELSE \[GetStage2] !END IF Again I dont know Mcode language however you must think "logic", in other words computers are dumb and only do what they are told, try to think like a computer "what are you telling me to do?" funny note: I took a C++ programing course. The most fun day was when the instructor asked us to write instructions on how to make a peanut butter and jelly sandwich, simple huh? He later broke out a bag of bread , jelly and peanut butter and had the students follow other students instructions and try to make the sandwich. Needless to say is hard to make a sandwich with a jelly jar, a peanut butter jar, two lids, a knife, a piece of bread, and a bag of bread all in your hands since who wrote the instructions never said to place these items down. Last edited by Cyclone; 04-01-2005 at 11:30 AM. |
|
#5
| ||||
| ||||
Most students came up with varying degrees of electronic complexity, and all would have probally done the trick, but the one that won was the simplest solution. The winner suggested hanging a tennis ball on a string from the rafter that just contacted the windshield just in front of the driver side. Al
__________________ “Logic will get you from A to B. Imagination will take you everywhere.” Albert E. (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
| Sponsored Links |
|
#6
| |||
| |||
| To all posts above.. So I stumped you guys??????? Actually, I have to check \21 against 10 different possibilities in Mcode2 and then later in the same Mcode2 I have to check another 12 possibilities again I am pretty good with VB but there is no ELSE function in the Camsoft interface.. And there is no SELECT CASE function either.... Anyone have any other ideas??? Murphy |
|
#7
| |||
| |||
| Hello. I'm not familiar with the interpreter you're using but, are you sure you can use a variable names with spaces in them? as in "get stage 1" as opposed to getstage1? What's wrong with WayneHill's suggestion? JR |
|
#9
| |||
| |||
Spaces are ok it seems because most of my code is working.. My problem relates the the fact that my code is limited to 100 lines so if I put things on seperate lines, I am going to run short and not be able to finish it.. (this is a camsoft limitation) Hmm.. Murphy |
|
#11
| |||
| |||
[GetStage1]:IF \21=GET STAGE 2 THEN [GetStage1];IF \21=GET STAGE 2 THEN [GetStage1] ELSEIF \21=GET STAGE 2 THEN [GetStage1] ELSE IF \21=GET STAGE 2 THEN [GetStage1]OR IF \21=GET STAGE 2 THEN It seems as though the camsoft coding will only let me test for 1 item per line.. I can however do a THENIF statement but that only works for both conditions holding true. Any other ideas?? Im stummped.. Placed a call to camsoft but got no reply. Murphy |
|
#12
| |||
| |||
| MurphiesLog StarDate 2005 You can only perform the following statements: IF THENIF But you can also perform loops as you saw in my FILEREAD logic. CamSoft helped me with that. You can perform quite a bit a stuff with these two using MCODES, GCODES, MACROS and INPUTIO files. CamSoft has a very helpful front office and I always got a fast response, actually most of the time I get right through to support or a call back within the hour. |
![]() |
| 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 |
| single line fonts? | balsaman | General CAM Discussion | 12 | 02-18-2006 12:51 PM |
| Single Line Fonts | A. Shuford | General CAM Discussion | 1 | 11-14-2004 09:21 AM |
| Tool tables | Nimrod | Mastercam | 4 | 11-24-2003 03:31 PM |
| Please help me out with the line : G450 CFTCP | BanglaTech | General CAM Discussion | 0 | 10-25-2003 02:08 AM |
| Line weight | JOE65 | Autodesk Software (Autocad, Inventor etc) | 4 | 05-21-2003 12:31 AM |