Unsupressing Folders
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey Autodesk forum, here I am again. I am trying to unsupress as quickly as possible and want to change entire large assemblies in one go based on reading data from excel, unsupressing things inside a certain folder is a part of it. I managed to get this far and am able to unsupress folder names, however now I want to change it so instead of selecting the folder and unsuppressing it, I want ilogic to get all the componentoccurences from the folder that is selected and store them inside an objectcollection so I can process and unsupress them later all at once by using selectset.multiple. This is how far I got now, does anyone know how I can do this?
Private Sub UnsuppressFolderbyname(parentfolder As String, subfolder As String) Dim oDoc As Document = ThisDoc.Document Dim oModelPane As BrowserPane = oDoc.BrowserPanes.Item("Model") Dim oTopNode As BrowserNode = oModelPane.TopNode Dim oBFolders As BrowserFoldersEnumerator = oTopNode.BrowserFolders ' Check if there are any folders If oBFolders.Count = 0 Then MessageBox.Show("No folders found.", "Debug Info") ' Show message if no folders found Exit Sub ' Exit the rule if no folders are found End If ' Loop through all top-level folders For Each oBFolder As BrowserFolder In oBFolders If oBFolder.Name = parentfolder Then ' Look for the parent folder ' Now look inside the parent folder for the subfolder Dim oSubFolders As BrowserFoldersEnumerator = oBFolder.BrowserNode.BrowserFolders For Each oSubFolder As BrowserFolder In oSubFolders If oSubFolder.Name = subfolder Then ' Look for the subfolder ' Process the subfolder if found ProcessFolder(oDoc, oSubFolder) Exit Sub ' Exit after processing the subfolder End If Next ' If we get here, it means the subfolder was not found MessageBox.Show("Subfolder not found: " & subfolder, "Debug Info") Exit Sub ' Exit if the subfolder was not found End If Next ' If we get here, it means the parent folder was not found MessageBox.Show("Parent folder not found: " & parentfolder, "Debug Info") End Sub ' This is a custom routine to process the folder Private Sub ProcessFolder(oDoc As Document, oBrowserFolder As BrowserFolder) If oBrowserFolder IsNot Nothing Then ' Check if the folder has any contents If oBrowserFolder.BrowserNode.BrowserNodes.Count = 0 Then MsgBox("Nothing was found in '" & oBrowserFolder.Name & "' folder.", , "") Else oDoc.SelectSet.Clear() oDoc.SelectSet.Select(oBrowserFolder) ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyCompSuppressionCtxCmd").Execute End If End If End Sub