How to update block definition of a selected object?

I’m trying to select a block and refresh it.

Found it, using RefreshLinkedBlock method from the active InstanceDefinitionTable:

import rhinoscriptsyntax as rs
import Rhino

def BlockUpdate():
    object_ids = rs.GetObjects(preselect=True)
    for id in object_ids:
        block_instance = Rhino.RhinoDoc.ActiveDoc.Objects.Find(id)
        block_definition = block_instance.InstanceDefinition
        Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.RefreshLinkedBlock(block_definition)

BlockUpdate()
1 Like