指定要对图形执行的安全相关操作。 支持的平台:仅窗口 属性值只读:不 类型:长;枚举AcadSecurityParamsType 为图形加密、图形特性加密、数字签名或时间戳指定以下一个或多个常量。
注意:从基于 AutoCAD-2016 的产品开始,使用密码保护图形文件的功能已停止使用。常量值已过时。如果使用两个常量中的任何一个,该方法都会产生错误。ACADSECURITYPARAMS_ENCRYPT_DATAACADSECURITYPARAMS_ENCRYPT_DATASaveAs
言论每个常量表示一个与安全相关的操作。使用属性时,在操作集中的某个时刻,必须将属性设置为常量。ActionActionACADSECURITYPARAMS_SIGN_DATA 若要指定多个与安全相关的操作,请添加表示这些操作的常量。例如,要对图形进行签名并使用时间戳,请指定以下内容: ACADSECURITYPARAMS_SIGN_DATA + ACADSECURITYPARAMS_ADD_TIMESTAMP 例子工 务 局: Sub Example_Action()
' This example encrypts and saves a file.
Dim sp As AcadSecurityParams
Set sp = GetInterfaceObject("AutoCAD.SecurityParams." + Left(AcadApplication.Version, 2))
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 (strcat "AutoCAD.SecurityParams." (substr (getvar "ACADVER") 1 2))))
(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)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 11:28
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.