DynamicProperties emptied

DynamicProperties emptied

TONELLAL
Collaborator Collaborator
436 Views
2 Replies
Message 1 of 3

DynamicProperties emptied

TONELLAL
Collaborator
Collaborator

Hello,

I need to replace a dynamic block by its equivalent static block, transforming dynamic properties in attributes. My code is like :

 

Dyn_props = oBloc.GetDynamicBlockProperties

oBloc.ConvertToStaticBlock(NewName)

'... create one attribute for each property...

 

The problem is when I convert the block to static, all the properties values are lost ! The properties still exist, but they are all on "empty". If I debug on Dyn_props, I can see :

-before oBloc.ConvertToStaticBlock(NewName) : all the properties exist and have the right value in Dyn_props

-after I execute oBloc.ConvertToStaticBlock(NewName) : all the properties in Dyn_props still exist, but their value is Empty...

 

Any idea ?

0 Likes
437 Views
2 Replies
Replies (2)
Message 2 of 3

Balaji_Ram
Alumni
Alumni

Sorry, i do not understand your requirement.

 

A dynamic block when converted to a static block cannot still have its dynamic property values and they are no longer relevant.

 

Can you please explain why you would expect a valid value to still be there for the static block ?

 

Thanks

 

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 3

TONELLAL
Collaborator
Collaborator

A dynamic block has dynamic properties.

A static block has attributes.

What I need is to create a static block with attributes, each attribute corresponding a dynamic property.

 

When I convert a dynamic block in a static block, ok, it cannot have dynamic properties any more. So I create an object, named Dyn_props, to store dynamic properties before I convert the dynamic block. Once Dyn_props has a value, it is supposed to keep this value, even if the object which had the value doesn't exist anymore.

 

Example :

A=1

B=2

A = B    ---> the value of A is now 2

B = 3 ---> the value of A is always 2, it is not 3 !

 

So :

Dyn_props = oBloc.GetDynamicBlockProperties  ---> Dyn_props contains the dynamic properties from oBloc

oBloc.ConvertToStaticBlock(NewName)  ---> oBloc is now a static block, so it has no dynamic properties any more. But, before conversion, these dynamic properties have been stored in Dyn_props. Properties still exist in Dyn_props (I can see Description with its value, PropertyName with its value,etc and Value, but Value is now Empty.

0 Likes