Matt
pdf非常棒!谢谢
我看了这么多代码,这个pdf中的代码和说明是我在工作表集中看到的最简洁的说明和代码。
Matt,我快到了。
我有一个使用自定义属性创建的工作表集
我有返回我的工作表集的代码,但我似乎无法获得要填充的新属性(在示例中)。
您认为您可以快速查看一下并看看我缺少什么吗?
我将不胜感激!
再次感谢!
Mark
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\[u]\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