SetLine

From Microstation VBA Wiki
Revision as of 15:05, 17 August 2010 by Ted (talk | contribs) (Created page with 'This subroutine takes a string which represents some kind of line type defined by the programmer and and changes the Microstation settings so that the next time a line is placed …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This subroutine takes a string which represents some kind of line type defined by the programmer and and changes the Microstation settings so that the next time a line is placed it will be the correct color, line weight, line type, and on the correct level. Some of this is explained in lines.


Private Sub SetLine(strType As String)

Dim oLevel As Level
Dim oLineStyle As LineStyle

Select Case strType
    Case "Concrete"
        Set oLevel = ActiveDesignFile.Levels.Find("Level 2")
        Set ActiveSettings.Level = oLevel
        ActiveSettings.LineWeight = 4
        Set oLineStyle = ActiveDesignFile.LineStyles.Find("0")
        Set ActiveSettings.LineStyle = oLineStyle
        ActiveSettings.Color = 0 'White
        
    Case "Center"
        Set oLevel = ActiveDesignFile.Levels.Find("Level 5")
        Set ActiveSettings.Level = oLevel
        ActiveSettings.LineWeight = 1
        Set oLineStyle = ActiveDesignFile.LineStyles.Find("6")
        Set ActiveSettings.LineStyle = oLineStyle
        ActiveSettings.Color = 2 'Lime
        
    Case "Dimension"
        Set oLevel = ActiveDesignFile.Levels.Find("Level 7")
        Set ActiveSettings.Level = oLevel
        ActiveSettings.LineWeight = 1
        Set oLineStyle = ActiveDesignFile.LineStyles.Find("0")
        Set ActiveSettings.LineStyle = oLineStyle
        ActiveSettings.Color = 3 'Red

    Case Else
        MsgBox "No such line type for " & strType

    End Select
End Sub