I'm looking for a way to automate the sheet order in the navigator window.
couldn't find any reference for it in Mentor documentation.
any help is welcome,
At our site, the Navigator > Sheets > Label format has always been set to $(Name), so we never see the internal $(Number) property, which is apparently controlled by Project > Boards > Sheet Numbering. So try this: after running the script (and again, you need to determine how the script reorders your sheets), run Setup > Settings, then hit OK without changing anything, and the sheet numbers should update. Unfortunately, there is no way to automate this last step.
Not supported: How to sort sheets in navigator?
Actually, the SchematicSheetDocuments object has two hidden methods that access sheet order:
SchematicSheetDocuments.GetSheetOrder(SchematicName As String) As StringList
SchematicSheetDocuments.SetSheetOrder(SchematicName As String, sheetRange As StringList)
The methods are hidden because they are not supported by documentation, so their functionality is not guaranteed to work. But, you can play with them to see if they work for you. You will need familiarity with manipulation of StringLists, and you will need to create your own sort routine to establish order.
Boom. Another winner.
So, I did some more playing with these methods to see if they work, and they do. The following script gets the current sheet order, reverses it, and then applies it. I figured that if it worked once, I could run it again, and reset to the original order. You will have to figure out how you want to sort your list of sheets.
For Each Sch In SchematicSheetDocuments.GetAvailableSchematics
Set List = SchematicSheetDocuments.GetSheetOrder(Sch)
Sum = List.GetCount
For Inc = Sum To 1 Step -1
Call List.Insert(List.GetItem(Sum),Sum - Inc + 1)
Call List.Remove(Sum + 1)
Many thanks !!!
I ran the script and it does work, the sheet order was change.
my problem, the way we use the navigator to represent the page name is (taken from settings-> navigator->sheets) : Sheet $(Number): $(Name)
so when changing the order, the page name do change but the sheet number "moves" with the page name as follows. do you think that it is possible to change that as well?
works like magic.
Many thanks for the help.BTW - how did you come with the solution?
For finding GetSheetOrder and SetSheetOrder, I used the Excel Visual Basic Object Browser, targeted the ViewDraw reference, displayed the hidden members, and then searched for SheetOrder. Fixing the sheet numbering was purely an experiment that I expected to work. Apparently, SetSheetOrder is missing some internal call that would automatically update the sheet numbers, so now we know why it is hidden and not documented.
Retrieving data ...