- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I work with massive drawing files sometime over 200 pages in one file, (while I know people don't like this, please reframe from comments about doing one file and multiple sheets compared to many files and one sheet) is there a way to re-order my sheets base on the sheet name? rather than having to drag each each page individually.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, try this rule below. I think it does what you need
Sub Main () On Error Resume Next Dim drawingDoc As DrawingDocument = ThisDoc.Document Dim Sheet As Sheet = Nothing Dim sheetsList As New List(Of Sheet) Dim BrowserPane As BrowserPane = drawingDoc.BrowserPanes.Item("Model") For Each Sheet In drawingDoc.Sheets sheetsList.Add(Sheet) Next sheetsList.Sort(AddressOf Comparer) For Each Sheet In sheetsList Dim sheetNode As BrowserNode = BrowserPane.GetBrowserNodeFromObject(Sheet) Dim bottomNode As BrowserNode = BrowserPane.TopNode.BrowserNodes.Item(BrowserPane.TopNode.BrowserNodes.Count) BrowserPane.Reorder(bottomNode, False, sheetNode) Next End Sub
I hope it is useful for you. regards
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Error on Line 12 : 'Comparer' is a type and cannot be used as an expression.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sub Main () On Error Resume Next Dim drawingDoc As DrawingDocument = ThisDoc.Document Dim Sheet As Sheet = Nothing Dim sheetsList As New List(Of Sheet) Dim BrowserPane As BrowserPane = drawingDoc.BrowserPanes.Item("Model") For Each Sheet In drawingDoc.Sheets sheetsList.Add(Sheet) Next sheetsList.Sort(AddressOf Comparer) For Each Sheet In sheetsList Dim sheetNode As BrowserNode = BrowserPane.GetBrowserNodeFromObject(Sheet) Dim bottomNode As BrowserNode = BrowserPane.TopNode.BrowserNodes.Item(BrowserPane.TopNode.BrowserNodes.Count) BrowserPane.Reorder(bottomNode, False, sheetNode) Next End Sub Private Function Comparer(x As Sheet, y As Sheet) As Integer Return String.Compare(x.Name,y.Name) End Function
Excuse me, I am missing the function below everything, greetings!
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you @Sergio.D.Suárez
This worked for me also... however do you know a method that works without using BrowserPane?
BrowserPane is not available in InventorCoreConsole/Forge.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, so I have been making a similar code, when i came across yours. the problem is when there is over 100 sheets, or if the part numbers in this case end in 100, 101, etc it then goes 1 to 10 then 100, 101, 102....109, then 11 then 110, 111, 112, etc... and mixes up the numbers. is there a way to avoid this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, a fast idea:
Get length of the sheetname and insert one 0 for len(SHEETNAME)=2 and two 0 ("00") for len(SHEETNAME)=1 --> sort sheets --> delete zeroes at the beginning of the sheetnames.