Hello
It ignores patterns and all subassemblies, but maybe it's enough for your needs.
Dim sFolderName As String = "Test" '<----------------------------Modify name of target folder
Dim oAssDoc As AssemblyDocument = ThisDoc.Document
Dim oBrowserPane As BrowserPane
For Each oBrowserPane In oAssDoc.BrowserPanes
If oBrowserPane.InternalName = "AmBrowserArrangement" Then Exit For
Next
If oBrowserPane Is Nothing Then Exit Sub
Dim oTopNode As BrowserNode = oBrowserPane.TopNode
Dim oBrowserFolder As BrowserFolder
For Each oBrowserFolder In oTopNode.BrowserFolders
If oBrowserFolder.Name = sFolderName Then Exit For
Next
If oBrowserFolder Is Nothing Then Exit Sub
Dim oOcc As ComponentOccurrence
For Each oOcc In oAssDoc.ComponentDefinition.Occurrences
Dim sDescription As String
sDescription = oOcc.Definition.Document.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}").Item("Description").Value
If sDescription = "ToFolder" Then
Dim oBrowserNode As BrowserNode = oBrowserPane.GetBrowserNodeFromObject(oOcc)
If Not oBrowserNode Is Nothing Then
Call oBrowserFolder.Add(oBrowserNode)
End If
End If
Next
R. Krieg
RKW Solutions
www.rkw-solutions.com