Clearing Instance Definition


I am trying to delete an instance definition (not the block instance in the rhino doc, but the definition itself) in c#. I tried RhinoDoc.ActiveDoc.InstanceDefinitions.Clear(), which successfully purged all instance definitions. However, this clears everything in the document. How can I selectively clear an instance definition?


Hi @woojsung ,

There is InstanceDefinitionTable.Delete method overload which has parameter enabling deletion of all its instances and definition itself.

Let me know if I need to attach python example.

Hi @djordje ,

Thanks for the comment. If you can share the example, that would be much appreciated. Thanks,


Yes, of course:

blName = 'test block 2'

# a) get block definition obj
ignoreDeletedInstancDef = False
blDef = Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.Find(blName, ignoreDeletedInstancDef)

# b) delete all block instances and then block definition itself
blDef_inx = blDef.Index
deleteReferences = True  # this deletes all instances first
quiet = False

succ = Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.Delete(blDef_inx, deleteReferences, quiet)

@djordje ,

Thank you for the script! One more question: What is the difference between Delete and Clear?

Thanks much,


Hi @woojsung ,
I’ve never used InstanceDefinitions.Clear. Maybe someone else knows.

Hi @djordje ,

I see. Thank you for the tip, really appreciate it!


1 Like