Identify all layouts that are in a Sheet Set

Identify all layouts that are in a Sheet Set

GilesPhillips
Collaborator Collaborator
1,074 Views
1 Reply
Message 1 of 2

Identify all layouts that are in a Sheet Set

GilesPhillips
Collaborator
Collaborator

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
0 Likes
1,075 Views
1 Reply
Reply (1)
Message 2 of 2

ambrosl
Autodesk
Autodesk

The Sheet Set Manager will do its best to block the addition of a drawing that already contains a drawing hint which indicates it is already being referenced elsewhere.  The sheet set implementation is one layout per drawing.  Now, it is possible, that you could have multiple layouts from the same drawing referenced in a Sheet Set which means the hint was removed at some point in time after the first layout was added or the Sheet Set Object (SSO) library was used to add the sheets.

 

In the situation with multiple layouts, the last sheet set in which a drawing is opened from and then saved will be stamped with that sheet set's drawing hint.  The following is the result of copying the sample sheet set 'IRD Addition.dst' to 'Dup IRD Addition.dst' and then opening/saving the Arch Site Plan sheet from 'Dup IRD Addition.dst' in the Sheet Set Manager.

 

(setq AcSheetSetData (entget (cdr (cadr (member '(3 . "AcSheetSetData") (entget (namedobjdict)))))))

((-1 . <Entity name: 2b2c36c1a70>) (0 . "DICTIONARY") (5 . "2CC37") (102 . "{ACAD_REACTORS") 
(330 . <Entity name: 2b2b000b0c0>) (102 . "}") (330 . <Entity name: 2b2b000b0c0>)
(100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "LayoutHandle") (350 . <Entity name: 2b2c36c1b80>)
(3 . "layoutName") (350 . <Entity name: 2b2c36c1ab0>) (3 . "SheetDwgName")
(350 . <Entity name: 2b2c36c1aa0>) (3 . "ShSetFileName") (350 . <Entity name: 2b2c36c1a90>)
(3 . "ShSetVersion") (350 . <Entity name: 2b2c36c1a80>) (3 . "UpdateCount")
(350 . <Entity name: 2b2c36c1b90>) (3 . "UpdateTime") (350 . <Entity name: 2b2c36c1ba0>)) (entget (cdr (cadr (member '(3 . "ShSetFileName") AcSheetSetData)))) ((-1 . <Entity name: 2b2c36c1a90>) (0 . "XRECORD") (5 . "2CC39") (102 . "{ACAD_REACTORS")
(330 . <Entity name: 2b2c36c1a70>) (102 . "}") (330 . <Entity name: 2b2c36c1a70>) (100 . "AcDbXrecord")
(280 . 1) (1 . "C:\\Users\\ambrosl\\Documents\\AutoCAD Sheet Sets\\Architectural\\Dup IRD Addition.dst"))

Do you have access to the DST file?  If so, you might be able to scan the files using the Sheet Set Object library and identify which files and layouts are being used rather than relying on just the drawing hint.  Doing that, will allow you to potentially see all the different DST files that reference a layout.



Lee Ambrosius
Senior Principal Content Experience Designer
For additional help, check out the AutoCAD Developer Documentation
0 Likes