Sometimes, drawings contain a large number of points. This may be caused by a variety of manipulations and initially might not bother us. When plotting, this may be due to the line widths suddenly becoming visible that should be removed from the drawing. Rather than finding and deleting these points by hand which can be very time-consuming, VBA can be used.
Points are represented in MicroStation by lines of longitude. To remove these lines, all lines are selected and searched for length. If the length is equal to 0, the line can be deleted. A possible implimentation of this in VBA might look something like this:
Dim Ee As ElementEnumerator
Dim Sc As New ElementScanCriteria
Dim Anzahl As Long ' Counter for deleted items
' Only lines of length 0 are to be tested:
Set Ee = ActiveModelReference.Scan(Sc)
Number = 0
Do While Ee.MoveNext
' If the line length is 0 it will be deleted
If Ee.Current.AsLineElement.Length = 0 Then
Number = Number + 1
MessageCenter.AddMessage "There were " + str(Anzahl) + " lines with a length of 0 deleted", , msdMessageCenterPriorityInfo
The result will be the number of deleted items displayed in the message center.
Searching and Evaluating Data in a drawing with VBA: Part 2 - Reading properties of Elements