RodWing:
The link provided by Jon Summers shows how to use the Area property of closed element types. I believe what he was suggesting is that you could adapt this to select linear elements and use the Length property of linear element types to get the individual distances. It is then up to you, the programmer, to keep a running total.
Something like this:
Dim elLine As LineElement
Dim dLengthTotal As Double
dLengthTotal = 0
'... code here retrieves line an individual line element
dLengthTotal = dLengthTotal + elLine.Length
Rod
One more observation...
You displayed the Measure Distance -> Between Points tool settings. This tool is just measuring the straight line distance between two data points. If that's what you want you don't need to grab an element, just use the Point3dDistance function to get the distance between the two points.
I don't have access to MicroStation on the computer I'm at right now which means I can't show you directly, so I'll describe best I can what to look for.
- In the MicroStation VBA Help there is an example on how to create a Class to place a line element. Copy that code as directed in the help documentation into your app.
- In the copied code replace the CreateLineElement command line with:
dLengthTotal = dLengthTotal + Point3dDistance(pt(0), pt(1))
Note: Be sure to replace pt(0) and pt(1) with the point array variables used in the example. - Leave the CreateLineElement code Dynamics sub as-is. This will display a temporary line element as the user is selecting points.
- You many also want to add CommandState.EnableAccuSnap in the start sub so that AccuSnap is enabled
Rod