Message 1 of 2
Identify all layouts that are in a Sheet Set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I've got a project that relies on a function to return the sheetset name associated with a drawing layout - or an empty string if not associated.
The problem is the function is only returning a name against one layout, depsite the fact I'm certain there's a second layout in that file associated with the same sheet set.
So for example, a drawing that has Layout1 and Layout2 both assocated with a sheet set, will return the name of the sheetset for Layout1, but an empty string for Layout2
The code is modified slightly from a post by Ambrosl in 2018:
Public Function GetSheetSetName(AcFile As AcadDocument, LayoutName As String) As String 'returns the name of the sheetset associated with the layout (layoutname) of the file AcFile 'returns empty string if not associated Dim AcDictObj As AcadDictionary Dim SSFileName As String Dim LayName As String On Error Resume Next Set AcDictObj = AcFile.Dictionaries("AcSheetSetData") If Err.Number = 0 Then On Error GoTo 0 Dim AcXrecObj As AcadXRecord Dim XType As Variant Dim XVal As Variant For Each AcXrecObj In AcDictObj AcXrecObj.GetXRecordData XType, XVal If AcXrecObj.Name = "ShSetFileName" Then SSFileName = CStr(XVal(0)) ElseIf AcXrecObj.Name = "LayoutName" Then LayName = CStr(XVal(0)) End If Next If LayName = LayoutName Then GetSheetSetName = SSFileName End If Else GetSheetSetName = "" End If End Function
The problem, I think, is the dictionary "AcSheetSetData" only contains one layout/sheetset name combination.
I need to find all of them.
Can anyone suggest an alternative approach?
Cheers
G
ACad, MEP, Revit, 3DS Max