Author Topic: Changing Custom Properties in Sheet Set  (Read 2166 times)

0 Members and 1 Guest are viewing this topic.

ML

  • Guest
Changing Custom Properties in Sheet Set
« on: February 08, 2008, 03:59:36 PM »

Does anyone have any code for changing The Custom Properties in a Sheet Set?
I have  ton of code but it is not quite what I need?

Any help would be appreciated!

Thanks!

Mark

Guest

  • Guest
Re: Changing Custom Properties in Sheet Set
« Reply #1 on: February 08, 2008, 04:38:58 PM »
Check the other post.  Might be what you're looking for.

ML

  • Guest
Re: Changing Custom Properties in Sheet Set
« Reply #2 on: February 08, 2008, 06:24:32 PM »

Matt

The pdf is excellent! Thank you
I went through so much code and the code and instructions in this pdf are the most concise instructions and code I have seen yet on Sheet sets.

Matt, I am almost there.
I have a Sheet Set created with Custom Properties

I have the code returning my Sheet Set but I can not seem to get the new properties (in the example) to populate.

Do you think you could take a quick look and see what I am missing?

I'd appreciate it!

Thank you again!

Mark

Code: [Select]

Sub SheetSetCustomProps()
 
'Create a reference to The Sheet Manager Object
 Dim sheetSetMgr As AcSmSheetSetMgr
 Set sheetSetMgr = New AcSmSheetSetMgr
 
 Dim DstFile As String
 DstFile = ("I:\eng\HRSDEMO\dwg\HRSDEMO.dst")

'Open a Sheet Set file
 Dim SheetDb As AcSmDatabase
 Set SheetDb = sheetSetMgr.OpenDatabase(DstFile, False)
 
 Dim Ssetname As String
 Dim SsetDesc As String
 
 Ssetname = SheetDb.GetSheetSet.GetName
 SsetDesc = SheetDb.GetSheetSet.GetDesc
 
'Return the Sheet Set Name and Description
 MsgBox "Sheet Set Name: " & Ssetname & vbCrLf + _
 "Sheet Set Description: " & SsetDesc


End Sub

Private Sub SetCustomProperty(SheetDb As AcSmDatabase, strName As String, strValue As Variant, _
Optional bSheetSetFlag As Boolean = True)

'A flag for the Custom Property Value is used to determine if it is a property at the Sheet or Sheet Set level.
'The value used to refer to a Sheet property is CUSTOM_SHEET_PROP and the value used to refer to a Sheet Set value is
'CUSTOM_SHEETSET_PROP. The following procedure demonstrates how to create a reference to the Custom Property Bag

 Dim SheetDb As AcSmDatabase
 Dim DstFile As String
 
 DstFile = ("I:\eng\HRSDEMO\dwg\HRSDEMO.dst")

'Create a Reference to the Custom Property Bag
 Dim cBag As AcSmCustomPropertyBag
 Set cBag = SheetDb.GetSheetSet(DstFile).GetCustomPropertyBag
 
'Create a Reference to a Custom Property Value
 Dim cBagVal As New AcSmCustomPropertyValue
 cBagVal.InitNew SheetDb.GetSheetSet(DstFile) '' cBag
 
'Set the Flag for Sheet Set or Sheet Property
 If bSheetSetFlag = True Then
  cBagVal.SetFlags CUSTOM_SHEETSET_PROP
 Else
  cBagVal.SetFlags CUSTOM_SHEET_PROP
 End If
'Set the value for the Bag
 cBagVal.SetValue strValue
 
'Create the property
 cBag.SetProperty strName, cBagVal
'Cleat variable
 Set cBagVal = Nothing
End Sub

[color=red]'This is the part that is not working yet????[/color]

'Setup the Sheet Set's default values
 'SetSheetSetDefaults oSheetDb, "CP15-1", "AU2005 Sheet Set Object Demo for CP15-1", _
 'strSheetSetFldr, "C:\Documents and Settings\<user name>\My Documents\AutoCAD Sheet Sets\CP15-1.dwt", "Layout1"

'Create a Sheet Property
 SetCustomProperty oSheetDb, "Checked By", "LAA", False
 SetCustomProperty oSheetDb, "Complete Percentage", "0%", False

'Create a Sheet Set Property
 SetCustomProperty oSheetDb, "Project Approved By", "AU05"

End Sub