You are currently reviewing an older revision of this page.
Background Information
Text can be linked to properties of elements and are referred to as text fields (fields). These texts differ from properties of normal texts because they also have attached the attributes as dependency links (dependency linkages).
Steps
If you want to specifically look for these text boxes and choose one, you may find it difficult because they usually are hard to distinguish between normal and text fields. You can recognize these fields by additional attribute that are attached, as in this example. You can get additional information with the Keyin "Analyze element" which displays the following:
The important thing is circled in red, "Application ID: 9993", which serves as a tool to recognize specific data. You can search for this if you include a function such as MDL mdlDependency_getLinkage.
Here is an example of how to use this feature and select all text boxes:
Type root
data(1024)
As
Byte
elemid(128)
far_elemid(64)
e_v(64)
far_e_v(42)
assoc(25)
a_i(21)
assoc1_i(42)
elemidInModel(64)
path_v(128)
End
Type
Type DependencyLinkage
appID
Integer
appValue
flags
Long
nRoots
toFill
rootele
root
Declare
Function
mdlDependency_getLinkage
Lib
"stdmdlbltin.dll"
(
ByVal
pLinkage
,
maxSize
pEl
)
Sub
fields_find()
Dim
Ee
ElementEnumerator
EeSub
Sc
New
ElementScanCriteria
oT
TextElement
Db()
DataBlock
l()
String
sum
Stat
lElementP
Dep
DependencyLinkage
ActiveModelReference.UnselectAllElements
Sc.ExcludeAllTypes
Sc.IncludeType msdElementTypeTextNode
Set
Ee = ActiveModelReference.Scan(Sc)
Do
While
Ee.MoveNext
EeSub = Ee.Current.AsTextNodeElement.GetSubElements
EeSub.MoveNext
oT = EeSub.Current
lElementP = modElementAccess.GetMSElementFromElement(oT)
Stat = mdlDependency_getLinkage(VarPtr(Dep), 1024, lElementP, 9993, 0)
If
Stat = 0
Then
ActiveModelReference.SelectElement Ee.Current
Loop
The fields_find routine first searches for all text nodes, because fields are automatically linked to text nodes, even if only one text element is included.
It is then checked whether a dependency exists linking to an item that was written with the Application ID 9993.
Important note about the above code sample:
The modElementAccess.GetMSElementFromElement function from the Project Native Code Utilities is used. This requires the project to be referenced and the function to be defined.
This can be done by going to References under Tools in the VBA Editor, and "Select" or "Browse" to load it into the MicroStation project as shown below:
You can find the project in the workspace under ..\Workspace\system\VBA\examples