Dynamic Block Attributes
Dynamic Blocks in an AutoCAD file may contain parameters which can be modified to alter the behavior or appearance of an instance of the dynamic block.
Reading Dynamic Block Attributes
When the Read Dynamic Block Attributes option is enabled, the AutoCAD reader will attempt to read these attributes back, and represent them as normal attributes, or as a list attribute.
Note: These attributes will only be read if the Explode Blocks into Entities option is not selected.
When the Read Dynamic Block Attributes As List option is enabled, the dynamic attributes will be returned in a list attribute. Each attribute will have a name and value, which represents the dynamic block parameter name and value respectively. This option is enabled by default.
For example, if the dynamic block has a parameter called Distance with a value of 52. This will be represented in FME as:
autocad_dynattr_list{0}.name = Distance
autocad_dynattr_list{0}.value = 52
Writing Dynamic Block Attributes
When inserting entities using a dynamic block definition, you can provide a value for dynamic parameters defined in the block definition, such as length and visibility state. This is done by using the list representation of the dynamic block attributes, and providing the parameter name and value.
For example, if your dynamic block has a parameter called Visibility, and you want to set it to Callout, then you set the values as follows when inserting your entity.
autocad_dynattr_list{0}.name = Visibility
autocad_dynattr_list{0}.value = Callout
Note: May not work with every type of dynamic attribute.
Dynamic Attributes Write Order – DWG/DXF
When writing Dynamic Block Attributes, there may be some attributes that have an effect on other attributes. For example, when you have a Move Action that moves other attributes.
The AutoCAD writer will automatically try to determine an order in which to write the attributes, such that attributes that affect others are written first. For example, if you have a parameter A that also moves parameter B, then A is always written first.
A special case is when there is a “loop” in the parameters being affected. For example, when you have a parameter A that affects parameter B, but parameter B also affects parameter A, it cannot be reliably determined which parameter should be written first. In this case, the order is determined according to the following priorities:
- The number of parameters being affected, from most to least.
- The name of the parameter in alphabetical order.
Dynamic Attributes Write Order – RealDWG
When writing Dynamic Block Attributes, there may be some attributes that have an effect on other attributes (for example, when you have a Move Action that moves other attributes).
The RealDWG writer will write dynamic attributes in the order that they were created in the block definition. (that is, the same order seen when reading the dynamic attributes as a list).
As a result, there may be cases where the final value of a dynamic attribute ends up different from what is written. For example, if you have a parameter A that affects parameter B, and you write a value to B first, after writing parameter A, it would alter the value of parameter B.
Below are a few tips to help minimize the effects of this behavior:
- When creating the dynamic block definitions, create parameters that will affect other parameters first.
- Avoid creating parameters that affect each other simultaneously (that is, parameter A affects parameter B, and parameter B also affects parameter A.