Is there a way to set an assemblies bill of material setting to reference through iLogic?
Solved! Go to Solution.
Solved by Shawn_79. Go to Solution.
I have used the following code with parts (mainly virtual parts). I did a quick test and it appears to also work with assemblies.
I have also included the line of code to set the BOM structure back to default.
=======================================
doc = ThisDoc.Document 'This line only needs to appear once in the rule
vPart:1 = Component.InventorComponent("Part:1") 'This line is only required once per virtual part
'vPart:1.BOMStructure = BOMStructureEnum.kReferenceBOMStructure 'Sets BOM Structure to Reference (Remove from BOM)
'vPart:1.BOMStructure = BOMStructureEnum.kDefaultBOMStructure 'Sets BOM Structure to Default (Includes on BOM)
==========================================
-Shawn
Hi
I would like to change between reference and purchased but if I replace (kDefaultBOMStructure) with (kPurchasedBOMStructure) I get an error message E_InvalidAug any idea how to fix this? I have sixteen different instances of the assembly that I am changing what is the best way to index through them?
The way I use the code it only controls the BOM strucuture at the parent assembly level (think of it as an assembly level override.) So, in your case the BOM strucure at the child assembly would be set to purchased. At the parent level you only have two choices; default and reference. Reference would remove it from the BOM and default would use the default BOM structure (purchase in this example.) The manual version of this process is to right click on the assembly in the model browser and change the BOM structure (see attachment.)
This method controls the BOM structure of each instance. It would be possible to have the same assembly inserted several times with different BOM structures. If you go back to the child assembly to make the change it then would change for all instances.
-Shawn