0% found this document useful (0 votes)
141 views1 page

BOM-item Ilogic

This VBA code iterates through all sheets and views in a drawing document. For each view, it compares the file name of the referenced 3D model to the file names in the parts list on the sheet. If a match is found, it retrieves the "Pos" value from the matching parts list row and adds it to the view label, formatting it with XML tags.

Uploaded by

dutt4190
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views1 page

BOM-item Ilogic

This VBA code iterates through all sheets and views in a drawing document. For each view, it compares the file name of the referenced 3D model to the file names in the parts list on the sheet. If a match is found, it retrieves the "Pos" value from the matching parts list row and adds it to the view label, formatting it with XML tags.

Uploaded by

dutt4190
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Dim oDrawDoc As DrawingDocument

oDrawDoc = ThisApplication.ActiveDocument
Dim oSheets As Sheets
Dim Sheet As Inventor.Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
For Each oSheet In oDrawDoc.Sheets
oViews = oSheet.DrawingViews
For Each oView In oViews
Dim oModelFileName As String
oModelFileName =
oView.ReferencedDocumentDescriptor.ReferencedDocument.FullFileName
Dim oPartList As PartsList
Try
oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
Catch
Dim i As Long
For i = 1 To oDrawDoc.Sheets.Count
If oDrawDoc.Sheets.Item(i).PartsLists.Count > 0 Then Exit For
Next
oPartList = oDrawDoc.Sheets.Item(i).PartsLists.Item(1)
End Try
Dim j As Long
For j = 1 To oPartList.PartsListRows.Count

Dim oRow As PartsListRow


oRow = oPartList.PartsListRows.Item(j)

Dim oRowFileName As String


oRowFileName = oRow.ReferencedFiles.Item(1).FullFileName

If StrComp(oModelFileName, oRowFileName, CompareMethod.Text)=0 Then

oCell = oPartList.PartsListRows.Item(j).Item("Pos")

Dim oItemValue As String


oItemValue = oCell.Value

oView.ShowLabel = True

oStringItem = "<StyleOverride Underline='False'


FontSize='0.35'> Pos " & oItemValue & " </StyleOverride>"

oView.Label.FormattedText = oStringItem '& oStringScale


End If
Next
Next
Next

You might also like