I have an object in scene,this object has a shading group,and a material connect to this shading group.
Now I want to get shape of this object from material,how can I do that?

Get shape from material?
zdsmdbh
#1
djx
#2
You did not specify which programming language, so I’ve gone for pymel. It simply does what you already did, which is to follow the connections. So in this example I have a material called “blinn1” assigned to my objects.
import pymel.core as pm
material = pm.PyNode('blinn1')
shadingGroups = material.shadingGroups()
objects = []
for sg in shadingGroups:
numDagSetMembers = sg.dagSetMembers.numElements()
for i in range(numDagSetMembers):
object = sg.dagSetMembers[i].connections()[0]
objects.append(object)
print objects
David