SetCustomByIndex Пример |
Sub Example_SetCustomByIndex() 'Этот пример показывает, как обратиться к свойствам рисунка 'Добавьте и покажите стандартные свойства 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 & vbCrLf & _ "Комментарии = " & Comments & vbCrLf & _ "HyperlinkBase = " & HLB & vbCrLf & _ "Ключевые слова = " & KW & vbCrLf & _ "LastSavedBy = " & LSB & vbCrLf & _ "RevisionNumber = " & RN & vbCrLf & _ "Тема = " & Subject & vbCrLf & _ "Заголовок = " & 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 & _ "Первое имя свойства = " & Key0 & vbCrLf & _ "Первое значение свойства = " & Value0 & vbCrLf & _ "Второе имя свойства = " & Key1 & vbCrLf & _ "Второе значение свойства = " & Value1 & vbCrLf End Sub