Structured BOM

Structured BOM

Anonymous
Not applicable
1,637 Views
11 Replies
Message 1 of 12

Structured BOM

Anonymous
Not applicable

I want to get the structured BOMView.  I tried as below but when I go through the rows it isn’t the structured. I get the same as is shown in Model Data in Inventor.  What am I doing wrong?

 

' Set a reference to the BOM

Dim oBOM As BOM

oBOM = m_oInvAssDoc.ComponentDefinition.BOM

 

' Make sure that the structured view is enabled.

oBOM.StructuredViewEnabled = True

 

'Set a reference to the "Structured" BOMView

Dim oBOMView As BOMView

oBOMView = oBOM.BOMViews.Item("Structured")

 

Autodesk Inventor Professional 2013 SP 1.1

0 Likes
1,638 Views
11 Replies
Replies (11)
Message 2 of 12

YuhanZhang
Autodesk
Autodesk

Can you double check that the model data and the structured BOM view have different values/cells?



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 12

Anonymous
Not applicable

I’ve added more of the code. I’ve also attached a picture of my BOM and the resulting list from the code. As you see it’s equal to Model Data BOM. I had expected to get the list equal to the structured BOM.

 

 

   

PrivateSub findStructuredDrawingList()

       

' Set a reference to the BOM

       

Dim oBOM AsBOM

        oBOM = m_oInvAssDoc.ComponentDefinition.BOM

       

' Make sure that the structured view is enabled.

        oBOM.StructuredViewEnabled =

True

       

'Set a reference to the "Structured" BOMView

       

Dim oBOMView AsBOMView

        oBOMView = oBOM.BOMViews.Item(

"Structured")

        oBOMView.Sort(

"Item")

       

Call getStructuredDrawingList(oBOMView.BOMRows)

   

EndSub

   

PrivateSub getStructuredDrawingList(ByVal oBOMRows AsBOMRowsEnumerator)

       

' Iterate through the contents of the BOM Rows.

       

Dim i AsLong

       

Dim oPartProperty As Inventor.Property

       

Dim sPartNumber AsString : sPartNumber = ""

       

Dim sDrawingList AsString : sDrawingList = ""

       

For i = 1 To oBOMRows.Count

           

' Get the current row.

           

Dim oRow AsBOMRow

            oRow = oBOMRows.Item(i)

           

'Set a reference to the primary ComponentDefinition of the row

           

Dim oCompDef AsComponentDefinition

            oCompDef = oRow.ComponentDefinitions.Item(1)

 

           

' Get part number properties strings for the first part.

            oPartProperty = oCompDef.Document.PropertySets.Item(

"Design Tracking Properties").Item("Part Number")

            sPartNumber = oPartProperty.Value.ToString

sDrawingList = sDrawingList & sPartNumber & vbNewLine

            frmDrawingList.txtDrawingList.Text = sDrawingList

           

frmDrawingList.Show()

       

Next

   

EndSub

0 Likes
Message 4 of 12

YuhanZhang
Autodesk
Autodesk

I double checked this issue and found it was already reported as an API bug, you can query the status of the bug with providing the ID 1291792. Sorry for any inconvenience.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 5 of 12

mslosar
Advisor
Advisor

Where do you go to query the bug number?

0 Likes
Message 6 of 12

YuhanZhang
Autodesk
Autodesk
You can either contact our product support if you are in ADN(Autodesk Development Network) or raise this here to get its status. The bug is still open. If you have business case for this bug please contact our product support.


If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 7 of 12

mslosar
Advisor
Advisor

Doubt that I have standing - i've just encountered the same bug and was wondering if it was fixed. Apparently not 🙂

 

Thanks.

0 Likes
Message 8 of 12

Anonymous
Not applicable
After more than one year I have the same problem here using Inventor 2015 SP1, Update 3 (Bulid 203). Why is this minor problem not fixed after two years?
0 Likes
Message 9 of 12

danmorick
Enthusiast
Enthusiast

I am still having this problem with Inventor 2016 SP1.  Despite calling the Structured BOM I get the order of the Model Data BOM.  This seems like a major issue to me.  It's been about 5 years; do we have any progress on this?

0 Likes
Message 10 of 12

MechMachineMan
Advisor
Advisor

This almost seems as if it might have been by intent and that they are lacking the minor functionality as people would think of it.

 

Instead of having multiple collections for each BOM View, they just have 1. And it's called  a VIEW because it's just that; the way you look at the BOM.

 

Calling the enumerator of the BOM collection isn't specific to any view; it's to how it's organized in the collection.

 

If you want to output a list that mimics what you see in the different views, you have to manually create the algorithm that outputs it in that fashion.

 

Ie;

 

If you want a BOM list to be output by item number (as you might see it in structured), you can access the item number within the Structured view and print the list by checking to ensure that the number of the current row is the next in your series to output. Likewise, this can be done for other entries.

 

I think it's more or less a memory thing, rather than lacking functionality. Mind you, they could likely fix this simply by adding more elements to the BOM that specify what order it appears in the desired BOM view, and just query/return that value.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 11 of 12

A_Sandbote
Contributor
Contributor

Hello,

i think this issue is still be unfixed... i just get in trouble with this wrong sortet BOM View...
have you any news ?

 

Thanks for any information about the case !

 

regards Andreas

0 Likes
Message 12 of 12

YuhanZhang
Autodesk
Autodesk

Hi Andreas,

 

I checked the status of the defect, it is fixed in Inventor 2018, can you check it with the Inventor? Please let me if any more questions.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes