changing visibilty is changing block name

changing visibilty is changing block name

kshitij_jadhav
Explorer Explorer
1,126 Views
4 Replies
Message 1 of 5

changing visibilty is changing block name

kshitij_jadhav
Explorer
Explorer

when i change visibilty one of the visibility is giving block reference name as "U99" when checking in debug mode. Are there any fix for this?

0 Likes
Accepted solutions (1)
1,127 Views
4 Replies
Replies (4)
Message 2 of 5

_gile
Consultant
Consultant
Accepted solution

Hi,

This is the way dynamic blocks work. As soon as you edit some dynamic properties of a dynamic block reference, AutoCAD creates a new anonymous block definition (BlockTableRecord).

You can retrieve the name of the original block definition via the DynamicBlockTableRecord property of a block reference.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 5

kshitij_jadhav
Explorer
Explorer

is there a workaround to avoid block name change

 

0 Likes
Message 4 of 5

Norman_Yuan
Mentor
Mentor

That is how dynamic block works. Workaround? If you really want to work around the block reference becoming anonymous block, then do not use dynamic block; or, only insert the block reference with its original dynamic properties and do not change them (then why use dynamic block at all?).  You may want to explain why you have such a unusual requirement.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5

ActivistInvestor
Mentor
Mentor

@kshitij_jadhav wrote:

is there a workaround to avoid block name change

 


The workaround is to fix your application's design so that it does not rely on the names of anonymous blocks.

 

An app or plugin should never rely on the names of anonymous blocks, for the reasons described above, and because an anonymous dynamic block reference can be copied any number of times. When that happens, all of the copies reference the same anonymous dynamic block. When one of the copies is modified, it will reference another new anonymous block having a different name, while the other unmodified copies will still reference the previous anonymous block.

 

Describe your need for depending on anonymous block names, and perhaps someone can suggest a way to resolve it, but there is no workaround that can prevent an anonymous dynamic block's name from changing when the user modifies its properties.

 

 

0 Likes