PC-DMIS Subroutines | PC-DMIS Tech Tips - CMMXYZ

Поділитися
Вставка
  • Опубліковано 17 бер 2021
  • This tutorial provides a short introduction to using subroutines in PC-DMIS. Subroutines can be a real time saver by allowing you to easily insert large blocks of pre-written code into new part programs.
    Hey, so in this video I'm going to talk about subroutines. So, subroutines are actually not that difficult. They're fairly straightforward. They can be complicated, but in this video I wanna show you a simple example of how we create a subroutine and then how we recall it. So this can be a program where you have repetitive code or something that you use often in other programs. My example here has a simple part with just a manual alignment and a DCC alignment. So the first thing we wanna do is I would recommend putting your subroutines in special programs, like don't just make it a normal program, and we'll save it in a certain spot on the computer, which I'll show you in a minute. So let's first create a subroutine and then I'll save this program into my subroutine directory. First thing we wanna do is put our cursor where we want the subroutine to begin. So this is important. So if we have certain tips or certain profiles that we wanna include, we need to make sure we do that by placing the cursor at the correct spot. So I'll just put my cursor here after the tip command and before my first manual feature. So this will work for me and I'll show you later when I recall it that this will work. Okay. So, I've also saved a layout that has a subroutine toolbar. You can see it up here. It just makes it quicker for me.
    First thing I wanna do is create the subroutine command, and I'll show you in the menu where we find that. So that's under Insert, Flow Control Commands, and down here you can see Subroutine, End Sub, and Call Sub. So those are the three I'll be using in this demo and I have them on this toolbar here. So we'll just use the toolbar. So the first one is just the Subroutine. We'll just give that a click and then give it a name. So I'll just call this alignments and say okay. So that's it. So you can see the command line there, subroutine command, the name of it in blue and then the equal sign. So everything after the equal sign will be included in my subroutine. So next we need to end the subroutine. So at the end of mine will be the end of my DCC alignment right there. So I'll just press my handy icon here, End Sub, and you can see the command line. That's basically it. So we give it a name, we set where it starts, and we set where it ends, and that will be saved inside of this special program. Okay. So now, next step is to save this in that location. So, this is not required to save it in a certain spot but it's recommended. So what I've done ahead of time is in edit set search path, Edit, Preferences, Set Search Path, I've actually made a subroutine directory, right here, where I've specified one and you can see it here.
    I can just copy that path so I can access it pretty quickly, and I've put, in this folder, all my programs that contain subroutines. So this just helps us later when we have to recall it. So this isn't required but it's actually pretty helpful. So I'll just exit out of that, and let's go ahead and save this as a program. So I'll do Save As, and you can see these are all of my subfolders and I'll just go ahead and open that 2019 subroutines folder I created, and this is it here. So I'll call it subroutine demo. I have a second one in there called My Subroutines, which I'll access later. So let's go ahead and save that program containing the subroutine in this special folder. Let's save that. So that's gonna help us later when we want to recall this. Okay. So, now that we've saved the subroutine, let's go ahead and open a new program to recall my two alignments. Okay. So here's a brand new program. It's important in here that I have the same profile and the same active tip as in my subroutine. If not, I could have adjusted for that inside of the subroutine but I just wanted to keep this pretty simple. So let's go ahead and recall that subroutine. So it's my third icon here, Call Sub. So again, from the menu, it's Insert, Flow Control, Call Sub. So I'll click this one just to show you. So here is where saving it in that special folder really comes into play.

КОМЕНТАРІ •