You are currently reviewing an older revision of this page.
There are several ways to provide additional information about elements in a drawing. They are used most commonly for retrieving attribute data, creating functions, and attaching and evaluating. However, this data has drawbacks because the attribute data itself are also elements like texts, and they are linked to the basic elements of links.
These links can be seperate even during the conversion. For example, the DWG format can be lost because it only supports attribute data in cells (in DWG blocks). There is also the possibility of data linking directly with elements. The advantage here is the close link with the element itself. These linkages are not seperate elements, and must be maintained in the DWG format. This must be selected when saving to a DWG file in the options so that the application data is retained.
Here is a simple example that depends on the active model found in lines as a text attribute.
' Example using VBA to help attach strings as attributes to elements:
' only example from Help
ele.AddUserAttributeData myID, dblk
Ee = ActiveModelReference.GraphicalElementCache.Scan
Ee.Current.Type = msdElementTypeLine
"This is an example text"
Now, when this routine is started Attribute_Append, all the elements of the active model are first selected and checked to see whether it is a line in each case.
If there is a line, then the text "This is an example text" is attached as a custom attribute on the line.
After passing thrgouh the routine, this can be checked by using the Keying command "Analyze element", which starts the old analyze tool and selects a line. Under the tab "Attributes", the data will be displayed as shown in the example below:
Although the data is stored in binary form, the text can be seen from the text display. With the new element information tool, this data is also displayed, but only binary and not text mode.
It also immediately raises the question of how one can read such data again. The following is a small example which checks each line for the presence of this data and then outputs:
Db = Ee.Current.GetUserAttributeData(myID)
UBound(Db) >= 0
Len(sText) > 0
Debug.Print sText, Ee.Current.AsLineElement.startPoint.x, Ee.Current.AsLineElement.startPoint.y
The output is shown below. It shows the found text and the xy coordinates of the starting point of the line.