Learning to use RhinoCommon, I’m trying to use Rhino.RunTime.TextFields.BlockInstanceName(). Haven’t found a way to make it work. This is the simplest version of what I’m trying to get:
import Rhino
getCommand = Rhino.Input.Custom.GetObject()
getCommand.SetCommandPrompt("Select block instances")
getCommand.GeometryFilter = Rhino.DocObjects.ObjectType.InstanceReference
getCommand.SubObjectSelect = False
get_rc = getCommand.GetMultiple(1, 0)
if __name__ == "__main__":
if getCommand.CommandResult()==Rhino.Commands.Result.Success: # If user doesn't cancel command
for i in range(getCommand.ObjectCount):
obj = getCommand.Object(i).Object()
block_name = Rhino.Runtime.TextFields.BlockInstanceName(str(obj.Id))
print block_name
else:
print "No block instances selected."
Returns: “####”
RhinoCommon documentation says I should be using “BlockName” method instead, but I don’t see it in the module. Am I doing something wrong?