Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

3 REPLIES 3
Reply
Message 1 of 4
pkquat
499 Views, 3 Replies

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

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
3 REPLIES 3
Message 2 of 4
cadfish1
in reply to: pkquat

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
Message 3 of 4
pkquat
in reply to: pkquat

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
Message 4 of 4
pkquat
in reply to: pkquat

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report