2004 Change Layer Color

Discussion in 'AutoCAD' started by Chris Picklesimer, Jul 9, 2003.

  1. In Acad 2000, I was able to change the color of a layer by the following:
    ThisDrawing.Layers(strMyLayer).Color = intMyColor

    In Acad2004, I see a TrueColor but not a Color property. I tried:
    ThisDrawing.Layers(strMyLayer).TrueColor = intMyColor , but got a type
    mismatch error. What am I missing?

    Thanks

    Chris
     
    Chris Picklesimer, Jul 9, 2003
    #1
  2. The TrueColor property expects an AcadAcCmColor object, not a numeric
    value:

    Public Sub test()

    Dim layer As AcadLayer, color As AcadAcCmColor

    Set color = New AcadAcCmColor
    With color
    .ColorMethod = acColorMethodByACI
    .ColorIndex = 25
    End With
    Set layer = ThisDrawing.Layers.Add("Test5")
    layer.TrueColor = color

    End Sub
     
    Frank Oquendo, Jul 9, 2003
    #2
  3. Chris Picklesimer

    Kevin Terry Guest

    You can still do this in 2004 - it just doesn't show you the color property
    in the intellisense popup.

    This works in 2004:
    Sub test()
    Dim strMyLayer As String
    Dim intMyColor As Integer

    strMyLayer = "Fitting"
    intMyColor = 6

    ThisDrawing.Layers(strMyLayer).color = intMyColor

    End Sub


    Kevin
     
    Kevin Terry, Jul 10, 2003
    #3
  4. Chris Picklesimer

    Kevin Terry Guest

    thanks Frank, I never saw that.

    Kevin

     
    Kevin Terry, Jul 10, 2003
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.