Phantom cause error in my I logic code , is there a way to fix it ?

Phantom cause error in my I logic code , is there a way to fix it ?

Darkforce_the_ilogic_guy
Advisor Advisor
377 Views
3 Replies
Message 1 of 4

Phantom cause error in my I logic code , is there a way to fix it ?

Darkforce_the_ilogic_guy
Advisor
Advisor

I am Looping through an assambly  bom Stuctured , with Ilogic to get date form the componemt/part Assambly  but if someone have use Phantom I get this error. Is there a way to get it to work  ?kinder of workaround ?

 

bt_0-1617095699188.png

 

0 Likes
378 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor

Hello

 

Can you explain a little bit more detailed. You traverse through the rows of the structured BOMView. What do you try to get from the BOMRow?

There is a property "Promoted" who's value is true if the BOMRow is promoted e.g. by a parent subassembly is a phantom, otherwise it's false.


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 4

Darkforce_the_ilogic_guy
Advisor
Advisor
I am trying to get information (properties form the BOM to excel ) and to see if the model have a drawing and a lot more. The project is very complete but I think most of it will just to noise. To add here. The code just error then it try to get data form files that are part of an phantom assembly
0 Likes
Message 4 of 4

Ralf_Krieg
Advisor
Advisor

Hello

 

And what kind of infomation did you try to access? If you can't give detailed information, the only solution would be that you strip your code down to the failing part by yourself until you found it or enclose your failing part code in a try-catch statement to suppress the error messages.

As an example i traverse through the structured BOM view, get item number, quantity and two iProps for each row and write it to the iLogic logger. Even if there are promoted parts in the BOM view, no error is raised. Can you confirm that with your assembly or is it failing also?

Sub Main()
	BOMDemo()	
End Sub

Private Sub BOMDemo()

	'Makro assumes:
	'- an assemblydocument is open
	'- the structured BOM view is activated
	
	
	
	Dim oApp As Inventor.Application
	oApp = ThisApplication

	Dim oAssDoc As AssemblyDocument
	oAssDoc = oApp.ActiveDocument

	Dim oBOM As BOM
	oBOM = oAssDoc.ComponentDefinition.BOM

	oBOM.StructuredViewEnabled = True

	Dim oBOMView As BOMView
	For Each oBOMView In oBOM.BOMViews
		If oBOMView.ViewType = BOMViewTypeEnum.kStructuredBOMViewType Then Exit For
	Next
	
	If oBOMView Is Nothing 
		MsgBox("BOMView not found", , "iLogic")
		Exit Sub
	End If

	Dim oBOMRow As BOMRow

	'BOM headline
	Logger.Info("Item | Quantity | Part Number | Description")
	Logger.Info("-------------------------------------------")
	
	'read all BOM rows
	For Each oBOMRow In oBOMView.BOMRows
	    Logger.Info(" " & oBOMRow.ItemNumber & "     | " & oBOMRow.ItemQuantity & "           | " & oBOMRow.ComponentDefinitions.Item(1).Document.PropertySets.Item("{32853F0F-3444-11D1-9E93-0060B03C1CA6}").Item("Part Number").Value & "  |  " & oBOMRow.ComponentDefinitions.Item(1).Document.PropertySets.Item("{32853F0F-3444-11D1-9E93-0060B03C1CA6}").Item("Description").Value)
		If oBOMRow.ChildRows IsNot Nothing Then TraverseBOM(oBOMRow.ChildRows)
	Next

End Sub

Private Sub TraverseBOM(oBOMRows As BOMRowsEnumerator)
	Dim oBomRow As BOMRow
	For Each oBomRow In oBOMRows
		Logger.Info(" " & oBomRow.ItemNumber & "     | " & oBomRow.ItemQuantity & "           | " & oBomRow.ComponentDefinitions.Item(1).Document.PropertySets.Item("{32853F0F-3444-11D1-9E93-0060B03C1CA6}").Item("Part Number").Value & "  |  " & oBomRow.ComponentDefinitions.Item(1).Document.PropertySets.Item("{32853F0F-3444-11D1-9E93-0060B03C1CA6}").Item("Description").Value)
		If oBOMRow.ChildRows IsNot Nothing Then TraverseBOM(oBOMRow.ChildRows)
	Next
End Sub

R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes