Hi,
Just come up against a requirement, i'm not sure where to start and would appreicated any help
In its simplest form the problem is
We have a multi-sheet IDW for a product
Sheet 1 contains the assembly
Sheet 2 contains the BOM or parts list if you like
Sheets 3 onwards contain the individual part details
Using VBA, can we process the parts in the Bom, scaning through the sheets in the set and place a reference to the sheet number it is detailed on in a custom column in the BOM?
Any guidance would be appreciated
Regards
Mark
INV Pro 2014
Please more details, i'm seeing similar scenario as i do have. Need to know what you need.Thanks to all this people here i'm sure you'll find what you looking.
Hi All
We have a similar requirement:
We are using multi-sheet IDW’s for all products
Sheet 1 contains the assembly and BOM
Sheet 2 contains a sub-assembly (if applicable)
Sheets 3 onwards contain any other subassemblies (if any) and then the individual part details
The BOM on page 1 contains the reference column and we indicate the corresponding sheet with the details of the respective part or subassembly; that helps the workshop to find quickly the required drawing to manufacture a certain part or to put together a subassembly or weldment. If we have sheet metal parts we refer to a different drawing set that usually contains all profiles required for that particular product.
Can we automate somehow Inventor to fill in the correct sheet number where a part or a subassembly is detailed?
Thank you!
Alex
Step 1. The sub Filenames_From_Sheets() prints filenames associated with every sheet in the active drawing document.
Sub Filenames_From_Sheets() 'prints filenames associated with every drawing sheet Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Dim oView As DrawingView Dim filename As String Dim i As Integer For i = 1 To oDrawDoc.Sheets.Count Set oSheet = oDrawDoc.Sheets.Item(i) Debug.Print "Sheet: " + CStr(i) For Each oView In oSheet.DrawingViews If Not oView.ParentView Is Nothing Then GoTo next_View If oView.ViewType = DrawingViewTypeEnum.kProjectedDrawingViewType Then GoTo next_View filename = oView.ReferencedDocumentDescriptor.ReferencedFileDescriptor.FullFileName Debug.Print filename 'here add sheet number i to the list for the filename 'No duplicates allowed! next_View: Next Next i Beep End Sub
Step 2. The sub Filenames_Ftom_PartsList() prints filenames associated with every PartsList row in the first PartsList on the 1st sheet in the active drawing document.
Sub Filenames_Ftom_PartsList() ' prints filenames associated with every PartsList row in the 1st sheet Dim oDoc As DrawingDocument Set oDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Set oSheet = oDoc.Sheets.Item(1) 'reference to the 1st parts list Dim oPartsList As PartsList Set oPartsList = oSheet.PartsLists.Item(1) 'collection of all rows Dim oRows As PartsListRows Set oRows = oPartsList.PartsListRows Debug.Print "Rows Count: "; oRows.Count Dim oRow As PartsListRow Dim oDrawingBOMRow As DrawingBOMRow Dim oBOMRow As BOMRow Dim i As Integer For i = 1 To oRows.Count Set oRow = oRows.Item(i) For Each oDrawingBOMRow In oRow.ReferencedRows Set oBOMRow = oDrawingBOMRow.BOMRow If Not (oBOMRow Is Nothing) Then If Not (oBOMRow.ReferencedFileDescriptor Is Nothing) Then Debug.Print "Row: " + CStr(i) + " " + oBOMRow.ReferencedFileDescriptor.FullFileName End If End If Next Next i End Sub
Two lists {PartsList row number – filename} and {Sheet number - filenames} allows you to create the desired list {PartsList row number – Sheet numbers} and then to fill the custom column in the PartsList with sheet numbers.
Hope this could help.