LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 07/07/2010

When programming with LabVIEW Classes, there are a few different kinds of new VIs you can create from the project window:

 

18293i0ED370838DCEAD5F

 

Some of these new VIs are created from templates.  And if you know where those templates are, you can modify them to your liking.  For example, if you want to remove the diagram comments, or maybe shorten the error cluster names, or even add code to the diagrams, you can do so, and those changes will manifest in all future VIs you create from these New... menu options.

 

New > VI from Dynamic/Static Dispatch Template

The template for these menu options is at resource\Framework\Providers\LVClassLibrary\CLSUIP_MemberTemplate.vit.  When choosing this menu option, the only real operation that occurs is that the class controls on this template are replaced, and in the case of creating a Dynamic Dispatch VI, the class terminals are set to Dynamic Dispatch.  So when modifying this template, the only real requirement is that you don't remove/rename the LV Class controls on the front panel.

 

New > VI for Data Member Access

This menu option brings up a wizard for creating new data member access VIs.  and there are 12 potential templates that might be instantiated, depending on if you're creating a read/write VI, whether or not you want error terminals, and what data type (scalar, 1D array element, 2D array element) you're trying to access.  The easiest way to find these templates is to search the resource\Framework\Providers\LVClassLibrary\NewAccessors folder for *.vit files...you should find 12 of them, and their locations/names indicate the situations in which they're used.  As for modifying these templates, they all include a decoration on the front panel that specifies where the new control/indicator should be dropped.  You can move this decoration (to change the drop location), but do not delete it.

 

And of course, if you do modify these templates, don't forget to copy them over when moving to a new LabVIEW version.

Message 1 of 17
(11,327 Views)

Hi Darren,

 

Can you please specify LV Version from which the above templates are available?

Currently, I am using LV8.2 and i couldn't see those templates.

 

Thanks,

Alagar

Message 2 of 17
(11,213 Views)

Alagar,

 

The template for creating a new static/dynamic dispatch VI (CLSUIP_MemberTemplate.vit) has been there since LabVIEW 8.2.  The data member access templates were added in LabVIEW 8.5.

Message 3 of 17
(11,143 Views)

Hi Darren,

 

Can you advise on the connector pattern aspect of this Nugget?

 

My main drive to change these was to avoid having to change the default connector pattern to our internal standard. I seem to remeber issues with the accessors in/outs being goofed up. But since then I have upgraded and forgot where thses templates where located, so I have not poked at them in a long time, so...

 

Can I change the defualt icon pattern and the connectors without causing problems?

 

Yes I could try it out but putting my work machine in jeopardy durring development would be frowned apon greatly.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 17
(11,133 Views)

Hi Ben,

 

From what I could tell, there are no adverse effects when changing the conpane of CLSUIP_MemberTemplate.vit for creating a new static/dynamic dispatch VI.

 

As for the data member access templates, there are no errors, but it looks like we aren't as smart about where we wire the new control on the connector pane.  I changed the template to be the 5x3x3x5 pattern, and the new output for a Read data member access VI was connected to the top middle terminal (as opposed to the right-side terminal directly below the class output).  Looking in the code a little bit, it appears that we have hard-coded the terminal index where we create the new terminal for read/write VIs.  I have filed myself CAR# 239362 to add some smarts to the new data member access VI utility to add the new control/indicator to the spot right below the class in/class out terminal, respectively, instead of just always using a hard-coded index.  This will make the utility play more nicely with user-modified class VI templates.

Message 5 of 17
(11,115 Views)

@Darren wrote:

Hi Ben,

 

From what I could tell, there are no adverse effects when changing the conpane of CLSUIP_MemberTemplate.vit for creating a new static/dynamic dispatch VI.

 

As for the data member access templates, there are no errors, but it looks like we aren't as smart about where we wire the new control on the connector pane.  I changed the template to be the 5x3x3x5 pattern, and the new output for a Read data member access VI was connected to the top middle terminal (as opposed to the right-side terminal directly below the class output).  Looking in the code a little bit, it appears that we have hard-coded the terminal index where we create the new terminal for read/write VIs.  I have filed myself CAR# 239362 to add some smarts to the new data member access VI utility to add the new control/indicator to the spot right below the class in/class out terminal, respectively, instead of just always using a hard-coded index.  This will make the utility play more nicely with user-modified class VI templates.


Thank you very much Darren!

 

Once that CAR is fixed, I will be able to make use of this Nugget and it will save me the time of looking at the icon connector twice. Twice? Twice becuase I usually change the icon pattern as the first step, but by the time I am done composing the icon, I have forgotten if I changed the connector pattern on THIS one.

 

Thank you!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 17
(11,109 Views)

It would be nice if we could plug-in our own templates in the drop-down menu. In the case Ben mentioned, we could have a Dyn Dispatch 4x2x2x4 template and a Dyn Dispatch 5x3x3x5 template. Or we could have special templates for by-ref classes (like Data Member Access with DVR).

 

Felix

Message 7 of 17
(10,983 Views)

Hi Everyone,

 

 

 

If you're using XControls frequently, you'll probably be happy to know that you can also edit the XControl templates to your liking.

 

 

 

For a Windows OS, the templates are located here:

 

C:\Program Files\National Instruments\LabVIEW 2010\resource\Framework\Providers\xi\xctl.llb

 

 

 

To edit, just open the llb and edit a VIT. Hit Save, and without even restarting LabVIEW, you'll be able to create XControls with your new template.


Note: If you're using multiple versions of LabVIEW, you'll have to edit the templates for each version independently.

Product Support Engineer
National Instruments
Message 8 of 17
(10,491 Views)

Alright, data member access VI creation just got smarter.  As a fix for CAR# 239362, the terminal for the data member control/indicator should now be placed in the 2nd-highest terminal on the left/right side of the connector pane, regardless of pattern.  The fix will be in LabVIEW 2011, but if you'd like to try it out in LabVIEW 2010, place the following two VIs in your LabVIEW 2010\resource\Framework\Providers\LVClassLibrary\NewAccessors\BaseAccessorScripter folder.  Let me know what you think, and if you have any problems.

Download All
Message 9 of 17
(10,378 Views)

Couple questions:

 

1. I saw a tip one time that explained how to change accessor's default naming from Read/Write to Get/Set, but I can't find it again.  Can you post it?

2. I opened the ReadIcon and WriteIcon bitmaps and resaved them as pure white images.  The glasses and pencil icons still show up on my accessor methods.  Is there a way to remove them?

3. The template fp decoration points to the spot where the top-left corner of the label will be positioned.  Is there a way to ignore the label when positioning?  (Yes, I realize I'm being pedantic... I'm just asking...)

4. On the template block diagrams moved the input controls closer to the case structure and moved the labels so the right edges line up with the right edges of the terminal.  It stuck for the error in terminal, but the other terminals still line up on the left sides.  Can that behavior be modified?

0 Kudos
Message 10 of 17
(10,275 Views)