Preview Colour Change

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

[codesyntax lang=”python”]

######################################################################################################
# Change the preview colour of all selected objects
#
# - masssetpreviewcolor.py
# - By Mark Caldwell
# - Version 0.1.0
# - 2th March 2008
# - Copyright Mark Caldwell 2008
# - Tested with Vue 6.6 Infinite on a PC
#
# How to use in 3 easy steps
#
# 1. Download and unzip this file onto your computer
#
# 2. Select Objects
#
# 3. Run python script and select the number for the preview colour to change to
#
######################################################################################################

def TestPreviewColourVal (messagetxt,titletxt,default):
hit=-2
val=-1

while hit<0:
try:
if int(val) in range (0,8):
hit=1;
elif hit==-2:
val=Prompt (messagetxt,default,true,titletxt)
hit=-1
else:
val=Prompt ("Error: Value must be a whole number between 0 and 8\n\n"+messagetxt,val,true,titletxt)
except:
hit=-1
val=Prompt ("Error: Value must be a whole number between 0 and 8\n\n"+messagetxt,val,true,titletxt)

return val

count=CountSelectedObjects() # Count the number of objects selected

object=GetSelectedObjectByIndex(0)
print object.PreviewColor()

#----------------------------------------------
# Configuration: Get User Input
#----------------------------------------------

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')

if count>0: # Check there are selected objects to do something to

for i in range(0,count): # Loop through the selected objects
object=GetSelectedObjectByIndex(i) # Get the object
object.SetPreviewColor(int(preview_colour))

Refresh() # Refresh the display to show the effect of script running

[/codesyntax]

impworks © Copyright Mark Caldwell 1996 - 2024