Message 1 of 5
SSM Get Custom Property Values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to retreive custom property values from the sheet set manager. I am using the sample code, but it is not working. Is there any changes that need to be made to the sample code for it to work?
' List all sheets and categories at the command line
Public Sub List(db As IAcSmDatabase)
On Error Resume Next
Dim iter As IAcSmEnumPersist
Dim Item As IAcSmPersist
Dim sheet As IAcSmSheet
Dim subset As IAcSmSubset
Dim cpbag As AcSmCustomPropertyBag
Dim name As String
Dim desc As String
Dim page As String
Dim navf As String
Dim value As String
Set iter = db.GetEnumerator
Set Item = iter.Next
Do While Not Item Is Nothing
Set sheet = Item
Set subset = Item
Set cpbag = Item
'If Not subset Is Nothing Then
If Item.GetTypeName = "AcSmSubset" Then
'list the category (subset)
name = subset.GetName
desc = subset.GetDesc
ThisDrawing.Utility.Prompt ("-------------------------------" & vbCrLf)
ThisDrawing.Utility.Prompt ("SubSet Name :" & name & vbCrLf)
ThisDrawing.Utility.Prompt ("SubSet Desc :" & desc & vbCrLf)
ThisDrawing.Utility.Prompt ("-------------------------------" & vbCrLf)
'ElseIf Not sheet Is Nothing Then
ElseIf Item.GetTypeName = "AcSmSheet" Then
'list the sheet
name = sheet.GetName
desc = sheet.GetDesc
page = sheet.GetNumber
ThisDrawing.Utility.Prompt ("sheet Name :" & name & vbCrLf)
ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & vbCrLf)
ThisDrawing.Utility.Prompt ("sheet Page :" & page & vbCrLf)
ThisDrawing.Utility.Prompt ("NavfacMinusOne :" & navf & vbCrLf)
ElseIf Item.GetTypeName = "AcSmCustomPropertyBag" Then
'Iterate through custom properties
Dim propIter As IAcSmEnumProperty
Set propIter = cpbag.GetPropertyEnumerator
Dim propName As String
Dim propval As AcSmCustomPropertyValue
Do While True
Set propval = Nothing
propName = ""
propIter.Next name, propval
If propName = "" Then Exit Do 'jump out of loop
If Not IsEmpty(propval) And Not IsObject(propval) Then
ThisDrawing.Utility.Prompt ("Property " & propName & " : " & propval.GetValue & " " & vbCrLf)
End If
Loop
End If
Set Item = iter.Next
Loop
ThisDrawing.Application.Update
End Sub
' List all sheets and categories at the command line
Public Sub List(db As IAcSmDatabase)
On Error Resume Next
Dim iter As IAcSmEnumPersist
Dim Item As IAcSmPersist
Dim sheet As IAcSmSheet
Dim subset As IAcSmSubset
Dim cpbag As AcSmCustomPropertyBag
Dim name As String
Dim desc As String
Dim page As String
Dim navf As String
Dim value As String
Set iter = db.GetEnumerator
Set Item = iter.Next
Do While Not Item Is Nothing
Set sheet = Item
Set subset = Item
Set cpbag = Item
'If Not subset Is Nothing Then
If Item.GetTypeName = "AcSmSubset" Then
'list the category (subset)
name = subset.GetName
desc = subset.GetDesc
ThisDrawing.Utility.Prompt ("-------------------------------" & vbCrLf)
ThisDrawing.Utility.Prompt ("SubSet Name :" & name & vbCrLf)
ThisDrawing.Utility.Prompt ("SubSet Desc :" & desc & vbCrLf)
ThisDrawing.Utility.Prompt ("-------------------------------" & vbCrLf)
'ElseIf Not sheet Is Nothing Then
ElseIf Item.GetTypeName = "AcSmSheet" Then
'list the sheet
name = sheet.GetName
desc = sheet.GetDesc
page = sheet.GetNumber
ThisDrawing.Utility.Prompt ("sheet Name :" & name & vbCrLf)
ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & vbCrLf)
ThisDrawing.Utility.Prompt ("sheet Page :" & page & vbCrLf)
ThisDrawing.Utility.Prompt ("NavfacMinusOne :" & navf & vbCrLf)
ElseIf Item.GetTypeName = "AcSmCustomPropertyBag" Then
'Iterate through custom properties
Dim propIter As IAcSmEnumProperty
Set propIter = cpbag.GetPropertyEnumerator
Dim propName As String
Dim propval As AcSmCustomPropertyValue
Do While True
Set propval = Nothing
propName = ""
propIter.Next name, propval
If propName = "" Then Exit Do 'jump out of loop
If Not IsEmpty(propval) And Not IsObject(propval) Then
ThisDrawing.Utility.Prompt ("Property " & propName & " : " & propval.GetValue & " " & vbCrLf)
End If
Loop
End If
Set Item = iter.Next
Loop
ThisDrawing.Application.Update
End Sub
Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
