Subject Property (ActiveX)

Specifies the subject name of the digital ID (certificate) or drawing.

Supported platforms: Windows only

Signature

VBA:

object.Subject
object

Type: SecurityParams, SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The subject name of the digital certificate or drawing.

Remarks

SummaryInfo: You can use the subject name to group drawings that have the same subject.

Examples

VBA:

Sub Example_AddCustomInfoSubject()
    ' This example shows how to access drawing properties
            
    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "https://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Sub Example_DigitalSignatureSubject()
    ' 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.19")
    
    ' 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

Visual LISP:

(vl-load-com)
(defun c:Example_AddCustomInfoSubject()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))
  
    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "https://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )
  
    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)
  
    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)

(defun c:Example_DigitalSignatureSubject()
    ;; This example attaches a digital signature and accompanying data to a file,
    ;; and saves the file.
    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.19"))
  
    (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)
)