ColorName Property (ActiveX)

Specifies the name (if any) of the color.

Supported platforms: Windows only

Signature

VBA:

object.ColorName
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The color name.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ColorName()
    'This example draws a circle and
    'returns the color name and color book name of the color.

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    
    col.SetRGB 125, 175, 235
    col.SetNames "MyColor", "MyColorBook"
    
    Dim cir As AcadCircle
    Dim pt(0 To 2) As Double
    Set cir = ThisDrawing.modelSpace.AddCircle(pt, 2)
    cir.TrueColor = col
    ZoomAll
    
    Dim retCol As AcadAcCmColor
    Set retCol = cir.TrueColor
    MsgBox "BookName=" & col.BookName & vbLf & _
           "ColorName=" & col.ColorName
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColorName()
    ;; This example draws a circle and
    ;; returns the color name and color book name of the color.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 125 175 235)
    (vla-SetNames col "MyColor" "MyColorBook")
    
    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq cir (vla-AddCircle modelSpace pt 2))
    (vla-put-TrueColor cir col)
    (vla-ZoomAll acadObj)
    
    (setq retCol (vla-get-TrueColor cir))
    (alert (strcat "BookName=" (vla-get-BookName retCol)
                   "\nColorName=" (vla-get-ColorName retCol)))
  
    (vlax-release-object col)
)