GenerateLayer Example

AEC Auto

GenerateLayerExample

Sub Example_GenerateLayer()
    
    'This example shows how to generate a layer with the current layer standard

    Dim doc As AecArchBaseDocument
    Dim dbPref As AecArchBaseDatabasePreferences
    Dim cLayerKeyStyles As AecLayerKeyStyles
    Dim layerKeyStyle As AecLayerKeyStyle
    Dim cLayerKeys As AecLayerKeys
    Dim layerKey As AecLayerKey
    
    Set doc = AecArchBaseApplication.ActiveDocument
    Set cLayerKeyStyles = doc.LayerKeyStyles
    Set dbPref = doc.Preferences
    ' Sets the layer key style to the current layer standard
    Set layerKeyStyle = cLayerKeyStyles.Item(dbPref.LayerStandard)
    
    Dim layer As AcadLayer
    Set layer = layerKeyStyle.GenerateLayer("WALL") MsgBox "Layer Key WALL generated layer: " & layer.Name_ 
        vbInformation, "Expand Example"  

             
End Sub