Preview Colour Change

A little python script for Vue Infinite to change the preview colours of all selected objects in one go.

  1. ######################################################################################################
  2. # Change the preview colour of all selected objects
  3. #
  4. # - masssetpreviewcolor.py
  5. # - By Mark Caldwell
  6. # - Version 0.1.0
  7. # - 2th March 2008
  8. # - Copyright Mark Caldwell 2008
  9. # - Tested with Vue 6.6 Infinite on a PC
  10. #
  11. # How to use in 3 easy steps
  12. #
  13. # 1. Download and unzip this file onto your computer
  14. #
  15. # 2. Select Objects
  16. #
  17. # 3. Run python script and select the number for the preview colour to change to
  18. #
  19. ######################################################################################################
  20.  
  21. def TestPreviewColourVal (messagetxt,titletxt,default):
  22. hit=-2
  23. val=-1
  24.  
  25. while hit<0:
  26. try:
  27. if int(val) in range (0,8):
  28. hit=1;
  29. elif hit==-2:
  30. val=Prompt (messagetxt,default,true,titletxt)
  31. hit=-1
  32. else:
  33. val=Prompt ("Error: Value must be a whole number between 0 and 8\n\n"+messagetxt,val,true,titletxt)
  34. except:
  35. hit=-1
  36. val=Prompt ("Error: Value must be a whole number between 0 and 8\n\n"+messagetxt,val,true,titletxt)
  37.  
  38. return val
  39.  
  40. count=CountSelectedObjects() # Count the number of objects selected
  41.  
  42. object=GetSelectedObjectByIndex(0)
  43. print object.PreviewColor()
  44.  
  45. #----------------------------------------------
  46. # Configuration: Get User Input
  47. #----------------------------------------------
  48.  
  49. preview_colour=TestPreviewColourVal ('Enter Number for colour to use:\n0=Dark Grey\n1=Orange\n2=Green\n3=Blue\n4=Yellow\n5=Purple\n6=Cyan\n7=Pale Green\n8=Light Grey','Select Colour','0')
  50.  
  51. if count>0: # Check there are selected objects to do something to
  52.  
  53. for i in range(0,count): # Loop through the selected objects
  54. object=GetSelectedObjectByIndex(i) # Get the object
  55. object.SetPreviewColor(int(preview_colour))
  56.  
  57. Refresh() # Refresh the display to show the effect of script running

impworks © Copyright Mark Caldwell 1996 - 2017