BOM set Reference

BOM set Reference

jostroopers
Collaborator Collaborator
691 Views
8 Replies
Message 1 of 9

BOM set Reference

jostroopers
Collaborator
Collaborator

I have an assembly in which I have created 3 LOD, 1_Ruit, 2_Ruit, 3_Ruit.
With a text parameter 'Deling' and an iLogic code 'LOD' I can send the LOD so that components are suppressed.
However, if I look at the BOM, the suppressed parts are not set to Reference so that they are still counted in the BOM.
How do I use iLogic to set the suppressed components to Reference in the BOM?
I have tried several codes but am not an expert.

 

If Deling = "1_Ruit" Then
oOcc.BOMStructure "Tussenligger" = Reference
End If

 

If Deling = "1_Ruit" Then
oOcc.BOMStructure "Tussenruit" = Reference
End If

And so on.

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes
692 Views
8 Replies
Replies (8)
Message 2 of 9

MechMachineMan
Advisor
Advisor

Resource utilization is key to successful programming:

 

http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-F298DB7C-AB42-4AA9-B3F4-980A8BF78A01

 

 

All 3 below work (in their various cases). The best one for readability is the middle. The best one for performance (and avoiding issues) is the the bottom.

 

oOcc.BOMStructure = kReferenceBOMStructure

OR

oOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure

OR

oOcc.BOMStructure = 51972

 

 


--------------------------------------
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 3 of 9

jostroopers
Collaborator
Collaborator

Do i use that in this way?

 

If Deling = "1_Ruit" Then
oOcc.BOMStructure "Tussenruit" = 51972
End If

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes
Message 4 of 9

bradeneuropeArthur
Mentor
Mentor
Yes you do already.

oOcc.BOMStructure "Tussenruit" = 51972

The 51972 is the bottom one...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 9

MechMachineMan
Advisor
Advisor

No... you use it exactly as I typed it in:

 

If Deling = "1_Ruit" Then
    oOcc.BOMStructure = 51972
End If

If Deling = "1_Ruit" Then
    oOcc.BOMStructure = 51972
End If

--------------------------------------
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 6 of 9

clutsa
Collaborator
Collaborator

You're close. I think you're trying to do something more like

myPart = Component.InventorComponent("Tussenruit")
myPart.BOMStructure = 51972 'Reference
myPart.BOMStructure = 51969 'Default? I think

Also you could do a loop at the end like 

Dim doc As AssemblyDocument
doc = ThisDoc.Document
For Each oOcc In doc.ComponentDefinition.Occurrences
	If oOcc.Suppressed Then
		oOcc.BOMStructure = 51972 'reference
	Else
		oOcc.BOMStructure = 51969 'default
	End If
Next

 

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 7 of 9

jostroopers
Collaborator
Collaborator

@MechMachineMan

 

How dus the code know that "Tussenruit" has to go Reference.

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes
Message 8 of 9

MechMachineMan
Advisor
Advisor

The way I wrote it already implies that you have the occurrence you want assigned to the variable 'oOcc'.

@clutsa mentioned what you need to do to grab the occurrence in his post.


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

clutsa
Collaborator
Collaborator

Sorry that's what I was trying to clarify for you.

oOcc = Component.InventorComponent("Tussenruit")
If Deling = "1_Ruit" Then
    oOcc.BOMStructure = 51972 'reference
Else
    oOcc.BOMStructure = 51969 'default
End If

and if you don't want to declare each part that needs to be set to reference you could do the loop to set all parts that is suppressed to a referenced BOM.

Dim doc As AssemblyDocument
doc = ThisDoc.Document
For Each oOcc In doc.ComponentDefinition.Occurrences
	If oOcc.Suppressed Then
		oOcc.BOMStructure = 51972 'reference
	Else
		oOcc.BOMStructure = 51969 'default
	End If
Next

 

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes