LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting Crash- "Create from Data Type" on Typedef Enum

I just encountered a crash that I can duplicate in both LabVIEW 2013 and 2012 (student).

 

Attached is a project that contains the code I used on 2012. Run the target VI.

(I can get the project I had in 2013, if needed, sometime next week)

 

Basic steps:

  1. Create a type def enum
  2. Place it on a VI
  3. Use scripting to get ahold of the Control Terminal and get the data type
  4. "Create from Data Type"
Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 1 of 6
(4,002 Views)

Haha, I saved your code and ran it while I still had another project open... didn't really think that one through. Thank you, Auto-save.

 

 

So it looks like the crash happens at the Create node. I can get rid of the crash by removing the Type Def link from the enum.

 

I'm not at all an expert in scripting and have only used it a few times. Could a workaround be to get a reference to all of the Controls on the FP and copy the Control with the same Label "Enum" (instead of loading the terminal and creaing a new terminal)? Maybe creating a typedef by data type is what's causing the crash, but copying an already existing control will work.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 6
(3,995 Views)

Name doesn't matter (tried "Numeric")

Actual control type doesn't matter (Tried numeric and cluster or random things)

Stored the typedef into an indicator, changed that indicator to a constant, piped that constant into the "Create from Data Type". Crash. It's not the way I gathered it.

 

Apparently it doesn't like TypeDefs

Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 3 of 6
(3,969 Views)

Still crashes in the latest LabVIEW version.  

 

I couldn't find any CARs about this behavior but I can file one tomorrow if now one is able to find any documentation that says this is expected behavior.  If anything, it would be nice to have documentation in the help file telling people it won't work with type defs.

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 6
(3,964 Views)

For people who run into this crash, here is my work-around.

 

Use the Terminal invoke method "Create Constant"
This this sometimes creates a wire between the constant and the terminal. Delete/recreate that wire, or delete a node and cleanup.

 

(I would have created from the TypeDef path via GetTypedefPath.vi, but that VI didn't return the path when I input the Data Type variant)

Josh
Software is never really finished, it's just an acceptable level of broken
Message 5 of 6
(3,908 Views)

JW-JnJ,


I filed CAR #534812 to describe this behavior.

 

An alternative workaround I found was to use the DisconnectFromTypedef.vi in the vi.lib folder.  This also holds the ContainsTypedef.vi to check if the variant is from a type definition.

Matt J | National Instruments | CLA
Message 6 of 6
(3,890 Views)