06-22-2009 10:37 AM
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
Solved! Go to Solution.
06-22-2009 12:13 PM
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
06-22-2009 04:21 PM - edited 06-22-2009 04:23 PM
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....
06-23-2009 10:36 AM
What exactly is the problem you are having with your code? Do you get an error? Does it just not work?
-Doug
06-23-2009 11:10 AM
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