LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronized Copy Paste Between 2 VIs

Hello,

 

I hope what I am going to try to explain is not gonna be very confusing. I have 2 VIs and for the sake of understanding I am going to call them VI1 and VI2. I would like to copy the block diagram of VI2 and past it into the block diagram of VI1 while it retains its full front panel form. Whenever I try to copy the block diagram from VI2 to VI1, it creates a cramped front panel but retains the block digram form (which is the best I could do so far).

 

To further demonstrate my question, I have created 2 VI that each contains tab controls, and I would like to add the VI2 tab control into the tab control of VI1. You can find the VIs as the attached files (LV2012 compatible).

 

Why I want to do that ? I have a quite intricate tab control inside tab control user interface, I want to work with a not so crowded block diagram thus I copy my original VI and work on it. Thus, after I am done with my new tab (VI) I would like to just integrate it directly into my MAIN VI.

What I already know? I know that I can duplicate the tab, but I loose the block diagram form and vice versa. I know that I can drage the front panel from V2 into V1 retaining the front panel form BUT loosing the block diagram form.

 

I will appreciate all help, because this will probably save me days on this project.

 

Cheers,

Diural

Download All
0 Kudos
Message 1 of 11
(963 Views)

Rather than copy and paste code to duplicate it you should be looking at how to make those blocks into subVIs which can be called whenever/wherever you need them. I generally prefer to separate the UI from the core application logic as much as possible and just pass data to be displayed via a queue or user event. Likewise, use a queue to pass user input to the lower level processing code.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 11
(907 Views)

If you make a snippet of the entire block diagram, the controls, in their original positions, come along as well (although the controls are offset if you've not been using the origin as upper left for your BD).  I don't believe that decorations transfer, and that's probably because there is no representation of a decoration on the block diagram.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 11
(902 Views)

Hello Mark and Bill,

 

Mark, I don't want to work with subVIs due to my need to have while loops to show real time change on the front panel. Thus, sadly subVI is not a definitive option/solution for me.

 

Bill, yes my problem is definetly with the decorations and the placement of my indicators within, but tab decoration has a block diagram icon thus I did not get what you mean exactly. I am posting the pic of the icons below:

tab_in_blockdiagram.png

Thanks for the insight guys, but given this topic is also posted in "new ideas" I am not sure that their is a definite solution for it :(.

 

Take care,

Diural

0 Kudos
Message 5 of 11
(874 Views)

Hi Diural,

 


@Diural wrote:

I don't want to work with subVIs due to my need to have while loops to show real time change on the front panel. Thus, sadly subVI is not a definitive option/solution for me.


What about using subpanels to show your subVIs within the frontpanel of the mainVI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(868 Views)

@Diural wrote:

Mark, I don't want to work with subVIs due to my need to have while loops to show real time change on the front panel. Thus, sadly subVI is not a definitive option/solution for me.


That's not a good reason.

 

Using SubVIs and while loops to show real time change on the front panel are not mutually exclusive.

0 Kudos
Message 7 of 11
(859 Views)

wiebe@CARYA wrote:

@Diural wrote:

Mark, I don't want to work with subVIs due to my need to have while loops to show real time change on the front panel. Thus, sadly subVI is not a definitive option/solution for me.


That's not a good reason.

 

Using SubVIs and while loops to show real time change on the front panel are not mutually exclusive.


Agree 100%. Based on Diural's statement that would mean that all LabVIEW code would end up with massive monolithic top level VIs. This simply is the wrong approach. Perhaps a bit more time with some of the training resources would be a good idea.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 11
(853 Views)

Hi,

 

Gerd, I will look into it thanks for the pointer.

 

Carya, "Using SubVIs and while loops to show real time change on the front panel are not mutually exclusive." please do elaborate more or point me towards a learning prologue about this specific issue, I will highly appreciate it.

 

Cheers,

Diural

0 Kudos
Message 9 of 11
(843 Views)

@Diural wrote:

Carya, "Using SubVIs and while loops to show real time change on the front panel are not mutually exclusive." please do elaborate more or point me towards a learning prologue about this specific issue, I will highly appreciate it.


As mentioned: subpanels.

 

Make your 2 SubVIs, with the controls to update as input. The VIs don't need to do anything. They only contain the UI.

 

On your main VI, call the SubVIs when they need to update.

 

Also, put them in two subpanels.

 

You'll now have 2 SubVIs, for 2 UIs, running as efficient as before.

 

That's just one way to do it. You can also use references to update individual controls (on the subVI, in a SubPanel or not).

Message 10 of 11
(838 Views)