LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using scripting to copy a cluster from one vi to another

Hi all.

 

I new to Labview, and I just started playing around with the scripting functionality.  Unfortunately, I've reached a road block and I need some help to figure out how to do what I need to do (if its even possible).

 

Basically, I want to use scripting to copy a cluster containing one or more user generated controls from a VI which is saved on disk into a new VI which I'm creating using scripts.  Thus far, I have been able to open the existing VI and grab a reference to the cluster, but I haven't been able to place the same cluster into the new VI (only a generic empty cluster).  I'm not concerned about the values inside the controls in the cluster...I just need a cluster with the exact same controls inside of it in my new model.

 

i.e., If it is a cluster with 3 numerics, 1 boolean and 1 string in that order, I need a cluster created with 3 numerics 1 boolean and 1 string in my new model, but I don't care if the fields are populated with the same values.

 

It seems the "Open VI Object Reference" node is only used to grab and modify an object within a VI, but can't be used to copy it or move it to another VI.  The "New VI Object" node doesn't seem to allow you to specify an existing object to create the new object from.  The only possible solution I can think of would be to open the existing VI, and use "Open VI Object Reference" to grab a reference to the cluster.  From there, could I create a new cluster, and possibly iterate through all the controls which the existing cluster contains, and copy them into the new cluster?

 

Of course if there is another solution I'm open to any and all options.  Thanks for the help!

0 Kudos
Message 1 of 5
(4,784 Views)
Try the the Move method on the control.  You can also try Panel methods Make Selection, Copy Selection, and Paste Selection.
0 Kudos
Message 2 of 5
(4,782 Views)

I tried the move and panel select/copy (I couldn't find the paste), but I finally found a solution that works perfectly.  There is a VI Invoke method called "Create from Reference" that creates a perfect copy of what I need.  Thanks for the help!

0 Kudos
Message 3 of 5
(4,757 Views)

DFGray, I cannot seem to find Paste either, where is it hidden?

 

17301i4B366AF84B3F0456

 

(Using 8.6)

0 Kudos
Message 4 of 5
(4,630 Views)

Found it!

 

Of course spending a few minutes actually thinking normally helps Smiley Tongue

 

17311i3EACF6B4D227A7EF

0 Kudos
Message 5 of 5
(4,627 Views)