SSM Get Custom Property Values

SSM Get Custom Property Values

Civil3DReminders_com
Mentor Mentor
388 Views
4 Replies
Message 1 of 5

SSM Get Custom Property Values

Civil3DReminders_com
Mentor
Mentor
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
Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
0 Likes
389 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Looks like it's missing casting after testing for the sm componant type. try
something like:

ElseIf Item.GetTypeName = "AcSmCustomPropertyBag" Then
...
set cpbag = Item
...
'Iterate through custom properties
Dim propIter As IAcSmEnumProperty
Set propIter = cpbag.GetPropertyEnumerator

....

wrote in message news:5151633@discussion.autodesk.com...
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
0 Likes
Message 3 of 5

Anonymous
Not applicable
On second though, I looked it over and i'm not even sure how it's supposed
to work. I've only been able to read and write to specific custom property
names and havn't had any luck with retrieving a list of all the custom
properties in a sheet set.

-Chris

wrote in message news:5151633@discussion.autodesk.com...
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
0 Likes
Message 4 of 5

Civil3DReminders_com
Mentor
Mentor
Thanks Chris

Could you post a few lines of code that retrieves a custom property value by name. That is realy what I want to do, but am unable to figure it out. I can get the standard values but am at a loss on how to get the custom properties.
Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
0 Likes
Message 5 of 5

Anonymous
Not applicable
Sheet Set Manager code snippets
http://jtbworld.blogspot.com/2006/04/sheet-set-manager-code-snippets.html

--
Best Regards, Jimmy Bergmark
CAD and Database Developer Manager at www.pharmadule-emtunga.com
Blog: http://jtbworld.blogspot.com
JTB FlexReport (FLEXnet / FLEXlm report tool) -
http://www.jtbworld.com/jtbflexreport
SmartPurger (Purges automatically) - http://www.jtbworld.com/smartpurger.htm
or download some freeware at http://www.jtbworld.com
More on AutoCAD 2006 and 2007
http://www.jtbworld.com/autocad2006.htm
http://www.jtbworld.com/autocad2007.htm


wrote in message news:5152671@discussion.autodesk.com...
Thanks Chris

Could you post a few lines of code that retrieves a custom property value by
name. That is realy what I want to do, but am unable to figure it out. I can
get the standard values but am at a loss on how to get the custom
properties.
0 Likes