Move IPT Files with description string to assembly folder

Move IPT Files with description string to assembly folder

Keith.Challinor3761
Contributor Contributor
434 Views
3 Replies
Message 1 of 4

Move IPT Files with description string to assembly folder

Keith.Challinor3761
Contributor
Contributor

In order to keep my assembly browser a little less busy I would like to move all parts that have a certain description string to an already existing assembly folder

0 Likes
Accepted solutions (2)
435 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor
Accepted solution

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
Message 3 of 4

Keith.Challinor3761
Contributor
Contributor
Accepted solution
Betreff

Many thanks for you post , unfortunately I don't seem to be able to format it correctly


[cid:image001.png@01D735CE.7BD23DB0]
0 Likes
Message 4 of 4

Keith.Challinor3761
Contributor
Contributor

Many thanks to you both for your time 

 

this works flawlessly 

 

i know i have a lot to learn but this help spurs me on 

 

thank you 

0 Likes