From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a Function menu VI to generate a copy of it self when it's draged and dropped on the block diagram

Solved!
Go to solution

Is there anyway to set a VI that I've placed in a pallet in the functions menu to create a copy of it self when I place it on the block diagram? 

My exampe is this. I'm creating a pallet for a messaging setup. The "send message", "recieve message" and so on will work as normal with just being called when needed. But "Create messge queues" need to be specific for each instance since I will create different number of queues each time I use it. (See NI's Queued message system for the "Continous Measument and Logging" Template).

 

So everytime I drag and drop that VI (Create message Queues) from the pallet I want it to ask me where I want to save the VI.

Is this possible? 

 

Cheers

Henrik

0 Kudos
Message 1 of 7
(2,753 Views)

If I'm understanding correctly, which I don't think I am, you want to automatically when you drop an instance of a VI on the block diagram, create a unique instance of that VI in memory to be saved to a different location?

 

Why would you want such a thing? Apart from the horrible number of different files it would create, it kind of removes the point of a VI. You say that you want to create a unique number of queues each time you use it, but would you not be better off simply putting Create Meassage Queues inside a subvi and programmatically controlling this? Surely having a subVI that controls the message Queues would be simpler and tidier then managing an increasing number of almost identical VIs.

0 Kudos
Message 2 of 7
(2,749 Views)

I understand your concern but I'm making some templates for developing software and a few subVI's each project will have will still be specific for a specific project but for most part they will look the same. So instead of needing to create it from scratch I like to be able to just place the icon on my block diagram and it asks me to save the VI somewhere into the project. 

 

I do know how to program and I know that this is a special case that is not the norm and prefered Labview programing. But it is usefull from time to time. I know I can set the VI in the menu to drop content instead of the VI itself on the block diagram....but I rather place the VI it self so that all connections are there and the icon. 

 

So if someone has an answer if it is possible to do please let me know. No real need to tell me it is bad practics since I know it is in most cases. 

 

Thank you for your help

Henrik

0 Kudos
Message 3 of 7
(2,742 Views)

Just thinking out load some what here.  But you could drop your VI down and then go into it and do a Save As and the choose to replace with the new VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(2,731 Views)

Yea I guess that might be the only way for now. Haven't heard from anyone that says it can be done. It would be nice to have that option though, in the same way as you have the option of putting the VI or the content of the block diagram. 

I see it as really helpful if you are creating a template system for developing code. Instead of "Create New VI" and start from an empty VI you could just pull one in that has a basic Icon (that you've picked) and other settings that you like it to have and also have a basic block diagram implimented already so you only have to add the specific code for the VI you are creating. For now I guess the "Save As" or just use the "put block diagram Content down" option....But then you still have to create an Icon and connect error in/out and other settings. 

 

Thanks for your input! 

 

Henrik

 

 

0 Kudos
Message 5 of 7
(2,683 Views)
Solution
Accepted by topic author henriksandin

There is always the File->New... which opens up a new window.  You can have your templates in that window by putting them somewhere (I don't remember where at the moment).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(2,670 Views)

True, that is one way of doing it. Thank you.

 

I just whish that they could use the same engine to let you put template VI's in the function menu too. It would make for faster development, especially if you then link it to a quick drop command. 

 

Cheers

0 Kudos
Message 7 of 7
(2,648 Views)