How do I get the full path filename from the BOM?

How do I get the full path filename from the BOM?

Anonymous
Not applicable
670 Views
3 Replies
Message 1 of 4

How do I get the full path filename from the BOM?

Anonymous
Not applicable
In the BOM Editor one of the columns is "File Path" which gives the full path and the filename of each of the files used in the assembly. I can't find how to access this in a macro. I have been able to access various iProperties, but don't know where to look for the "File Path" information.

Pete
0 Likes
671 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
oDoc could be defined as either ApprenticeServerDocument, Document or AssemblyDocument but the document better be an assembly.

{code}
Dim sFile As String
Dim oCompOccurrence As ComponentOccurrence
For Each oCompOccurrence In oDoc.ComponentDefinition.Occurrences
sFile = oCompOccurrence.Definition.Document.FullFileName
Next
{code} Edited by: Cadfish1 on Apr 7, 2009 6:20 PM
0 Likes
Message 3 of 4

Anonymous
Not applicable
TY,

I got it close. I needed to re Dim and set oDoc to be able to read the FullFilename. The issue now is the indexes do not match up, ie the filenames do not match the part numbers. I think I need to access the FullFileName via the BOMRow, but I haven't found that yet.

{code}

Private Sub QueryBOMRowProperties(oBOMRows As BOMRowsEnumerator, ItemTab As Long)

Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument

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 oCompOcc As ComponentOccurrence
Set oCompOcc = oDoc.ComponentDefinition.Occurrences.Item(i)

Dim FFileRow As String

'Get the Full Path Filename
FFileRow = oCompOcc.Definition.Document.FullFileName

'There is other code here to get the Item Number, P/N, Qty, etc. and previous info to open the file.

Write #1, oRow.ItemNumber; oPartNumProperty.Value; oRow.ItemQuantity; FFileRow

Next

{code}

Edited by: pkquat on Apr 7, 2009 3:00 PM Edited by: pkquat on Apr 7, 2009 4:24 PM
0 Likes
Message 4 of 4

Anonymous
Not applicable
Actually it was easier than I was thinking.

All needed was a line:

FFileRow = oCompDef.Document.FullFileName

With my same start.

{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)

'Additional code and the FFileRow line.

{code}

TY again. It got me pointed in the right direction, and was a learning experience.
0 Likes