ActiveLayer Example |
Using Programming Languages other than VBA
Sub Example_ActiveLayer() ' This example returns the current layer ' and then adds a new layer. ' Finally, it returns the layer to the previous setting. Dim currLayer As AcadLayer Dim newLayer As AcadLayer ' Return the current layer of the active document Set currLayer = ThisDrawing.ActiveLayer MsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example" ' Create a Layer and make it the active layer Set newLayer = ThisDrawing.Layers.Add("TestLayer") ThisDrawing.ActiveLayer = newLayer MsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example" ' Reset the layer to its previous setting ThisDrawing.ActiveLayer = currLayer MsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example" End Sub
Comments? |