idslk
Alibre Super User
Hello colleagues,
I've made a little script called "Colorize". Triggered from this Thread and the idea of @simonb65 .
Colorize-Script can set part-colors in an assembly or in a part.
It can not change feature colors (it's V0.1...)
It makes sense to Change the color properties of the part/assembly, otherwise you will get "funny" results (depends on the features of the part):
After setting the properties in the highest level of an assembly you can run the script.
First you should choose your color:
Then you have to confirm it with ok. The choose face window will appear.
Once the color is choosen you have to click on a face and click ok, next face and ok, next face and ok...until the color gets empty ;-)
If you want to change the color for the next faces, check the "Change color" box and press ok.
You will get the change color window.
Change to the new Color, press ok and the coloring starts again.
If your colored all you want, you can check the "End coloring" box, press ok and window will disappear.
Test it and have fun!
Regards
Stefan
PS.: i hope i get some comments ;-)
I've made a little script called "Colorize". Triggered from this Thread and the idea of @simonb65 .
Colorize-Script can set part-colors in an assembly or in a part.
It can not change feature colors (it's V0.1...)
It makes sense to Change the color properties of the part/assembly, otherwise you will get "funny" results (depends on the features of the part):
After setting the properties in the highest level of an assembly you can run the script.
First you should choose your color:
Then you have to confirm it with ok. The choose face window will appear.
Once the color is choosen you have to click on a face and click ok, next face and ok, next face and ok...until the color gets empty ;-)
If you want to change the color for the next faces, check the "Change color" box and press ok.
You will get the change color window.
Change to the new Color, press ok and the coloring starts again.
If your colored all you want, you can check the "End coloring" box, press ok and window will disappear.
Code:
#ScriptName = 'Colorize'
#Version = 0.1
#Date = 20190305
#Startdate = 20190305
#author = 'IDSLK'
#Infographic = None
Win = Windows()
WT = 'IDSLK '
ScriptName = 'Colorize'
#ColorList is for the StringListInput
Colorlist = ['Red','Green','Blue','Magenta','Yello','Gunmetal']
#ColorValues have to be set for each Item in ColorList / Format is [Red 0..255,Green 0..255,Blue 0..255]
ColorValues = [[255,0,0],[0,0,255],[0,255,0],[255,255,0],[255,0,255],[55,55,60]]
Colors = []
R=255
G=0
B=0
Loop=0
#Get Enviroment----------
try:
Enviroment = CurrentAssembly()
EnviromentText = 'Assembly ' + str(Enviroment)
except:
Enviroment = CurrentPart()
EnviromentText = 'Part, Name: ' + str(Enviroment)
#Define functions--------
def User_Window_Color():
global Options, Colors ,R,G,B
Options = []
Colors = []
Options.append(['Color', WindowsInputTypes.StringList, Colorlist])
Colors = Win.OptionsDialog(WT+ScriptName, Options, 155)
R = ColorValues[Colors[0]][0]
B = ColorValues[Colors[0]][1]
G = ColorValues[Colors[0]][2]
def User_Window():
global Options, Values
Options = []
Values = []
Options.append(['Face', WindowsInputTypes.Face, None])
Options.append(['End Coloring?', WindowsInputTypes.Boolean, False])
Options.append(['Change Color?', WindowsInputTypes.Boolean, False])
Values = Win.OptionsDialog(WT+ScriptName, Options, 155)
if Values == None:
print 'Canceled'
sys.exit()
#main--------------------
User_Window_Color()
while Loop == 0:
User_Window()
print Values[0]
if Values[0] <> None:
Dummy = Values[0].GetPart()
Dummy.SetColor(R,G,B)
if Values[2] == True:
User_Window_Color()
if Values[1] == True:
Loop=1
Regards
Stefan
PS.: i hope i get some comments ;-)