jeffwass Posted January 7, 2005 Report Share Posted January 7, 2005 Is there a decent way to get a refnum to a stricty-typed VI, in order to call it by reference? Specifically, can one do this dynamically? The only way I know how to do this now is to create a constant at the "type specifier VI refnum" node on the Open VI Reference function, and then browsing to select the proper VI Server class. Doing this in itself isn't so bad, but everytime I change my data formats, which will invariably happen as I'm in the development stage, the VI's all break and I have to go through and do this again manually, on each call-by-reference. And it quickly becomes a real pain. NI's documentation on this subject is ridiculously terse. I'm surprised that strictly-typedef'd clusters can propogate their changes to all subVI's, but the type specifier VI refnum doesn't, even when the file itself didn't change, just the datatype into one of the terminals. I'm doing things like sending a strictly-typedef'd cluster into the call-by-reference node, and if I later add an element and redefine the cluster, every call-by-refernce point has to be updated. This method in itself seems pretty braindead to me, and I imagine NI would have a better way to do this, I just can't find out how. I've considered using variants instead of the cluster, but I'm reluctant to use them because I fear they'll more processing to get the variant to the proper type. Actually, I'm going to start another topic on the subject of variants to address these concerns. Quote Link to comment
Albert-Jan Brouwer Posted January 7, 2005 Report Share Posted January 7, 2005 Is there a decent way to get a refnum to a stricty-typed VI, in order to call it by reference? Specifically, can one do this dynamically?The only way I know how to do this now is to create a constant at the "type specifier VI refnum" node on the Open VI Reference function, and then browsing to select the proper VI Server class. Doing this in itself isn't so bad, but everytime I change my data formats, which will invariably happen as I'm in the development stage, the VI's all break and I have to go through and do this again manually, on each call-by-reference. What you can do is take a VI refnum control that holds the connector pane layout, and save it as a strict typedef. Then, every time you open a VI reference to a VI with that layout you can wire a diagram constant that is linked to that typedef. When the pane changes, you will only need to update that one typedef. If the pane itself contains typedeffed inputs or outputs, some caution is in order: there is some weirdness to LabVIEW's handling of nested typedefs. I think it is because the changes are not propagated recursively. The best way I've found to avoid breakage is to hold all dependent VIs in memory and selecting "save all" a few times in succession (until nothing more is saved). Albert-Jan Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.