指定颜色索引。 支持的平台:仅窗口 属性值只读:不 类型:枚举acColor 默认颜色指定为。使用介于 0 到 256 之间的颜色索引号,或此处列出的常量之一:acByLayer
言论没有额外的评论。 例子工 务 局: Sub Example_ColorIndex()
'This example draws a circle and
'returns the closest color index.
Dim col As AcadAcCmColor
Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor." & Left(AcadApplication.Version, 2))
col.SetRGB 125, 175, 235
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
If col.ColorMethod = AutoCAD.acColorMethodByRGB Then
MsgBox "Closest ColorIndex=" & col.ColorIndex
End If
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_ColorIndex()
;;This example draws a circle and
;;returns the closest color index.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq col (vlax-create-object (strcat "AutoCAD.AcCmColor." (substr (getvar "ACADVER") 1 2))))
(vla-SetRGB col 125 175 235)
(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))
(if (= (vla-get-ColorMethod col) acColorMethodByRGB)
(alert (strcat "Closest ColorIndex=" (itoa (vla-get-ColorIndex col))))
)
(vlax-release-object col)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 11:54
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.