The python toollist object facilities easy switching of toolbox. # product type is stored in text register T0
# product defined to 'A' if undefined in Central Start
#CENTRAL_SCRIPT=Central Start; SOURCE=Central; ACTIVE=1; TYPE=0
oldProduct = GetValue('Register.T0')
if oldProduct == "":
SetValue('Register.T0','A')
#SaveToolbox performs toolbox switching by saving current toolbox and loading new toolbox
#CENTRAL_SCRIPT=SaveToolbox; SOURCE=Script; ACTIVE=1; TYPE=1
def SaveToolbox(newProduct):
GetToolList().save('toolbox.spb',GetValue('Register.T0')) # store
SetValue('Register.T0',newProduct)
GetToolList().load('toolbox.spb',GetValue('Register.T0'))
Example : Toolbox Switch
SaveToolbox('B') # sets current toolbox for product "B"
|