Get parent InstanceDefinition for a block instance

Hi,

Given an object that I know is an instance, how do I get a reference to it’s parent block defnition in Rhinocommon?

Thanks,
Jim

Hi @JimCarruthers,

below gets the instance definition from an instance object:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
    
def DoSomething():
    id = rs.GetObject("select block", rs.filter.instance, True, False)
    if not id: return
    
    obj = rs.coercerhinoobject(id, True, True)
    print obj
    idef = obj.InstanceDefinition
    print idef
    
    print "Name:", idef.Name, " Inserts:", idef.GetReferences(1).Count
    
DoSomething()

does that help ?

c.

Pretty thoroughly, yes!