Using A Loop Counter in PC-DMIS

Published by CMMXYZ on January 13, 2023

This video provides a quick tutorial on using the counter function of a loop command in PC-DMIS. This is useful when you want to distinguish between different looped parts in an inspection report.

Click Here to learn more about our affordable Software Support Packages - the same group that makes these Tech Tips!

In this video, I want to talk about looping and PC-DMIS. And as you can see here in our training room, I have our training CMM set up with three of our demo blocks. We're in a short program with a few dimensions looped three times. Looping is something we introduce in our PC-DMIS Level 2 curriculum. If you want to check out some of the training courses we offer, please go to our website in the training section, and you can actually sit in this room right here and get trained by myself or some of our other instructors.

What I wanted to talk about specifically with looping is the variable component of it. Loops themselves are actually variables and the value of the variable is actually a counter. When we run the loop once the value is one, when we run it a second time, the value is two. And I'll show you how to take advantage of that counter in a PC-DMIS program.

If you look at the loop command here, I have it open here in a dialogue box in the middle, you can see Variable ID. This is where you could change the name of it, but the name is less important than what the variable actually does. I'll just leave it at default V1. and for this first program that I ran, I want to keep loop IDs checked. That is the default setting, and I'll show you what that does. So let's run the first program and then we'll see what kind of a report that produces.

So as you can see here, the final report produced from that program, it's not as clear as you might like. So recently, I showed a new programmer how to use a loop and he didn't like the report because it's all bunched together and it doesn't distinguish between part one, two, and three very clearly. It does show the loop IDs with a square bracket, which is the default setting and that was from the checking the loop IDs check box. What I showed him was a way that we can use the loop variable as a counter. Let's take a look at the second program I wrote using the variable to our advantage.

Here's my second program. This one is a little more advanced. You can see my loop command right there. What I've done with that variable ID V1 is I actually inserted it into a report comment at the end of my program. You can see it there. What I'm doing is using the counter to identify each iteration of the execution of the program. So, the text will show once it's executed as demo block one, demo block two, demo block three with a bit of spacing to make the report a little more clearer.

The other thing I've done with the variable V1 is a little more advanced. I've again used the counter aspect of the variable. You can see here I've assigned the variable V3 to correspond with the part number. So part number one, when the counter is one, it'll show the wording grey, and number two, yellow, number three green. I just wanted to show you a second way we can use that variable ID V1, in our reporting. If we go back to the report comment, you can see down here, I've just included both of them. Both of those are using the counter aspect of the variable function of the loop.

We'll run this and then I'll show you what the report looks like after. So here you can see the final report including both the part number and the color of the part. Both of those are drawn from that variable V1 counter. That is just a quick tutorial on using the counter part of the loop in a report comment. I hope you found that useful. Thanks for joining me. And we'll see you next time.

Related Articles

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram