Chapter 21: VBA for CAD Managers
VBA is not just for programmers and not just for MicroStation users . it is a powerful tool for CAD Managers as well.
Using VBA for Maintaining Standards
Because standards differ from company to company, VBA can be an important part of customizing and maintaining standards for your individual company. Let's talk about some ways to use VBA to review DGN files and report problems.
Note | For more information on maintaining standards, look at the Standards Checker Interface which provides powerful functionality with built-in reporting capabilities. |
The first thing to create is a procedure that looks for unsupported levels.
Sub <b class="bold">FindUnsupportedLevels</b>() Dim GoodLevels(0 To 4) As String Dim GoodLevelsJ As String Dim myLevel As Level GoodLevels(0) = "ROADWAY" GoodLevels(1) = "SIDEWALK" GoodLevels(2) = "PAINT" GoodLevels(3) = "ELECTRIC" GoodLevels(4) = "GAS" GoodLevelsJ = UCase("~" & Join(GoodLevels, "~") & "~") For Each myLevel In ActiveDesignFile.Levels If InStr(1, GoodLevelsJ, "~" & UCase(myLevel.Name) & "~") = 0 Then Debug.Print "Unsupported Level Found: " & myLevel.Name End If NextEnd Sub
Five supported levels are specified. Join the array of level names separated by tilde characters (~). Then look in the joined...