I read in a object and it has a type number. I want to color that object according to that type number.
First, I created a few colors :
mr1508=model.materials.add mr1508.color='red' mr7911372=model.materials.add mr7911372.color="yellow"
When I read in a type number = “1508”, I want to use color mr1508.
mygroup.material = mr
An error comes up saying Cannot find material named mr1508. I think though mr=“mr1508”, but it is not a material. I don’t want use array to reference color here, because my type number is sparse. Neither i want IF statement, too slow.
How do I do this?
Thanks in advance.