How to I get QTY of Each componemt with Ilogic?

How to I get QTY of Each componemt with Ilogic?

Darkforce_the_ilogic_guy
Advisor Advisor
300 Views
2 Replies
Message 1 of 3

How to I get QTY of Each componemt with Ilogic?

Darkforce_the_ilogic_guy
Advisor
Advisor

 I have this code.  I want it to show the total nummmer of each part/assembly  what am I missing or doing wrong?

 

Class BOMEXport
	Shared Row2 As Integer = 3
	Shared Stk 

Sub main()
	

	PossibleIssueReport()

End Sub



Sub PossibleIssueReport()
	


Row2 =3
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM

oBOM.StructuredViewEnabled = True
oBOM.StructuredViewFirstLevelOnly = False
oBOM.StructuredViewDelimiter = "."

oBOM.PartsOnlyViewEnabled = True

Dim oBOMView As BOMView
oBOMView = oBOM.BOMViews.Item("Structured")
debug("Call ExportToExcel")
Call ExportToExcel(oBOMView.BOMRows)
	
End Sub


Public Sub debug(txt As String)
	Trace.WriteLine("NTI : " & txt)
End Sub

Public Function ExportToExcel(brows As BOMRowsEnumerator)
	
Dim brow As BOMRow
For Each brow In brows
	AssemblyFeature =""
Dim rDoc As Document
rDoc = brow.ComponentDefinitions.Item(1).Document

Dim docPropertySet As PropertySet
docPropertySet = rDoc.PropertySets.Item("Design Tracking Properties")

Dim docPropertySet1 As PropertySet
docPropertySet1 = rDoc.PropertySets.Item("User Defined Properties")
Dim docPropertySet2 As PropertySet

docPropertySet2 = rDoc.PropertySets.Item("User Defined Properties")

Dim docPropertySet3 As PropertySet

docPropertySet3 = rDoc.PropertySets.Item("User Defined Properties")
'item , part number, qty, description, G_L (Custom), Raw material, Status (Custom)
'debug(" what is the row number now " & Row)



	oHoleRepportExcel = oHoleRepportExcel & docPropertySet.Item("Part Number").Value & "	" & docPropertySet.Item("Description").Value  & " QTY " & docPropertySet3.Item("QTY").Value  & vbLf 
	


Next

MessageBox.Show(oHoleRepportExcel , "Title")






End Function
End Class

 

 

 

0 Likes
Accepted solutions (1)
301 Views
2 Replies
Replies (2)
Message 2 of 3

SevInventor
Advocate
Advocate
Accepted solution

have You tried?

 

brow.ItemQuantity

 For example like this:

 

 

        Dim oDoc As AssemblyDocument
        oDoc = ThisApplication.ActiveDocument
        Dim oBOM As BOM
        oBOM = oDoc.ComponentDefinition.BOM

        
        Dim brow As BOMRow
        For Each brow In oDoc.ComponentDefinition.BOM.BOMViews.Item(1).BOMRows
			QTY = brow.ItemQuantity
			
			MsgBox(QTY)
			next
Message 3 of 3

Darkforce_the_ilogic_guy
Advisor
Advisor

Yes that is what I end up using 🙂 fund it 3 days ago 🙂 but Thanks for writte it so I could close this tread 🙂😀