Message 1 of 1
Can I get the Parent P/N from a BOM row in a BOM?

Not applicable
04-07-2009
04:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I noticed there is a "Parent" Property under the BOM Row Members. I am not sure how to use it (format it) to get the Parent Part Number from a structured BOM.
To get the other BOM properties, I cam using the following code. I would like to also write the parent part number to the file.
{code}
Private Sub QueryBOMRowProperties(oBOMRows As BOMRowsEnumerator, ItemTab As Long)
ItemTab = ItemTab + 3
' Iterate through the contents of the BOM Rows.
Dim i As Long
For i = 1 To oBOMRows.Count
' Get the current row.
Dim oRow As BOMRow
Set oRow = oBOMRows.Item(i)
'Set a reference to the primary ComponentDefinition of the row
Dim oCompDef As ComponentDefinition
Set oCompDef = oRow.ComponentDefinitions.Item(1)
Dim oPartNumProperty As Property
Dim oDescProperty As Property
'Get the file property that contains the "Part Number"
Set oPartNumProperty = oCompDef.Document.PropertySets _
.Item("Design Tracking Properties").Item("Part Number")
'Get the file property that contains the "Description"
Set oDescProperty = oCompDef.Document.PropertySets _
.Item("Design Tracking Properties").Item("Description")
Write #1, oRow.ItemNumber; oPartNumProperty.Value; oRow.ItemQuantity; _
oDescProperty.Value
If Not oRow.ChildRows Is Nothing Then
Call QueryBOMRowProperties(oRow.ChildRows, ItemTab)
End If
Next
{code}
To get the other BOM properties, I cam using the following code. I would like to also write the parent part number to the file.
{code}
Private Sub QueryBOMRowProperties(oBOMRows As BOMRowsEnumerator, ItemTab As Long)
ItemTab = ItemTab + 3
' Iterate through the contents of the BOM Rows.
Dim i As Long
For i = 1 To oBOMRows.Count
' Get the current row.
Dim oRow As BOMRow
Set oRow = oBOMRows.Item(i)
'Set a reference to the primary ComponentDefinition of the row
Dim oCompDef As ComponentDefinition
Set oCompDef = oRow.ComponentDefinitions.Item(1)
Dim oPartNumProperty As Property
Dim oDescProperty As Property
'Get the file property that contains the "Part Number"
Set oPartNumProperty = oCompDef.Document.PropertySets _
.Item("Design Tracking Properties").Item("Part Number")
'Get the file property that contains the "Description"
Set oDescProperty = oCompDef.Document.PropertySets _
.Item("Design Tracking Properties").Item("Description")
Write #1, oRow.ItemNumber; oPartNumProperty.Value; oRow.ItemQuantity; _
oDescProperty.Value
If Not oRow.ChildRows Is Nothing Then
Call QueryBOMRowProperties(oRow.ChildRows, ItemTab)
End If
Next
{code}