03-05-2021
01:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-05-2021
01:25 AM
Hi everyoone
I searched through the forum but i did not find any related info.
I adapted an existing ilogic code to find all screws, bolt, nuts and washer from content center and moving to a folder in the browser tree. It works like a charm but i would also move this folder under the "origin" folder.
I used the reorder method but i encounter a unspecified error. Someone can helpme?
here the error
'define folder name to use
sFolder = "VITERIE"
'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 oOcc.DefinitionDocumentType=kPartDocumentObject Then
If oOcc.Definition.IsContentMember Then
Dim Opartdef As PartcomponentDefinition
Opartdef = oOcc.Definition
Dim oObjPart As PartDocument
oObjPart = Opartdef.Document
Dim invDesignInfo As PropertySet
invDesignInfo = oObjPart.PropertySets.Item("Design Tracking Properties")
If Left(invDesignInfo.Item("Description").Value,3) = "VIT" Or Left(invDesignInfo.Item("Description").Value,3) = "DAD" Or Left(invDesignInfo.Item("Description").Value,3) = "ROS" Or Left(invDesignInfo.Item("Description").Value,3) = "RON" Then
'get browser node of occurence
Dim oNode As BrowserNode
oNode = oPane.GetBrowserNodeFromObject(oOcc)
'add node to collection
oCollection.Add(oNode)
End If
End If
End If
Next
' recreate folder
'And add collection To folder
oFolder = oPane.AddBrowserFolder(sFolder,oCollection)
Dim oNNode As BrowserNode
oNNode = oFolder.BrowserNode
Dim oDocNode As BrowserNode
oDocNode = oPane.TopNode
Dim oPosNode As BrowserNode
Dim oInizNode As BrowserNode
For Each oInizNode In oDocNode.BrowserNodes
If oInizNode.FullPath.Contains("Origine") Then
oPosNode = oInizNode
End IF
Next
' ' Move the folders to upper of oFirstOccurrenceNode
oPane.Reorder(oPosNode,False,oNNode)
Solved! Go to Solution.