请教高手vba怎样获取实体的颜色值
请教高手,vba怎样获得所选择实体的颜色值?sub getobjcolor()
Dim Obj As AcadObject
Dim basePoint As Variant
Dim iColor As Integer
ThisDrawing.Utility.GetEntity Obj, basePoint
iColor = Obj.color
end sub
'运行上面的代码其 icolor一直是256,请高手赐教,谢谢!
256表示随层,现在你要获取所在层的颜色即可。 '谢谢各位了,刚才自己测试通过了,共享一下
Sub ss()
Dim obj As AcadObject
Dim pnt As Variant
Dim Lay As AcadLayer
ThisDrawing.Utility.GetEntity obj, pnt
'MsgBox obj.Layer
If obj.color = 256 Then
Set Lay = ThisDrawing.Layers.Item(obj.Layer)
MsgBox Lay.color
Else
MsgBox obj.color
End If
End Sub
当时被颜色值256搞晕了,选择了好多地物的颜色值都是256,随层=256,随块大家可以自己写写了,
页:
[1]