Message 1 of 10
iLogic to create browser node folder and move all iParts and iAssemblies into it

Not applicable
09-02-2019
01:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Guys....
I found a good code doing what i need but only for:
' If TypeOf oOcc.Definition Is VirtualComponentDefinition Then
' If TypeOf oOcc.Definition Is PartComponentDefinition Then
... how is it possible do to same now for iPart and iAssembly?
This code I am using now:
'define folder name to use sFolder = "Parts" 'define assembly doc Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument 'define assembly Component Definition Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = oDoc.ComponentDefinition 'get browser pane Dim oPane As BrowserPane oPane = oDoc.BrowserPanes.ActivePane 'try to get existing folder by name and delete it 'catch error if not found Dim oFolder As BrowserFolder Try oFolder = oPane.TopNode.BrowserFolders(sFolder) oFolder.Delete Catch End Try Dim oCollection As ObjectCollection oCollection = ThisApplication.TransientObjects.CreateObjectCollection 'Iterate through all of the occurrences in the assembly Dim oOcc As ComponentOccurrence For Each oOcc In oAsmCompDef.Occurrences 'look at only virtual components ' If TypeOf oOcc.Definition Is VirtualComponentDefinition Then If TypeOf oOcc.Definition Is PartComponentDefinition Then 'get browser node of occurence Dim oNode As BrowserNode oNode = oPane.GetBrowserNodeFromObject(oOcc) 'add node to collection oCollection.Add(oNode) End If Next
Can someone help me here please . Thanks