ShadowDisplay Property (ActiveX)

Specifies the shadow display property of the object.

Supported platforms: Windows only

Signature

VBA:

object.ShadowDisplay
object

Type: ShadowDisplay

The object to which this property applies.

Property Value

Read-only: No

Type: AcShadowDisplayType enum

Remarks

No additional remarks.

Examples

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

Visual 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.")
    )
)