Action 示例

使用 VBA 以外的其它编程语言

Sub Example_Action()
    ' 本示例对文件进行加密并保存。

    Dim acad As New AcadApplication
    Dim sp As New AcadSecurityParams
    
    acad.Visible = True
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
    sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
    sp.KeyLength = 40
    sp.Password = UCase("mypassword") 'AutoCAD 在使用密码前转换所有密码为大写
    sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
    sp.ProviderType = 1
    
    acad.ActiveDocument.SaveAs "C:\MyDrawing.dwg", , sp
    
End Sub