I'm using the following sample code to add files to a browser folder
Public Sub AddOccurrencesToFolder()
Dim oDoc As AssemblyDocument Set oDoc = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition Set oDef = oDoc.ComponentDefinition
Dim oPane As BrowserPane Set oPane = oDoc.BrowserPanes.ActivePane
Dim oOccurrenceNodes As ObjectCollection Set oOccurrenceNodes = ThisApplication.TransientObjects.CreateObjectCollection
Dim oOcc As ComponentOccurrence For Each oOcc In oDef.Occurrences
Dim oNode As BrowserNode Set oNode = oPane.GetBrowserNodeFromObject(oOcc)
oOccurrenceNodes.Add oNode Next
Dim oFolder As BrowserFolder Set oFolder = oPane.AddBrowserFolder("My Occurrence Folder", oOccurrenceNodes)
End Sub
How do I get the files added to an existing " My Occurrence Folder" rather than creating a new one. Every time I run the code a new folder is created, it does not use the exisitng one
cheers
Matt
Hi Matt,
How about using "BrowserFolder.Add" Method.
You should be able to retrieve an existing BrowserFolder by parsing the browser nodes and use "BrowserNode.BrowserFolders" property to acess it.
Please refer to the Help Files for more details about those APIs.
Hi Philippe,
Can you please post an example iLogic code using the "BrowserFolder.Add" method? I am using iLogic to place components then move then to a folder, and I can't figure out how to add component occurrences to a specific folder.
Thanks,
Paul
I know this is an old topic, but I was searching for this solution and it was lacking the requested sample.
Here is the sample that works for me. I hope someone else can also benefit from this "late" response.
' get the model browser pane Dim oPane As BrowserPane oPane = oAssemblyDoc.BrowserPanes.Item("Model") ' Create a Browser node object from an existing object Dim oNode As BrowserNode oNode = oPane.GetBrowserNodeFromObject(oOccurrence) ' Add the node to the extra folder oPane.TopNode.BrowserFolders.Item("Extra").Add(oNode)
Can't find what you're looking for? Ask the community or share your knowledge.