Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
felix.cortes5K3Y2
414 Views, 2 Replies

iLogic To Add Pattern Into Another Pattern In Assembly

Hey forum,

 

I have two patterns and I am trying to add one pattern inside the other but I am unsure how to do this with iLogic. I think I have to make an object collection of the pattern that needs to be patterned again ("Pattern Two"). 

 

Here's how I've approached it so far:

 

	Dim oDoc As Document = ThisApplication.ActiveDocument
	Dim oAsmCompDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
	Dim oOccPattern1 As OccurrencePattern 
	Dim oOccPattern2 As OccurrencePattern
	Dim oObjCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
	
	Dim FirstPattern As String = "Pattern One"
	Dim SecondPattern As String = "Pattern Two"
	'add second pattern inside first pattern
	
	For Each oOccPattern1 In oAsmCompDef.OccurrencePatterns 
		If oOccPattern1.Name = FirstPattern Then 'looks for the first pattern inside the assembly
			For Each oOccPattern2 In oAsmCompDef.OccurrencePatterns 
				If oOccPattern2.Name = SecondPattern Then 'looks for the second pattern inside the assembly
					oObjCol.Add(oOccPattern2) 'adds the second pattern into a collection
					oOccPattern1.ParentComponents.Add(oObjCol)
				End If 
			Next 
E End If Next

 

Any help is greatly appreciated!

 

Thanks,

Felix