Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi Skwiggle,
Here is a quick iLogic example rule.
oDoc = ThisDoc.Document oPane = oDoc.BrowserPanes("Model") oTopNode = oPane.TopNode 'Iterate through the browser folders For Each oFolder in oTopNode.BrowserFolders i = 0 'Iterate through the nodes in the folder oFolderNodes = oFolder.BrowserNode.BrowserNodes For Each oNode As BrowserNode In oFolderNodes 'count the nodes i = i+1 Next 'delete the folder if the count = 0 If i = 0 Then oFolder.Delete Else End If Next
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi Curtis, Thank you for you fast response, I tried the code but I get the following error:-
Rule Compile Errors in Rule1, in Assembly1
Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework64\v3.5\vbc.exe" /noconfig @"C:\Users\Damian\AppData\Local\Temp\cjuwy4xv.cmdline".
Any Ideas?
Thanks Regards
Damian
I have just tested Curtis's code and it's working fine. What Inventor version are you on?
Hello
Can this code be tweaked to suppress all folders called 'Reference' - ideally iterating though all sub assemblies?
Regards
Andrew
Here the same code than Curtis, just a little bit more "compact"
For Each oFolder As BrowserFolder In ThisApplication.ActiveDocument.BrowserPanes("Modell").TopNode.BrowserFolders If oFolder.BrowserNode.BrowserNodes.Count = 0 Then oFolder.Delete() Next
Since this old post resurfaced again, I decided to look into some of the concerns mentioned, such as being able to delete empty sub folders. This sounded like a good task for a 'recursive' routine, and sounded like it should be easy to accomplish, so I decided to give it a try. I was wrong...it was fairly difficult to accomplish, because upper level folders would not be deleted until lower level folders were deleted, which always left behind the empty top level folders...until I ran the process a second time at the end. It ended up being a much larger code than I had originally anticipated though. I attached the code in a text file, and hope it will help some folks out.
Wesley Crihfield