Sort model data to structured BOM data

Sort model data to structured BOM data

dschulteHR4D5
Advocate Advocate
86 Views
1 Reply
Message 1 of 2

Sort model data to structured BOM data

dschulteHR4D5
Advocate
Advocate

Hello, have been looking around and not coming across much, have been piecing together various codes to see if I can get it to work but not able to get it. But I am wondering if there is a way to take the Structured list in BOM, and sort the assembly model data in the browser to re order the items to match the structured tab. 

0 Likes
87 Views
1 Reply
Reply (1)
Message 2 of 2

daltonNYAW9
Advocate
Advocate

What your after is the BrowserPane.Reorder 

Tried messing around with it a bit and got it working, but you may need to troubleshoot it. (i.e. it doesnt work well with folders)

 

Dim oADoc As AssemblyDocument = ThisDoc.Document

'Dim oTopOccurrence As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select Top Node")

Dim oBOM As BOM = oADoc.ComponentDefinition.BOM

Dim oBOMView As BOMView = oBOM.BOMViews.Item("Structured")

Dim oModelBrowserPane As BrowserPane = oADoc.BrowserPanes.Item("Model")

Dim oBrowserNodeList As New List(Of BrowserNode)

For Each oRow As BOMRow In oBOMView.BOMRows
	For Each oOcc As ComponentOccurrence In oRow.ComponentOccurrences
		oBrowserNode = oModelBrowserPane.GetBrowserNodeFromObject(oOcc)
		oBrowserNodeList.Add(oBrowserNode)
	Next
Next

oBrowserNode = oBrowserNodeList.Item(1)

'oModelBrowserPane.Reorder(oBrowserNode, True, oModelBrowserPane.GetBrowserNodeFromObject(oTopOccurrence))

For Each oBrowserNode1 As BrowserNode In oBrowserNodeList
	oModelBrowserPane.Reorder(oBrowserNode, False, oBrowserNode1)
	oBrowserNode = oBrowserNode1
Next

 

0 Likes