Get block authoring entities (parameters / actions)

Get block authoring entities (parameters / actions)

BestFriendCZ
Advocate Advocate
665 Views
4 Replies
Message 1 of 5

Get block authoring entities (parameters / actions)

BestFriendCZ
Advocate
Advocate

Hi all,


i would like to ask is there any way how to get these type of objects via .NET API.

I would like to remove all of them from old DWG files

 

Does anybody has experience with that?

 

info.png

 

 

...
0 Likes
Accepted solutions (1)
666 Views
4 Replies
Replies (4)
Message 2 of 5

norman.yuan
Mentor
Mentor
Accepted solution

Those are dynamic properties defined in block definition. When you say "remove all of them", do you mean to redefine the block definition, so that there is no more dynamic properties in that block definition any more? If so, yes, you can do it in Block Editor manually. Once you have done that, all corresponding block references to the block definition would also lose there dynamic properties. However, there is no API available to add/modify/remove dynamic properties from block definition available, so you cannot do it with code.

 

On the other hand, if your purpose is to change all the dynamic block references into static block reference, you can call BlockReference.ConvertToStaticBlock() to make them static. After all changed, you could choose to purge the dynamic block definition.

 

You could also simply define a new static block definition with code, and re-point all block references to the old block definition to the new block definition; then you can purge the old dynamic block definition. You then could even rename the new block to the old block name.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 5

BestFriendCZ
Advocate
Advocate

Hi Norman,

My goal is clear all these entities which are in picture from block definition.

I have many thousands of DWG which contain them. So, I would like to avoid manual work.

 

But if there is no API for that that it will be little complicated.

 

 

info.png

...
0 Likes
Message 4 of 5

norman.yuan
Mentor
Mentor

I am  not sure what do you mean by "clear all these entities" by showing the picture of Block Editor and my question is  why you need to do it that way. You could simply purge all the dynamic block definitions you want to clear, as long as you either convert all their block references to static blocks, or point them to another block definition.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 5 of 5

BestFriendCZ
Advocate
Advocate

Hi Norman,
i tested convert to static function and you are correct. This is exactly what i need it. Thank you for your advice

...
0 Likes