Background Information
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.
Steps
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:
Sub LineLength0Delete() 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: Sc.ExcludeAllTypes Sc.IncludeType msdElementTypeLine Set Ee = ActiveModelReference.Scan(Sc) Number = 0 Do While Ee.MoveNext With Ee.Current.AsLineElement ' If the line length is 0 it will be deleted If Ee.Current.AsLineElement.Length = 0 Then ActiveModelReference.RemoveElement Ee.Current Number = Number + 1 End If End With Loop MessageCenter.AddMessage "There were " + str(Anzahl) + " lines with a length of 0 deleted", , msdMessageCenterPriorityInfo End Sub
The result will be the number of deleted items displayed in the message center.
See Also
Searching and Evaluating Data in a drawing with VBA: Part 2 - Reading properties of Elements