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: 

How do I deactivate all instances of a component in a pattern?

1 REPLY 1
Reply
Message 1 of 2
Anonymous
322 Views, 1 Reply

How do I deactivate all instances of a component in a pattern?

I have a few components in my assenbly that I want to turn off under certain conditions.  Using Component.IsActive, I can turn on or off an instance, but some of the components are in a pattern, and I want to turn on or off all instances of the component.  To add to the challenge, the component patters are driven from Excel, aand the quantity of parts changes.

 

How can I turn off all of the instances of a pattern?

 

1 REPLY 1
Message 2 of 2
jdkriek
in reply to: Anonymous

This is a method for suppressing all the occurrences within a pattern. In this example, we are looking at one single pattern, but in reality for your needs (im assuming) you would need to iterate over all patterns or at least use the selected pattern, then iterate over all occurrences of the component within those pattern(s) and suppress it. If you cannot derive how to do this from the example, I'll help you.

 

Public Sub SupressOcc()

Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oPattern As OccurrencePattern
Set oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("PatternName")

Dim oPatternElement As OccurrencePatternElement
For Each oPatternElement In oPattern.OccurrencePatternElements
	Dim oOcc As ComponentOccurrence
		For Each oOcc In oPatternElement.Occurrences
			oOcc.Suppress
		Next
	Next
End Sub 

 

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


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

Post to forums  

Autodesk Design & Make Report