iLogic - Change BOM Structure from Default(Reference)

iLogic - Change BOM Structure from Default(Reference)

Anonymous
Not applicable
2,282 Views
1 Reply
Message 1 of 2

iLogic - Change BOM Structure from Default(Reference)

Anonymous
Not applicable

Context:

Inventor 2016, In an assembly, using iLogic, changing the BOM structure.

 

Code:

 

'Sets BOM Structure to Default (Remove from BOM)
Component.InventorComponent("Hardware (1):1").BOMStructure = BOMStructureEnum.kDefaultBOMStructure
ThisDoc.Save

Problem:

When I use iLogic to change the BOM structure of a component from Reference to Default I get the following situation

 

BOMproblem.png

 

It shows as Default(Reference) in the browser, and still reference in the BOM. It should be Default in both.

 

BOMproblem2.png

 

Anyone encountered this problem before? Any help would be much appreciated!

 

Cheers,

Ben

 

0 Likes
Accepted solutions (1)
2,283 Views
1 Reply
Reply (1)
Message 2 of 2

MechMachineMan
Advisor
Advisor
Accepted solution

No, that is as expected.

 

 

What you see in the BOM is the DOCUMENT BOM Structure settings that is applied as the default you see in the right click context menu.

 

The right click context menu is for the OCCURRENCE BOM Structure and will only change the BOM Structure of the occurrence.

 

In order to change the document BOM Structure, you need to access the document object rather than just the occurrence.

 

This can be done by something like...

 

 

ThisApplication.ActiveDocument.Occurrences.OccurrenceByName("OccurrenceName").Defintion.Document.BOMStructure.

 

Use the inventor Programming help as found through the inventor window by the "x" and it will eventually lead you to the right syntax.


--------------------------------------
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