Jump to content

Drop VI on diagram?


Recommended Posts

QUOTE (vugie @ Nov 20 2008, 12:53 AM)

http://forums.lavag.org/Diagram-shortcuts-t10208.html' target="_blank">Here is a simple tool I wrote some time ago, where I used copy-paste mechanism to drop something on BD.

That seems pretty interesting, though I don't want to copy pre-existing code, just a VI from disk. Maybe scripting could drop it in a new VI and your tool could grab it from there (seems like a rube goldberg approach). I was hoping someone who knows more about quickdrop (Darren?!?) could tell me how to do the very last bit of putting something on the cursor for dropping.

Also, I have SuperPrivateScriptingFeatureVisible=True but I am still not able to access all those methods. Is that stuff that was only in LV 7.1 and you have to save those nodes in 7.1 to get access in later versions, or is my setup still wrong?

Link to comment

QUOTE (jdunham @ Nov 20 2008, 02:14 PM)

That seems pretty interesting, though I don't want to copy pre-existing code, just a VI from disk. Maybe scripting could drop it in a new VI and your tool could grab it from there (seems like a rube goldberg approach). I was hoping someone who knows more about quickdrop (Darren?!?) could tell me how to do the very last bit of putting something on the cursor for dropping.

You can use scripting to drop a VI from disk (the New VI Object function has a path input), but there is no easy way of putting an arbitrary VI of your choosing *on the cursor*. The Drop Ctrl or Func method will only take an object name (as a string), and that object has to be on the palettes.

The only way I can think of (and this is very kludgey) is to programmatically add the VI in question to the palettes with the Palette API (maybe to a dummy user.lib subpalette?), programmatically refresh the palettes, then use Drop Ctrl or Func (or Quick Drop) to put the newly-added palette VI on the cursor. The main problem with this method is the amount of time it takes to programmatically refresh the palettes.

-D

Link to comment

QUOTE (Darren @ Nov 20 2008, 03:40 PM)

...The only way I can think of (and this is very kludgey) is to programmatically add the VI in question to the palettes with the Palette API (maybe to a dummy user.lib subpalette?), programmatically refresh the palettes, then use Drop Ctrl or Func (or Quick Drop) to put the newly-added palette VI on the cursor. The main problem with this method is the amount of time it takes to programmatically refresh the palettes.

There is a faster way. Just temporary replace and existing VI already in the palette by the VI you want to drop. Once the drop is complete, restore the original VI.

This works fine and it is fast enough.

PJM

Link to comment

QUOTE (PJM_labview @ Nov 20 2008, 10:42 PM)

There is a faster way. Just temporary replace and existing VI already in the palette by the VI you want to drop. Once the drop is complete, restore the original VI.

This works fine and it is fast enough.

That sounds like it's worth a try. Thanks!

Link to comment

QUOTE (jdunham @ Nov 19 2008, 08:19 PM)

Is there a way to drop a specific VI on a diagram a la quick-drop? I see there is a special invoke node App:User Interaction:Drop Control or Function, but it doesn't seem to work with VIs.

How are you specifying which VI you want to drop off disk? If it's with a File Dialog, you can just use Quick Drop to "Select a VI...". In fact, I have a shortcut ('sav') for Select a VI to make it even faster.

-D

Link to comment

QUOTE (Darren @ Nov 21 2008, 10:30 AM)

How are you specifying which VI you want to drop off disk? If it's with a File Dialog, you can just use Quick Drop to "Select a VI...". In fact, I have a shortcut ('sav') for Select a VI to make it even faster.

We hates file dialogs, we does. When you have several thousand VIs, many with similar names, it's very hard to find them using Windows Explorer or file dialog boxes. QD is neat, but much more often I want to find other VIs in my hierarchy which may not belong in a reuse palette, but I need to find them and sometimes I want a new copy.

So we have a tool which is kind of like quick drop but searches the open projects (BTW it would be awesome to have this feature as part of QD) . It works great for opening VIs, but often it would be cool to have the VI it finds available for dropping on a diagram. Normally it's not too bad because you can open the VI and grab its icon, but if the VI in run mode, you may have to go to another vi and change the tool, etc. Also, you can't grab the icon of a polymorphic VI and drag it onto a diagram. I want to drag items from the listbox and have the VIs drop onto my block diagram.

Link to comment

QUOTE (jdunham @ Nov 21 2008, 12:51 PM)

We've received this feature request before...we're looking into adding functionality along these lines in a future LabVIEW version.

QUOTE (jdunham @ Nov 21 2008, 12:51 PM)

It works great for opening VIs, but often it would be cool to have the VI it finds available for dropping on a diagram.

PJM's suggestion about replacing an existing palette VI with your VI is intriguing, but it seems to me you might have linking issues (like VI search dialogs) when dropping a VI that normally resides in one location on disk from a completely different location. Could you perhaps add code where, if the user double-clicks a VI in your tool, it uses New VI Object to script that VI down on the diagram of the currently active VI, at which point you could drag it where you want it to be? I know it's not as convenient as putting the VI on the cursor, but it's the best solution I can think of with what you currently have available.

-D

Link to comment

QUOTE (Darren @ Nov 21 2008, 11:02 AM)

... but it seems to me you might have linking issues (like VI search dialogs) when dropping a VI that normally resides in one location on disk from a completely different location...
Not if the item you replace is a merge VI ;)

Dynamically, create a new VI (in memory) where you can can use scripting to drop a VI from disk (using the New VI Object function you mentioned earlier). Now save this VI as the merge VI replacement and the drop will work fine (with no linking issue).

I typically use the true constant merge VI to do this.

PJM

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.