Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Curtis_Waguespack
in reply to: blandb

@blandb 

 

I am guessing about this, but recall that the iLogic functions often have more going on under the hood than we can see. I suspect the Add Constraint and Add CC Part functions include handlers for blank fields, that autogenerate the names when one is not provided.

 

And the Add Rect Pattern function simply doesn't have that sort of handler.

 

As for how to proceed, I would probably add a loop to the end of your rule, and have it rename all of the rectangular patterns.

 

Dim rectPattern = Patterns.AddRectangular("RectPatternName", "Part:3", 3, 1.5 in, Nothing, 
"X Axis", columnNaturalDirection := True, rowCount := 2, rowOffset := 1.0 in, rowEntityName := "Y Axis", 
rowNaturalDirection := True)

Dim oDoc As AssemblyDocument = ThisDoc.Document
i = 1
For Each oPattern As OccurrencePattern In oDoc.ComponentDefinition.OccurrencePatterns
	oPattern.Name = "Component Pattern:" & i
	i = i+1
Next

 

Or get the pattern count on the front end, and increment the count by 1:

 

Dim oDoc As AssemblyDocument = ThisDoc.Document
patcount = oDoc.ComponentDefinition.OccurrencePatterns.Count

Dim rectPattern = Patterns.AddRectangular("Component Pattern:" & patcount+1, "Part:3", 3, 1.5 in, Nothing, 
"X Axis", columnNaturalDirection := True, rowCount := 2, rowOffset := 1.0 in, rowEntityName := "Y Axis", 
rowNaturalDirection := True)