Action Property (ActiveX)

Specifies the security-related operations to be performed on a drawing.

Supported platforms: Windows only

Signature

VBA:

object.Action
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: Long; AcadSecurityParamsType enum

Specify one or more of the following constants for drawing encryption, drawing properties encryption, a digital signature, or a time stamp.

Note: Starting with AutoCAD-2016 based products, the ability to password protect a drawing file has been discontinued. The constant values ACADSECURITYPARAMS_ENCRYPT_DATA and ACADSECURITYPARAMS_ENCRYPT_DATA are obsolete. The SaveAs method produces an error if either of the two constants is used.

Remarks

Each constant represents a security-related operation. When you use the Action property, at some point in the set of operations you must set the Action property to the ACADSECURITYPARAMS_SIGN_DATA constant.

To specify multiple security-related operations, add the constants representing the operations. For example, to sign a drawing and use a time stamp, specify the following:

ACADSECURITYPARAMS_SIGN_DATA + ACADSECURITYPARAMS_ADD_TIMESTAMP

Examples

VBA:

Sub Example_Action()
    ' This example encrypts and saves a file.
    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")
    
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
    sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
    sp.KeyLength = 40
    sp.Password = UCase("mypassword") 'AutoCAD converts all passwords to uppercase before applying them
    sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
    sp.ProviderType = 1
    
    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Action()
    ;; This example encrypts and saves a drawing file.
    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    (vla-put-Action sp ACADSECURITYPARAMS_ENCRYPT_DATA)
    (vla-put-Algorithm sp ACADSECURITYPARAMS_ALGID_RC4)
    (vla-put-KeyLength sp 40)
    (vla-put-Password sp (strcase "mypassword"))
    (vla-put-ProviderName sp "Microsoft Base Cryptographic Provider v1.0")
    (vla-put-ProviderType sp 1)

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)