BlockInstanceName as Dot

Hi all.

Have been working on a small tool which would tag any blocks in my file with their name as dot.

However, it seems to be only giving me the object Id and I am unsure why this is happening. it prints me the correct name within the python editor, but the dot is different.

import rhinoscriptsyntax as rs
strObject = rs.GetObject(“Select block”)
if rs.IsBlockInstance(strObject):
print rs.BlockInstanceName(strObject)
bb=rs.BoundingBox(strObject)
text=" {}".format(strObject)

dot=rs.AddTextDot(text,(bb[0]+bb[6])/2)

Some assistance would be amazing, please

Thank you

Hi Oliver - strObject is a GUID - you need to set the name to some variable or use it directly

strName = rs.BlockInstanceName(strObject)
text=" {}".format(strName)

or just

text=" {}".format( rs.BlockInstanceName(strObject))

-Pascal

Thank you, Pascal. Perfect.

Script is below if anyone else wants it

import rhinoscriptsyntax as rs
strObject = rs.GetObject(“Select block”)
if rs.IsBlockInstance(strObject):
print rs.BlockInstanceName(strObject)
bb=rs.BoundingBox(strObject)
text=" {}".format( rs.BlockInstanceName(strObject))

dot=rs.AddTextDot(text,(bb[0]+bb[6])/2)