@tig said:
mat=e2.material
> if mat
> cname=mat.name ### OR .display_name ?
> else ### NO MATERIAL
> cname="<Default>"
> end#if
test for the existence of the material and then get it's name if it exists, if the material is ' nil'then there's no ' name' to get.
#display_name should only be used to output the name of a material to the UI - not as an id.
http://www.thomthom.net/thoughts/2012/03/the-secrets-of-sketchups-materials/#speaking-of-names8230