CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2025 开发者帮助

Action 属性 (ActiveX)

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

Action 属性 (ActiveX)

指定要对图形执行的与安全相关的操作。

支持的平台:仅限 AutoCAD for Windows;AutoCAD LT for Windows 不支持

签名

VBA:

object.Action
对象

类型:SecurityParams

此属性应用于的对象。

属性值

只读:

类型:长; 枚举AcadSecurityParamsType

为图形加密、图形特性加密、数字签名或时间戳指定以下一个或多个常量。

  • ACADSECURITYPARAMS_ENCRYPT_DATA: 0x00000001
  • ACADSECURITYPARAMS_ENCRYPT_PROPS: 0x00000002
  • ACADSECURITYPARAMS_SIGN_DATA: 0x00000010
  • ACADSECURITYPARAMS_ADD_TIMESTAMP: 0x00000020
注意:从基于 AutoCAD-2016 的产品开始,已停止使用密码保护图形文件的功能。常量值 和 已过时。如果使用这两个常量中的任何一个,则该方法将产生错误。ACADSECURITYPARAMS_ENCRYPT_DATAACADSECURITYPARAMS_ENCRYPT_DATASaveAs

言论

每个常量表示一个与安全相关的操作。使用该属性时,在操作集中的某个时间点,必须将该属性设置为常量。ActionActionACADSECURITYPARAMS_SIGN_DATA

若要指定多个与安全相关的操作,请添加表示这些操作的常量。例如,若要对图形进行签名并使用时间戳,请指定以下内容:

ACADSECURITYPARAMS_SIGN_DATA + ACADSECURITYPARAMS_ADD_TIMESTAMP

例子

VBA:

Sub Example_Action()
    ' This example attaches a digital signature and accompanying data to a file,
    ' and saves the file.

    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams." & Left(AcadApplication.Version, 2))
    
    ' Attach a digital signature and timestamp it
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_SIGN_DATA _
                + AcadSecurityParamsType.ACADSECURITYPARAMS_ADD_TIMESTAMP
    
    ' Certificate details follow
    sp.Subject = "Thawte Freemail Member"
    sp.Issuer = "Personal Freemail RSA 2000.8.30"
    sp.SerialNumber = "073848"
    sp.Comment = "This is now signed"
    sp.TimeServer = "NIST(time.nist.gov)"
    
    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_Action()
    ;; This example attaches a digital signature and accompanying data to a file,
    ;; and saves the file.

    (setq acadObj (vlax-get-acad-object)
          sp (vla-GetInterfaceObject acadObj (strcat "AutoCAD.SecurityParams." (substr (getvar "ACADVER") 1 2))))
    
    (vla-put-Visible acadObj :vlax-true)
    
    ;; Attach a digital signature and timestamp it
    (vla-put-Action sp (+ ACADSECURITYPARAMS_SIGN_DATA
                          ACADSECURITYPARAMS_ADD_TIMESTAMP))
    
    ;; Certificate details follow
    (vla-put-Subject sp "Thawte Freemail Member")
    (vla-put-Issuer sp "Personal Freemail RSA 2000.8.30")
    (vla-put-SerialNumber sp "073848")
    (vla-put-Comment sp "This is now signed")
    (vla-put-TimeServer sp "NIST(time.nist.gov)")

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

    (vlax-release-object sp)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2025-3-31 13:10

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部