LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Insert Code Part into Block Diagram and Wire it

Solved!
Go to solution

Hi,

I have a code snippet in my user.lib\myVIContent. I can use this tool perfectly to place the vi content into the BD when I am coding, but my question is, is it possible to place this the VI content into Block Diagram with LV Scripting and connect some wires from\to it?

And if it is possible could you tell me how should I do that?

Thank you very much!

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 1 of 7
(3,223 Views)

I don't know of a method to import a snippet (which doesn't mean it doesn't exist, but I wouldn't count on it).

What you can probably do instead is extract the VI data from the PNG file, convert it to an actual VI and then move the code into your VI. Look at the discussion here about importing snippets before LV 2009. It's basically the same process and it includes code and I believe you should also be able to do in-memory (there should be a method for generating a VI from a flattened string).


___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(1,484 Views)

Dear tst,

It seems my question was not really specified correctly. I would like to insert a code part ( as you copy a part of your BD, and paste it somewehere into a new VI BD.) If I can achieve this method by scripting this would be much more faster rather than generate the whole code. So the snippet in this context means a code part.

Thank you for your reply.

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 3 of 7
(1,484 Views)

This selects all the code and copies it to the new VI, just as if you dragged it from one BD to the other:

Move Code.png


___________________
Try to take over the world!
Message 4 of 7
(1,484 Views)

Dear tst,

Wow, thats what I was looking for. Some questions about this workaround:

  • Does the above presented solution work if the target VI BD already has code? ( Where the new VI content will be placed into )
  • Can I move the inserted do to the position where I want?
  • To Wire the new vi content to the existing should  I use Open VI Object function?

Thanks in advance!

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 5 of 7
(1,484 Views)
This widget could not be displayed.
Solution
This widget could not be displayed.

The New Owner input is for the diagram where you want the code to be. If it's in an existing VI, then OVR is one way of getting the VI's reference.

As for the rest, just read the help and play around with it. I don't know any more about this method than you do. The way to work with these things is to poke around and think logically about where things would be.


___________________
Try to take over the world!
Message 6 of 7
(1,484 Views)

Thank you very much!

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 7 of 7
(1,484 Views)