LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use in enums in multiple places?

OK,

Thanks for the help, especially for the step-by-step procedure.

I am now a happy camper.

I will check out the tutorials...
0 Kudos
Message 11 of 14
(1,046 Views)

You're welcome.

I had to refer to my LV Intermediate book to remember how to do that.  It was one of those "Wow, cool" things I learned in that course.

I had the same problem when I was writing my first program with a state machine.  Everytime I added a case to the machine, I had to edit numerous enums.  And I was just using some numbers in my case structure rather than descriptive item names.  Learning this technique saved a lot of time and headaches.

0 Kudos
Message 12 of 14
(1,043 Views)

I had a quick question about this topic too. I started off making a state machine vi to control a test for me, then decided I wanted two tests which acted slightly differently. I duplicated the vi of the first test, but found that whenever I changed the names of states within the new copy (through Open Type Def/Edit), they would affect the names of states in the first and vice versa. I then created two separate .ctl's, but ended up having to go through the entire second diagram, changing the Constant "Enum Constant"s to Controls, then going to the Front Panel, right-clicking on the control, and clicking Replace/Select Control/NewStates.ctl, then setting it back to a constant on the block diagram.


(Note, as a side effect, the names of the states disappeared from the Case Selector box and were replaced with 0,1,2,3... until I'd replaced every Enum Constant with it's new version)

 

Is there a faster or easier way to do this?

0 Kudos
Message 13 of 14
(1,032 Views)


@ChrisC_ wrote:

Is there a faster or easier way to do this?


Two options:

  • Right clicking the constant, selecting Replace, selecting the VI from file option and selecting the ctl file.
  • Make sure only the second VI is open, open the typedef and do a save as on the typedef. This will cause all instances currently in memory to be linked to the new typedef and you have to save all the VIs calling the typedef. From that point on, VI1 will still be calling TD1 and VI2 (and its VIs) will be calling TD2.


(Note, as a side effect, the names of the states disappeared from the Case Selector box and were replaced with 0,1,2,3... until I'd replaced every Enum Constant with it's new version)

I'm not sure how that happened (unless you had less items in the new enum).

 



___________________
Try to take over the world!
0 Kudos
Message 14 of 14
(1,025 Views)