Changing Sheet Order of DWG with iLogic

Changing Sheet Order of DWG with iLogic

schefb
Explorer Explorer
1,027 Views
2 Replies
Message 1 of 3

Changing Sheet Order of DWG with iLogic

schefb
Explorer
Explorer

Hello All,

 

I have been banging my head on a wall repeatedly trying to figure out how to change the order of drawing sheets using iLogic. Our default drawing template currently has a page called "CONSTRUCTION CODE:4" as the last page of the drawing. I have written code that counts how many different design view representations the assembly has and creates part pages with appropriate formatting and views for each one (as well as adding a BOM Page). But, they come in as new pages lower on the list and I would prefer that the CONSTRUCTION CODE sheet stays as the last sheet. Obviously, the user could just drag the page to the correct location after running the code, but since it will have to be moved on every drawing, I would prefer to automate it if possible.

 

I thought initially that I could simply use a reorder-type command for the Sheets, but that doesn't seem to be an option from studying the database. From what I've read, it seems more likely that this Reorder should be used while treating the pages as Browser Nodes, but for the life of me I have not been able to get any version of code I've come up with to work.

 

Any help or suggestions to point me in the right direction would be much appreciated!

 

schefb_0-1642456702316.png

 

 

0 Likes
Accepted solutions (1)
1,028 Views
2 Replies
Replies (2)
Message 2 of 3

Michael.Navara
Advisor
Advisor
Accepted solution

You need to reorder BrowserNodes instead of sheets. This code snippet moves the active sheet to the end of sheets

 

 

Dim drw As DrawingDocument = ThisDoc.Document
Dim pane As BrowserPane = drw.BrowserPanes.ActivePane

Dim lastSheetNode = pane.GetBrowserNodeFromObject(drw.Sheets(drw.Sheets.Count))
Dim activeSheetNode = pane.GetBrowserNodeFromObject(drw.ActiveSheet)
Call pane.Reorder(lastSheetNode, False, activeSheetNode)

 

Message 3 of 3

schefb
Explorer
Explorer

That's perfect, thank you! I added a line to activate the "CONSTRUCTION CODE" sheet before executing the move so that it would not matter which sheet was active, but it does exactly what I needed and I understand now why my code was wrong. Thanks again!

0 Likes