CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2024 开发者帮助

ShadowDisplay 属性 (ActiveX)

2024-5-18 19:09| 发布者: admin| 查看: 79| 评论: 0|原作者: admin|来自: AutoCAD

ShadowDisplay 属性 (ActiveX)

指定对象的阴影显示属性。(已过时)

支持的平台:仅限 Windows

签名

VBA:

object.ShadowDisplay
对象

类型:ShadowDisplay

应用此属性的对象。

属性值

只读:

类型:枚举AcShadowDisplayType

  • acCastsAndReceivesShadows
  • acCastsShadows
  • acReceivesShadows
  • acIgnoreShadows

言论

没有其他评论。

例子

VBA:

Sub Example_ShadowDisplay()

    ' This example creates a cone in model space and changes its shadow display setting.

    Dim coneObj As Acad3DSolid
    Dim centerPoint(0 To 2) As Double
    Set coneObj = ThisDrawing.ModelSpace.AddCone(centerPoint, 5, 20)

    Dim shadowObj As IAcadShadowDisplay
    Dim EnableShadowDisplayStatus As Long
    Dim ShadowDisplay As AcShadowDisplayType
    Dim displaySettingDesc As String
    Set shadowObj = coneObj

    EnableShadowDisplayStatus = shadowObj.EnableShadowDisplay
    ShadowDisplay = shadowObj.ShadowDisplay

    displaySettingDesc = DescribeShadowDisplay(ShadowDisplay)
    If EnableShadowDisplayStatus = 1 Then
        MsgBox "Shadow display is currently enabled for this object." & vbCr & _
            "Current shadow display setting is: " & displaySettingDesc
    Else
        MsgBox "Shadow display is disabled for this object."
    End If

    shadowObj.ShadowDisplay = acCastsShadows
    displaySettingDesc = DescribeShadowDisplay(shadowObj.ShadowDisplay)
    MsgBox "New shadow display setting is: " & displaySettingDesc
End Sub

Private Function DescribeShadowDisplay(acShadow As AcShadowDisplayType) As String
    Select Case acShadow
        Case acCastsAndReceivesShadows:
            DescribeShadowDisplay = "cast and receive shadows."
        Case acCastsShadows:
            DescribeShadowDisplay = "cast shadows only."
        Case acReceivesShadows:
            DescribeShadowDisplay = "receive shadows only."
        Case acIgnoreShadows:
            DescribeShadowDisplay = "ignore shadows."
    End Select
End Function

可视化 LISP:

(vl-load-com)
(defun c:Example_ShadowDisplay()
    ;; This example creates a cone in model space and changes its shadow display setting.
    ;; AutoLISP cannot cast COM objects to different types, so you must change the Shadow Display
    ;; property via DXF code values.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq centerPoint (vlax-3d-point 0 0 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq coneObj (vla-AddCone modelSpace centerPoint 5 20))

    (setq ed (entget (vlax-vla-object->ename coneObj)))
    (setq shadowDisplay (assoc 284 ed))
    (if (= shadowDisplay nil)
        (setq shadowDisplay 0)
        (setq shadowDisplay (cdr shadowDisplay))
    )

    (setq displaySettingDesc (DescribeShadowDisplay ShadowDisplay))
  
    (alert (strcat "Shadow display is currently enabled for this object."
                   "\nCurrent shadow display setting is: " displaySettingDesc))

    ;; Before changing the value, you should validate the object is not a Line or some other
    ;; 2D object that does not support shadows.
    (setq newShadowDisplay acCastsShadows)
    (if (/= (assoc 284 ed) nil)
        (setq ed (subst (cons 284 acCastsShadows) (assoc 284 ed) ed))
        (setq ed (append ed (list (cons 284 acCastsShadows))))
    )
  
    (entmod ed)
    (entupd (vlax-vla-object->ename coneObj))
    (setq displaySettingDesc (DescribeShadowDisplay newShadowDisplay))
    (alert (strcat "New shadow display setting is: " displaySettingDesc))
)

(defun DescribeShadowDisplay (acShadow / )
    (cond
        ((= acShadow acCastsAndReceivesShadows) "cast and receive shadows.")
        ((= acShadow acCastsShadows) "cast shadows only.")
        ((= acShadow acReceivesShadows) "receive shadows only.")
        ((= acShadow acIgnoreShadows) "ignore shadows.")
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-15 11:51

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部