|
SummaryInfo Пример |
Sub Example_SummaryInfo()
'Этот пример показывает, как обратиться к свойствам рисунка
'Добавьте, и покажите стандартные свойства
ThisDrawing.SummaryInfo.Author = "John Doe"
ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
ThisDrawing.SummaryInfo.HyperlinkBase = "http://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 "Стандартные свойства рисунка " & 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
'Добавьте, и покажите заказные свойства
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"
'Добавьте заказные свойства
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
'Получите заказные свойства
ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
Key1 = CustomPropertyZone
ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1
MsgBox "Заказные свойства рисунка " & vbCrLf & _
"First property name = " & Key0 & vbCrLf & _
"First property value = " & Value0 & vbCrLf & _
"Second property name = " & Key1 & vbCrLf & _
"Second property value = " & Value1 & vbCrLf
End Sub