Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ilogic Suppress components if BOM structure is set to reference

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
562 Views, 2 Replies

Ilogic Suppress components if BOM structure is set to reference

Hello.

Im working on this code to suppress components with BOM structure is set to reference.

It does'nt work.

Need help please.

Thank you.

 

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

Dim CompOcc As ComponentOccurrence 
For Each CompOcc In oAsmCompDef.Occurrences 
	If CompOcc.Definition.BOMStructure.kReferenceBOMStructure = True Then
		CompOcc.IsActive = False
	
	End If

Next 

 

Tags (3)
Labels (1)
2 REPLIES 2
Message 2 of 3
JelteDeJong
in reply to: Anonymous

try this:

Dim oAsmCompDef As AssemblyComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition

For Each CompOcc As ComponentOccurrence In oAsmCompDef.Occurrences
	' go to next occurence if its already suppressed
	If CompOcc.Suppressed = True Then
		Continue For
	End If

	'suppress when the bom structure is set in the part/assembly
	If CompOcc.Definition.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then
		CompOcc.Suppress()
	End If

	'suppress when the bom structure is set in the assembly occurrence
	If (CompOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure) Then
		CompOcc.Suppress()
	End If
Next

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 3
marcin_otręba
in reply to: Anonymous

try:

 

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

Dim CompOcc As ComponentOccurrence 
For Each CompOcc In oAsmCompDef.Occurrences 
	If CompOcc.BOMStructure = kReferenceBOMStructure Then
		CompOcc.Suppress
	End If

Next 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report