NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I programatically copy/rename a custom step type

Solved!
Go to solution

Hello!

 

I have been working on a way to programatically go through a type palette.ini file and copy/rename each step type.  Unfortunately I can't seem to get it to work quite right and I was hoping to get pointed in the right direction on this one.  In case it's helpful I am using labview to interface with the TestStand API....  

 

I appreciate the help!

Thanks

Matt

0 Kudos
Message 1 of 5
(3,394 Views)
Solution
Accepted by topic author MattViewX.007
Call the following APIs:

 

1) myCopyOfAStepType = myStepTypeToCopyReference.AsPropertyObject.Clone("",  PropOption_DoNotShareProperties | PropOption_CopyAllFlags)

2) myCopyOfAStepType.Name = "NewName"

3) myDestinationTypePaletteFile.TypeUsageList.AddUsedTypes(myCopyOfAStepType)

4) myDestinationTypePaletteFile.TypeUsageList.InsertType(myCopyOfAStepType, 0, TypeCategory_StepTypes)

5) myDestinationTypePaletteFile.TypeUsageList.SetIsTypeAttachedToFile(0, true)

6) myDestinationTypePaletteFile.IncChangeCount()

 

NOTE: In case you are not familiar with C syntax, "PropOption_DoNotShareProperties | PropOption_CopyAllFlags" means bitwise-OR these two constants together.

 

Hope this helps,

-Doug

Message 2 of 5
(3,381 Views)

 I think I am very close... but not quite there... I attached the section of my code completing this task.  Please let me know if you see anything missing/incorrect.

 

Thanks 

Matt

 

PS excuse my "proof of concept" coding....

Message Edited by MattViewX.007 on 06-22-2009 04:23 PM
0 Kudos
Message 3 of 5
(3,372 Views)

What exactly is the problem you are having with your code? Do you get an error? Does it just not work?

 

-Doug

0 Kudos
Message 4 of 5
(3,339 Views)

One thing that looks wrong is that it looks like you are passing the flags to Clone as a decimal number rather than a hex number. The numbers show in the documentation are in hex. If you want to create a decimal constant from them you will need to convert the values. However, an even better way to specify that parameter would be to use the constants under the teststand menu in labview. Create an instance of the TestStand API Numeric Constants node for each of the two constants, select the constants you require, and use the bitwise-OR node to OR the two values together.

 

Hope this helps,

-Doug

0 Kudos
Message 5 of 5
(3,336 Views)