Hello hello,

I am using ghPython and Rhino common to get the xform location of an instance object and the layer indicies of its sub-objects.

I am coming across an error stating that 'This object cannot be modified because it is controlled by a document.' I am not trying to modifty the object just get the layerIndex attribute.

Here is a section of the code, my rhino file consists of several blocks, each with several mesh objects inside.

Code:
instanceTable = Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.GetList(True)

for instance in instanceTable:
    print instance.Name
    instRef = instance.GetReferences(0)
    print str(len(instCopy)) + ' number of instances'
    for ref in instRef:
        print ref
        refXform = ref.InstanceXform
        refAttr = ref.Attributes.LayerIndex
        refCount = ref.MeshCount(Rhino.Geometry.MeshType.Any,None)
        print str(refCount) + ' number of meshes in instance'
        refSubObj = ref.GetSubObjects()
        for s in refSubObj:
            print s.Attributes.LayerIndex
Any help from the forum is greatly appreciated!

iv