You can create new layers and assign color and linetype properties to those layers. Each individual layer is part of the Layers collection. Use the Add method to create a new layer and add it to the Layers collection.
You can assign a name to a layer when it is created. To change the name of a layer after it has been created, use the Name property. Layer names can include up to thirty-one characters and contain letters, digits, and the special characters dollar sign ($), hyphen (-), and underscore (_) but cannot include blank spaces.
For more information about creating layers, see â€śCreate and Name Layersâ€ť in the User's Guide.
The following code creates a circle and a new layer. The new layer is assigned the color red. The circle is assigned to the layer, and the color of the circle changes accordingly.
' Create a circle
Dim circleObj As AcadCircle
Dim center(0 To 2) As Double
Dim radius As Double
center(0) = 2: center(1) = 2: center(2) = 0
radius = 1
Set circleObj = ThisDrawing.ModelSpace. _
' Create a color object
Dim col As New AcadAcCmColor
col.ColorMethod = AutoCAD.acColorMethodForeground
' Set the layer to the color
Dim layColor As AcadAcCmColor
Set layColor =
Call layColor.SetRGB(122, 199, 25)
ThisDrawing.ActiveLayer.TrueColor = layColor
col.ColorMethod = AutoCAD.acColorMethodByLayer
' Assign the circle the color "ByLayer" so
' that the circle will automatically pick
' up the color of the layer on which it resides
circleObj.Color = acByLayer