Updating the attribute(s) of an inserted block, using .NET COM InterOp throw an exception

Using .NET COM InterOp I am looking to update all predefined attributes (or specific one) of an inserted block which is accomplished through code as well with out any error.

But below code block fails when accessing the name property of the block object - block.Name



if I remove this line - if (block.Name != "UDTblk.dwg") ,
it does fail in line - block.GetAttibutes()



This functionality I am looking to achieved can be easily done with the managed in-process .NET API, but will require specific license.

Any help or suggestion, work around, or better approach to update an attribute of block is really appreciated. Thanks in advance.



Comments

  • Maybe start with ent.ObjectName, or typeof(ent) to see what you’re actually getting
  • Just a side tip :
    Block names, Attribute Tags, and similar entries in Tables and Dctionaries are *always* case-insensitive, by ARX/DWG fundamental laws :-)
    So always compare such "key" names in case-insensitive way :-)
    many greetings !
  • Updating my Bricscad version to 23.2.06 solve this problem.