material_color dictionary was added to map material tags to their corresponding colors, and matcolor[matTag-1] was replaced with material_color[matTag] to prevent the error. Additionally, the default color of black was added with a feedback message.
The existing code uses matcolor[matTag-1] to assign color but there will be an IndexError if matTag is greater than the length of matcolor.
For example, in the snippet below matTag is 101 which is greater than the length of matcolor. matcolor[100] will result in list index out of range error.
material_color
dictionary was added to map material tags to their corresponding colors, andmatcolor[matTag-1]
was replaced withmaterial_color[matTag]
to prevent the error. Additionally, the default color of black was added with a feedback message.The existing code uses
matcolor[matTag-1]
to assign color but there will be an IndexError if matTag is greater than the length of matcolor.For example, in the snippet below matTag is 101 which is greater than the length of matcolor.
matcolor[100]
will result in list index out of range error.