04-03-2013 12:32 PM - edited 04-03-2013 12:32 PM
A long shot but am asking if anyone has scripted a way to programmatically change all DBL type to SGL type within a VI (during development, not runtime).
Thanks,
Don
Solved! Go to Solution.
04-03-2013 12:35 PM - edited 04-03-2013 12:39 PM
Actually, I have. Now to see if I can find it again...
What do you know, I still have them! These were part of code I wrote to create polymorphic VIs where the only changes were the data types (real pain to do by hand). Anyways, there is a VI to change the controls and another to change the constants. They currently look for Doubles and will change to whatever you tell them.
04-29-2013 08:45 AM - edited 04-29-2013 08:45 AM
I just checked back. After your initial post, I never received notification that you had edited the post and added the VIs. So I never checked back until now. This is pretty impressive. This will really save me some time.
Thanks again,
Don
04-30-2013 09:45 AM
I found a few caveats to using these VIs.
1) It seems the front panel of the VI that contains the controls must be open.
2) TypeDef digital controls in the VIs will cause an error.
Don
04-30-2013 10:52 AM
@DonRoth wrote:
I found a few caveats to using these VIs.
1) It seems the front panel of the VI that contains the controls must be open.
2) TypeDef digital controls in the VIs will cause an error.
1) I don't remembering seeing that issue. I might have to play to around with the code a little now.
2) Does not surprise me one bit. Like I said before, these were for creating polymorphic VIs where the only difference in the VIs were the data type. They worked very well for that purpose.
04-30-2013 11:09 AM - edited 04-30-2013 11:10 AM
Ah. I think I might know your issue 1. I didn't give you my full suite that open the VI and save a copy. How are you opening the VI to get its reference? I am using the file path. If you are using just the file name, then the VI will have to be opened in order to work.
04-30-2013 11:15 AM - edited 04-30-2013 11:16 AM
Here is what I am doing, just a slight modification of your code:
Same thing for the constants.
I wrote a program to do this for entire folder just running through a loop. It is weird, as it seems only to work on one at a time and not in this batch mode. I clear errors so not sure why yet.
04-30-2013 11:32 AM
Hmmm...I'm a little surprised you need to have the front panel open. Mine doesn't. Are you getting any errors out of this VI other than trying to change the type def controls?
04-30-2013 11:47 AM
Upon further testing, what I just found out is really interesting. I have to keep the front panel open (the last FP.Open has to have T constant attached) or the code I just posted as screenshot will not work. No errors were output. This is probably why it did not work on the batch process as I was closing each VI as shown in the code. I wonder if there is a delay / timing issue that needs to be considered.
You can try it on the test1.vi I am attaching.
Don
04-30-2013 02:16 PM
Works fine for me without opening the front panel. Are you saving the VI after your changes?