LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dbl --> sgl programmatically (LabVIEW 2011)

Solved!
Go to solution

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

0 Kudos
Message 1 of 11
(4,129 Views)
Solution
Accepted by topic author DonRoth

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 2 of 11
(4,126 Views)

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

0 Kudos
Message 3 of 11
(4,061 Views)

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

0 Kudos
Message 4 of 11
(4,035 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(4,024 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 11
(4,016 Views)

Here is what I am doing, just a slight modification of your code:

 

Convert-controls.PNG

 

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.

0 Kudos
Message 7 of 11
(4,013 Views)

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?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 11
(4,007 Views)

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

Download All
0 Kudos
Message 9 of 11
(4,003 Views)

Works fine for me without opening the front panel.  Are you saving the VI after your changes?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 10 of 11
(3,985 Views)