Pattern within another pattern in assembly using ilogic

Pattern within another pattern in assembly using ilogic

murugasubi
Enthusiast Enthusiast
370 Views
2 Replies
Message 1 of 3

Pattern within another pattern in assembly using ilogic

murugasubi
Enthusiast
Enthusiast

please refer the attached image,  In the SJF Bay.iam, TD UPRIGHT:1 is a part and pattern not required. The TD UPRIGHT:2 required pattern and I did it, it's working fine. But the SJF Beam:1 and SJF Beam:2 are an assembly and I already patterned in the model, Now I want to pattern the Component Pattern 1:1 again.  The first Component pattern 1:1 is must be required because the column height will increase and I will pattern upwards further.

 

So I need to do another pattern for the Component pattern 1:1. Please suggest.

Below code, I used for the direct model pattern, 

 

Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oOccs As ComponentOccurrences = oADef.Occurrences
Dim oTO As TransientObjects = ThisApplication.TransientObjects
Dim oObjects As ObjectCollection = oTO.CreateObjectCollection
oObjects.Add(oOccs.ItemByName("TD UPRIGHT:2"))

Dim oRowEntity As Object = oADef.WorkAxes.Item(3)
Dim oColumnEntity As Object = oADef.WorkAxes.Item(2)

Dim oPatt As RectangularOccurrencePattern
oPatt = oADef.OccurrencePatterns.AddRectangularPattern(oObjects, oColumnEntity,  True,  -200, 3, oRowEntity, True,  0, 1)
oPatt.Name = "Pattern 1"

 

0 Likes
Accepted solutions (2)
371 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @murugasubi.  Although you did a great job of showing us the layout of your assembly, and the code you used to create the last component pattern, I'm still not entirely clear about what you are requesting here.  It seems like you want to create another pattern, based on the existing component pattern named "Component Pattern 1:1", but then you mention "column height will increase and I will pattern upwards further", which added some uncertainty to the objective.  Also, do you want the solution to be a completely new iLogic rule, just for creating this other pattern, or do you want us to add the new code for creating this other pattern to the end of your existing rule?

 

To create a pattern of a pattern, you simply need to get the pre-existing pattern itself within the code, then put that into the ObjectCollection, just like you did with oObjects.Add() in your original rule.

Here's what I'm thinking may be similar to what you are requesting...but of course I don't know the parameters, quantities, or directional entities you were planning on using.

Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oOccPatts As OccurrencePatterns = oADef.OccurrencePatterns
Dim oTO As TransientObjects = ThisApplication.TransientObjects
Dim oObjects As ObjectCollection = oTO.CreateObjectCollection
oObjects.Add(oOccPatts.Item("Component Pattern 1:1"))

Dim oRowEntity As Object = oADef.WorkAxes.Item(3)
Dim oColumnEntity As Object = oADef.WorkAxes.Item(2)

Dim oPatt As RectangularOccurrencePattern
oPatt = oOccPatts.AddRectangularPattern(oObjects, oColumnEntity,  True,  -200, 3, oRowEntity, True,  0, 1)
oPatt.Name = "Component Pattern 2"

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

murugasubi
Enthusiast
Enthusiast
Accepted solution
0 Likes