Questions similar to this appear on the MicroStation Programming Forum. These problems appeared in the VBA discussion group.
This post answers the question: "How do I perform an arithmetic computation of the values displayed in a set of numbers?"
To answer that question, we must first define what we mean by numbers.
MicroStation stores geometric data in various types of element,
such as line-strings and circles.
MicroStation has a text element (a VBA TextElement
), but it doesn't
have a number element.
If you see numbers in a MicroStation DGN model, they are either dimension elements, tag elements or text elements.
Other topics about Text Elements include Text Element Analysis with VBA.
If you're interested in programming Text Styles with VBA, there's a separate page.
Q How do I get the sum of a set of numeric TextElements ?
A First, you need to identify a set of text elements. The MicroStation idioms for that task are either a selection set or a fence. Once you've identified the set of interesting text, you need to run some code that analyses them.
AddNumbers.mvba
is a complete, working, VBA project.
It performs the task described above.
If you want to add a set of numbers stored in MicroStation text elements …
\Workspace\Standards\vba
vba run [AddNumbers]modMain.Main
You can download the VBA AddNumbers Project as a ZIP archive.
Unpack the ZIP archive and extract AddNumbers.mvba
to a suitable location, such as
\Workspace\Standards\vba
.