Can't check .BOMStructure in current Inventor's Operation both Part's & Assembly's Documents

Can't check .BOMStructure in current Inventor's Operation both Part's & Assembly's Documents

ngdnam88
Advocate Advocate
325 Views
2 Replies
Message 1 of 3

Can't check .BOMStructure in current Inventor's Operation both Part's & Assembly's Documents

ngdnam88
Advocate
Advocate

Hello Everyone,

I'm trying working on a simple iLogic Code:

Dim nDOC As Document = ThisApplication.ActiveDocument
MessageBox.Show(nDOC.ComponentDefinition.BOMStructure, "Checking?", MessageBoxButtons.OK, MessageBoxIcon.Information)

And a similar

Dim nDOC As Document = ThisDoc.Document
MessageBox.Show([Enum].GetName(GetType(Inventor.BOMStructureEnum), nDOC.ComponentDefinition.BOMStructure), "Checking?", MessageBoxButtons.OK, MessageBoxIcon.Information)

 My problem: When I open Inventor with new session, and working with an assembly - the ilogic code run in the correct result, but when I created a new part and run the rule - I got the problem!. Its also happened if I started with Part first and then created a new assembly (the rule only applied with the first document's type/Inventor's session)

001.PNG

002.PNG

I'm using Inventor 2018.3.8 Updated, I checked, the problem same for previous version of Inventor. with Version 2020, the Rule runs in the correctly!!!

Please, help me. I really posted: https://forums.autodesk.com/t5/inventor-customization/how-to-get-and-change-quot-default-bom-structu... . Thanks!

0 Likes
326 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Try using this code, and see if it makes any difference for you.

I tried this on a fresh new assembly document, and a fresh new part document, before saving or doing any thing else to the file, and it worked for me.

Dim oBOMSt As BOMStructureEnum = ThisApplication.ActiveDocument.ComponentDefinition.BOMStructure
MsgBox("BOM Structure Name = " & oBOMSt.ToString & vbCrLf & _
"BOM Structure Value = " & oBOMSt.GetHashCode , vbOKOnly + vbInformation, "BOM Structure")

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

ngdnam88
Advocate
Advocate

Thanks @WCrihfield 

I still have same problem. The iLogic code is very good for Inventor 2019 and Up.

I think, it relative to version of Inventor and the Code

ThisApplication.ActiveDocument.ComponentDefinition.BOMStructure

Is there any new syntax/way to definition?

0 Likes