SOLVED Selection associated with a texture tag

Hi,

I have another problem that looks a bit like my previous post.
Now for each tag (type 5616), I want to know the name of the associated selection, if it exists.
Could you put the correct code in place of the dotted lines

alt text

	tag = obj.GetFirstTag()
	while tag:
		if tag.GetType() == 5616: #texture tag
			
			#name of tag
			print tag.GetMaterial().GetName()
		
			#name of the associated selection, if it exists 
			...
			...
			...			

		tag = tag.GetNext()

just as a tip, you seem to miss a basic technique to find out parameters.
Open the Python console. Select the label of the desired parameter in the attribute manager. Drag the label into the console. The colsole will react by showing you the parameter access, e.g.:

Material[c4d.TEXTURETAG_RESTRICTION]
'MySel'

Press Return to get the current value, which in this case is MySel.
You can now use the square bracket notation on your object (texture tag).

Thank you.
I had forgotten about this excellent feature of C4D.
It must be said that I rarely do plugins, because now C4D can do a lot of things.

Hi @Kantronin, I don't have a lot to add Thanks @Cairyn , for more information about the console, please read Python Console.

Cheers,
Maxime.