EnableShadowDisplay プロパティ(ActiveX)

オブジェクトに対して影表示プロパティが有効かどうかを指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.EnableShadowDisplay
object

タイプ: ShadowDisplay

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: 長整数型

注意

このプロパティは、3D ソリッド オブジェクトに対しては常に 1 に設定されます。厚さを持つことができる 2D オブジェクトに対しては 0 または 1 です。厚さがゼロ以外の 2D オブジェクトの場合、このプロパティは 1 を返します。厚さが 0 の 2D オブジェクトの場合、0 を返します。このプロパティは、RasterImage のように厚さを持つことができない 2D オブジェクトの場合は、常に 0 を返します。

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