PC-DMIS Tech Tip: This short video demonstrates how to use the Else/End_Else command in PC-DMIS. Using this command allows you to write a program with 2 different execution options.
Click Here to learn more about our affordable Software Support Packages - the same group that makes these Tech Tips!
In this video, I'm going to show you how to use the else end else command. I'll quickly show you where to find that in the menu. It's under insert, flow control command, controlled pairs. There it is right there. Else end else.
Let's take a look at my program. What I'm doing here is auto-calibration, but I have to auto-calibrate commands. My goal is to execute either one or the other. It's always gonna execute one depending on the answer to a question.
The question is, has the calibration sphere moved? If the answer is no, it will execute the first command. You can see it there between the if and the end if. What I've done to the auto-calibrate command is programmed it to say qualification tool moved =no. I've just answered that question ahead of time.
The beauty of the else end else command is that, if the first question fails, it will do the other command in between the else and the end else.
You can see in my second auto Calibri command, I have answered the question, "Yes, the qualification tool has moved." Two similar commands with one important difference. One thing to note about the ELSE_END_ELSE command is it's required to come immediately after the END IF command. I can't just space it out and put it somewhere else in the program. It has to be attached, it has to come right after the END IF. Let's run the program, and I'll go through both scenarios.
We'll just answer this operator comment, okay, to begin auto-calibration. Here's my yes, no question. Has the calibration sphere moved? I'll answer yes. Now the operator is prompted to take a manual hit to locate. This is the command that's in between the ELSE and the END_ELSE statement.
You can see it there. My second auto-calibrate command.
Let's run it again. And I'll answer... click OK first. Here I'll answer no. You can see there, I'm just simulating, calibrating the probe. This is actually the first auto-calibrate command in my program. I'll just click OK to exit. Looking at the code, you can see in my second execution, the IF statement is true. Because it's true, it executes the first auto-calibrate command with the qualification tool moved =no, so it just goes ahead and calibrates.
I just wanted to show you a good use of the ELSE_END_ELSE command. It was actually not that hard, but extremely useful in a situation like this. I hope you found that useful. Thanks for joining me, and we'll see you next time.