This lesson is part of the Vision Components and Property Bindings course. You can browse the rest of the lessons below.

LESSON LIST

Autoplay Off

Supplemental Videos

Description

Learn how to use a UDT (User Defined Type) as the template's parameter.

Video recorded using: Ignition 7.7

Transcript

(open in window)

[00:00] In the previous lesson, we showed you how to create a template using indirect tag bindings so you could point indirectly to a set of tags based on a single parameter. This time, let's create a template using a UDT. So here I have a Motor UDT that I've already created. And there's four instances down below of that UDT, Motor one, two, three, and four. Of course, all four motors have the exact same four tags. Each Motor here you can see is the data type called Motor. So I'm going to go up here into our templates, right click, create a new template. I'm going to rename the template to Motor. And just like before, we have to create a parameter. I'm going to right click on the checkered area, go down to Customizers, Custom Properties. I'm going to add a template parameter. Rather than using a simple parameter like Motor Number that we use for indirection, I'm going to create a UDT here. I'm going to call it Motor. And the data type I'm going to use is under the User Defined, under Tags, I'll see the Motor that I created. I'm going to set it to be a Drop Targets for ease of use of drag and dropping these tags onto the screen. Go ahead and press "OK". I'm going to put a Motor graphic in here. I'm going to put a label at the top to show the name of the Motor. And of course I'm going to put an LED Display at the bottom for the amps. So all three of these things are going to be linked to parts of that UDT. So I look at the template itself. I'll go down to the parameter. You'll see, because it's a UDT, there's a magnifying glass here that shows all the parameters inside of it. So all four of those things: AMPS, HOA, RUN_CMD, and STATUS. You also have a special folder called Meta which shows you the tag, the TagName and the TagPath for that UDT that we linked to on the screen. So all you got to do here now is link each one of these things up. I'm going to go to Label. I'm going to bind the text property Label to a property this time. I'm going to go inside the UDT, inside the Meta folder, and get the TagName. I'm going to do the same thing for the graphic here. I'm going to go down to the square and I'm going to bind the Fill Paint property to a property, selecting up here at the top the Motor UDT going inside of it, getting the HOA and if the value is zero, I'm going to make it red. If it is a one, I'm going to make it green. And if it is two, I'll add another entry there. I'm going to blink between yellow and orange. So I'm using the UDT here for all three of these items. I'm going to do the same thing at the bottom for the LED display. Go down to the value. Going to bind this to a property, going inside my Motor UDT and getting the AMPS tag. Once I do all that, I can now use the template on a screen. When you're designing a template, you won't see any values here. You actually have to wait 'til you use it on the screen. If I go to my "Main Window 2". Let me go ahead and close the Motor first. Go down to "Main Window 2" here, and drag my Motor on to the screen. And now I can actually link up the Motor UDT to one of my tags. Now without having to do that, we can actually just drag and drop these tags. By making a drop target, I can take "Motor 1", drag it onto the screen because only one template with that same UDT it automatically creates that Motor for us, that template. Do the same thing for two, three, and four, so it's very easy to get these things created once we use these UDTs.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.