Loop Thru Sheets Via Display Order

Loop Thru Sheets Via Display Order

ChrisPicklesimer
Advocate Advocate
988 Views
6 Replies
Message 1 of 7

Loop Thru Sheets Via Display Order

ChrisPicklesimer
Advocate
Advocate
With the following code I can randomly loop through sheets in a dst file data base.  Is thare a way to loop through the sheets via their diplay order in the sheet set manager?  Ultimately I am looking to increment a custom property that is based on display order.
Thanks.
Chris
Private Sub LoopThruSheets(ByVal sheetSetDatabase As IAcSmDatabase)
        ' Get the objects in the sheet set
        Dim enumerator As IAcSmEnumPersist
        enumerator = sheetSetDatabase.GetEnumerator()

        ' Get the first object in the Enumerator
        Dim item As IAcSmPersist
        item = enumerator.Next()

        ' Step through all the objects in the sheet set
        Do While Not item Is Nothing
            Dim sheet As IAcSmSheet = Nothing

            ' Check to see if the object is a sheet
            If item.GetTypeName() = "AcSmSheet" Then
                sheet = item
                MsgBox(sheet.GetName.ToString)
            End If

            ' Get the next Sheet
            item = enumerator.Next()
        Loop
    End Sub

 

0 Likes
989 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

The enumerator should iterate through the sheets in their natural order, which

is what the SSM displays them in. 

 

I used the SSM to drag a sheet to a different position within its subset

(A110 - Fire Rating Plans in the screenshot), and that's the order it

appears in when my code iterates the sheets in the subset.

 

 

 

 

0 Likes
Message 3 of 7

ChrisPicklesimer
Advocate
Advocate

I have tried it multiple times but the iteration order does not seem to change for me even after I adjusted the odrer via the SSM.  Just out of curiousity, did you use the code I posted when you ran your test?  I tested using ACA 2008.  Would that make a difference?

 

Thanks.

 

Chris

0 Likes
Message 4 of 7

Anonymous
Not applicable

Are you closing and reopening the SheetSet before trying? If not,

that may be it.

 

I'm not using your code. The code that I use to populate the treeview

shown in the screenshot uses GetDirectlyOwnedObjects() rather the

iterators, which might also explain the difference.

 

I'm using vanilla AutoCAD so I can't say for sure if ACA's variant of the

SSM is doing something differently.

0 Likes
Message 5 of 7

jshimkus
Advocate
Advocate

How did you adjust the sheet order using the SSM?

0 Likes
Message 6 of 7

ChrisPicklesimer
Advocate
Advocate

I click on the sheet and drag into position.

0 Likes
Message 7 of 7

jshimkus
Advocate
Advocate

OK, I thought you had found a way to do it via code.

 

Thanks

0 Likes