Message 1 of 36

Not applicable
11-01-2016
06:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Autodesk community!
does anyone know how to get the total number of a part from a top assembly down to a drawing?
I already have a solution to the question. BUT, i cannot force inventor to count sub-assemblies. any help would be amazing.
With kind regards, Mikael Nanke
Here is my code:
SyntaxEditor Code Snippet
doc = ThisDoc.Document Dim oAssyDef As AssemblyComponentDefinition = doc.ComponentDefinition oAssyDef.RepresentationsManager.LevelOfDetailRepresentations("Master").Activate Dim oBOM As BOM = oAssyDef.BOM oBOM.PartsOnlyViewEnabled = True Dim oBOMView As BOMView = oBOM.BOMViews.Item("Parts Only") Dim oBOMRow As BOMRow For Each oBOMRow In oBOMView.BOMRows 'Set a reference to the primary ComponentDefinition of the row Dim oCompDef As ComponentDefinition oCompDef = oBOMRow.ComponentDefinitions.Item(1) Dim CompFullDocumentName As String = oCompDef.Document.FullDocumentName Dim CompFileNameOnly As String Dim index As Integer = CompFullDocumentName.lastindexof("\") CompFileNameOnly = CompFullDocumentName.substring(index+1) 'MessageBox.Show(CompFileNameOnly) Dim Qty As String Try Qty = oBOMRow.ItemQuantity Catch MessageBox.Show("Kunne ikke til f�je Part antal til CompFileNameOnly", "Title") End Try iProperties.Value(CompFileNameOnly, "Custom", "PartQty") = Qty Next
Solved! Go to Solution.