From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way of dropping typedefs or subVIs without saving them first?

The only way I found of dropping a control or a subVI is by using the New VI Object primitive, which accepts either a style or a path to the object. The style is irrelevant in my case (typedef or subVI) and the path poses a problem - the object I want to drop is newly created. Ideally, I would rather not save it and let the user decide when to do that.

The problem is that I haven't found any way of dropping a VI or a typedef without saving it first. Does anyone know of one?


___________________
Try to take over the world!
0 Kudos
Message 1 of 6
(5,230 Views)

I believe you can provide a string with the name of an unsaved subVI (untitled 1) to the path parameter of the New VI Object function.

I think this does not work for properties / methods which allow a style/path input, like the 'replace' method, because the New VI Object function knows how to adapt to inputs, and most properties and methods do not.

I also do not know if this works for VIs with a qualified name (library 1:untitled 1).

I also think this does not work for unsaved typedefs.

I'll dig around and let you know if I find results different than what I've posted here.

0 Kudos
Message 2 of 6
(4,163 Views)

I see I'm getting very quick answers today. Thanks. All the following tests were done in LV 2009 without scripting enabled.

I believe you can provide a string with the name of an unsaved subVI (untitled 1) to the path parameter of the New VI Object function.

Correct, although the name is case sensitive (unlike the Open VI Ref primitive).

I think this does not work for properties / methods which allow a style/path input, like the 'replace' method,

Can't check, but that was actually something I should have asked about, as one of the things I created was a "create typedef from constant" plugin, which ideally would also replace the constant with the typedef.

I also do not know if this works for VIs with a qualified name (library 1:untitled 1).

Surprisingly, in the "Untitled Library 1:Untitled 2" configuration I just used, it worked both with the fully qualified name and when using just the VI's name. That should probably be considered a bug.

I also think this does not work for unsaved typedefs.

It throws an error 1061 when I give it an unsaved control's name.


___________________
Try to take over the world!
0 Kudos
Message 3 of 6
(4,163 Views)

You may also be able to do it by using the New VI Object primitive.  Wire the reference of your newly created subVI or typedef to the vi object class input.  The down side of this is you have to find the right style, and that can be a chore.  I have not tried this for this particular instance, but have done similar things in the past.

0 Kudos
Message 4 of 6
(4,163 Views)

Doesn't seem to work for me, even when I do select a style that matches (which in general I can't).

Can't say that I see why it would work, either. My understanding of the input is that it is only used for type propogation for the output.


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(4,163 Views)

Any chance that you guys found a solution here?

I am running into the same situation

0 Kudos
Message 6 of 6
(2,711 Views)