Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

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: 

Supressing Assembly Patterns Elements

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

Supressing Assembly Patterns Elements

I have an assembly I am making 'intelligent'. I would like to pattern a sub-assembly to create different configurations. ie, double, triple, L-shape, T-shape. I have a form linked to text user parameters, which link to the pattern and elements being suppressed.

 

With the route I have gone down, its gets stuck because the pattern number essentially ends up the same in some cases so the suppressions then get confused I think.

 

Would it be better to use a 'place' command to create the configurations perhaps? Or a way of differentiating between pattern number per configuration?

 

See rule below:

 

	Dim oDoc As AssemblyDocument
		oDoc = ThisApplication.ActiveDocument

	'reference the pattern in the assembly 
	Dim oPattern As OccurrencePattern
		
	'calls the pattern by name
	oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("SPILL SHAPE") 
'********************************************************************************

	If SPILL_No = "1. SINGLE" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 1
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 1
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
		End Try
	End If
	
	If SPILL_No = "2. DOUBLE" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 2
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 1
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = False
		End Try
	End If
	
	If SPILL_No = "3. TRIPLE" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 3
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 1
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = False
			oPattern.OccurrencePatternElements(3).Suppressed = False
		End Try
	End If
	
	If SPILL_No = "4. QUAD" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 4
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 1
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = False
			oPattern.OccurrencePatternElements(3).Suppressed = False
			oPattern.OccurrencePatternElements(4).Suppressed = False
		End Try
	End If
	
	If SPILL_No = "5. FIVE" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 5
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 1
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = False
			oPattern.OccurrencePatternElements(3).Suppressed = False
			oPattern.OccurrencePatternElements(4).Suppressed = False
			oPattern.OccurrencePatternElements(5).Suppressed = False
		End Try
	End If
	
	If SPILL_No = "6. DOUBLE x2" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 2
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 2
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = False
			oPattern.OccurrencePatternElements(3).Suppressed = False
			oPattern.OccurrencePatternElements(4).Suppressed = False
		End Try
	End If
	
	If SPILL_No = "8. TRIPLE x3" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 3
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 3
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = False
			oPattern.OccurrencePatternElements(3).Suppressed = False
			oPattern.OccurrencePatternElements(4).Suppressed = False
			oPattern.OccurrencePatternElements(5).Suppressed = False
			oPattern.OccurrencePatternElements(6).Suppressed = False
			oPattern.OccurrencePatternElements(7).Suppressed = False
			oPattern.OccurrencePatternElements(8).Suppressed = False
			oPattern.OccurrencePatternElements(9).Suppressed = False
		End Try
	End If
	
	If SPILL_No = "9. L-SHAPE (LH)" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 3
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 2
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = False
			oPattern.OccurrencePatternElements(3).Suppressed = False
			oPattern.OccurrencePatternElements(4).Suppressed = True
			oPattern.OccurrencePatternElements(5).Suppressed = False
			oPattern.OccurrencePatternElements(6).Suppressed = True
		End Try
	End If
	
	If SPILL_No = "10. L-SHAPE (RH)" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 3
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 2
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = True
			oPattern.OccurrencePatternElements(3).Suppressed = False
			oPattern.OccurrencePatternElements(4).Suppressed = True
			oPattern.OccurrencePatternElements(5).Suppressed = False
			oPattern.OccurrencePatternElements(6).Suppressed = False
		End Try
	End If
	
	If SPILL_No = "11. T-SHAPE" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 3
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 2

		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = False
			oPattern.OccurrencePatternElements(2).Suppressed = True
			oPattern.OccurrencePatternElements(3).Suppressed = False
			oPattern.OccurrencePatternElements(4).Suppressed = False
			oPattern.OccurrencePatternElements(5).Suppressed = False
			oPattern.OccurrencePatternElements(6).Suppressed = True
		End Try
	End If

	
	If SPILL_No = "12. T-SHAPE (EXTENDED)" Then
		Parameter("DISTANCE1") = LENGTH+10
		Parameter("LEFT_RIGHT") = 3
	
		Parameter("DISTANCE2") = LENGTH+10
		Parameter("FRONT_BACK") = 3
		
		Try
		Finally
			oPattern.OccurrencePatternElements(1).Suppressed = True
			oPattern.OccurrencePatternElements(2).Suppressed = True
			oPattern.OccurrencePatternElements(3).Suppressed = False
			oPattern.OccurrencePatternElements(4).Suppressed = False
			oPattern.OccurrencePatternElements(5).Suppressed = False
			oPattern.OccurrencePatternElements(6).Suppressed = False
			oPattern.OccurrencePatternElements(7).Suppressed = True
			oPattern.OccurrencePatternElements(8).Suppressed = True
			oPattern.OccurrencePatternElements(9).Suppressed = False
		End Try
	End If
	
	
'********************************************************************************
RuleParametersOutput
iLogicVb.DocumentUpdate
iLogicVb.UpdateWhenDone = True
InventorVb.DocumentUpdate()  

 

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

Pleaese Unsuppressed the patternelements before every time to transform .

add below code

 

Dim oPatternElement As OccurrencePatternElement
For Each oPatternElement In oPattern
.OccurrencePatternElements
oPatternElement.Suppressed=0
Next

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

Post to forums  

Autodesk Design & Make Report