I was wondering if I could get a little help with if/then statements. I have used the yes/no statement and puts in C1 comment blah blah blah I have seen in programs already written a if /then statement below this but am clueless of how to insert this I have used F1 with little help
IF/THEN STATEMENTS
Collapse
X
-
I use IF/GOTO statements and can post some code if that will help you? Let me know.PCDmis 3.5mr2 CAD++ -
Originally posted by Ken379128I was wondering if I could get a little help with if/then statements. I have used the yes/no statement and puts in C1 comment blah blah blah I have seen in programs already written a if /then statement below this but am clueless of how to insert this I have used F1 with little help
There is more than one way to insert an IF statement, but the quickest is probably to go to Command mode where you want it to be and type IF and press TAB. This will put some code that looks like this:
IF/0
END_IF/
Then you can highlight the 0 and type a condition to test for.
For example,
C1 =COMMENT/YESNO,NO,Do you love PC-DMIS?
IF/C1.INPUT=="YES"
COMMENT/OPER,NO,"I LOVE PC-DMIS."
END_IF/
So, if the input of the C1 comment matches "YES", it will execute the statements inside the IF command block. If not, they get skipped.
Good luck,Jared Hess - PC-DMIS Documentation Team Lead @ HMI
[View 2008 Reporting Tutorials Here]Comment
-
Question for Jared
Originally posted by JaredHess......Then you can highlight the 0 and type a condition to test for.
For example,
C1 =COMMENT/YESNO,NO,Do you love PC-DMIS?
IF/C1.INPUT=="YES"
COMMENT/OPER,NO,"I LOVE PC-DMIS."
END_IF/
So, if the input of the C1 comment matches "YES", it will execute the statements inside the IF command block. If not, they get skipped.
Good luck,
I was wondering something on the IF/GOTO statements as I do not know how PCDMIS compiles for execution. Should we be in the same camp as Basic and C where IF/GOTO should be avoided unless absolutely necessary? PCDMIS programs are much shorter and smaller than most Applications that one writes in Basic or C (not to mention linear vs event driven) so I was not sure if convention-wise we should try our best to only use it when other options don't exist or are cumbersome. I don't use it because there is usually a solution that is easier for me to keep track of layout wise but what say you?
Craig
BTW thanks for posting here it does mean a lot to us.<internet bumper sticker goes here>Comment
-
Originally posted by craiger_nyI was wondering something on the IF/GOTO statements as I do not know how PCDMIS compiles for execution. Should we be in the same camp as Basic and C where IF/GOTO should be avoided unless absolutely necessary? PCDMIS programs are much shorter and smaller than most Applications that one writes in Basic or C (not to mention linear vs event driven) so I was not sure if convention-wise we should try our best to only use it when other options don't exist or are cumbersome. I don't use it because there is usually a solution that is easier for me to keep track of layout wise but what say you?
Craig
BTW thanks for posting here it does mean a lot to us.
I confess that in some of my VBA scripts, I have used labels when I couldn't get my right-brained mind (I'm an English Major) to figure out a different solution.
Ultimately, my personal view is to use what method works best for you, as long as it gets the job done.Last edited by JaredHess; 07-21-2006, 01:56 PM.Jared Hess - PC-DMIS Documentation Team Lead @ HMI
[View 2008 Reporting Tutorials Here]Comment
-
Ken, you can always go the more user friendly way of F9'ing the IF/THEN code. A setup type window will pop and you can find your variables etc there.I used to be high on life but I built up a tolerance.
Brown & Sharpe Global Advantage
PCDMIS CAD++ v2011mr2
PH10MQ/SP600M
sigpicComment
-
I tried the F9 but in the example given I get the 1st line everything after that was not going good of course I did not have much time to play around today, I hate busy Fridays. Thanks for the helpSince I gave up hope I feel much better !!!Comment
Related Topics
Collapse
-
by dwadeI've got a program that runs in two ops, first wire op and then the part complete. Progam runs all the way through both ways but the comment does not...
-
Channel: PC-DMIS for CMMs
06-26-2009, 07:09 AM -
-
by cmmguyHere is a utility to give you a Drop Down List in PCDMIS.
Go here to find it.
Linky
Suggested locations:...-
Channel: PC-DMIS Code Samples
11-27-2007, 01:45 PM -
-
by whishoHello.
There must be a way I tell if the deviations that are within a range to do something, if not, do something else. Could someone help me a...-
Channel: PC-DMIS Code Samples
03-10-2010, 12:49 PM -
-
by tomeqI want to have 3 programs in one using control pair IF/END_IF
I want to have some points from the first program in the second?
C1 ...-
Channel: PC-DMIS for CMMs
11-24-2015, 12:36 PM -
-
by AndersIOK, I'm stumped (not really, but I would like a general solution).
If I have an IF_GOTO/C1.INPUT == "YES" in my program, it will...-
Channel: Tips & Tricks
05-27-2014, 09:31 AM -
Comment