How to access file name for material color in Python script

I have a mesh with a .jpg image as a material. The name of the .jpg file shows in the Materials tab:

When Rhino exports this mesh, the reference to the .jpg file is included in the .MTL file:

How can I access the .jpg file name using a Python script? I looked over the Rhinocommon API but could not find where this name is kept.


Hi Terry- looks like:

may be a start. You’d need to get acces to the material via material index I guess.



Thanks for the references. I got this to work:

from scriptcontext import doc
from Rhino import DocObjects
mats = doc.Materials
for i in range(len(mats)):
	fileNames = set([text.FileName for text in DocObjects.Material.GetTextures(mats[i])])
	for fileName in fileNames: print 'Filename = ', fileName

which gave:

Filename = E:\MediumModel1p4MFaces16384x1Texure.jpg

Thanks for the quick help.