Rectangular pattern with assigned edge

Rectangular pattern with assigned edge

NachoShaw
Advisor Advisor
321 Views
1 Reply
Message 1 of 2

Rectangular pattern with assigned edge

NachoShaw
Advisor
Advisor

Hey

 

I have some code together that can pattern along an axis but i dont need an axis, i need an edge that i have assigned a name to. I can get the edge but i keep getting an error 'Parameter is incorrect'.

 

I have tried assigned the edge as an edge and also as an object but both give me the same error. what can i do to successfully use the edge with an assigned name as a pattern in my assembly? I dont want to use an axis because the pattern direction is driven by the angle of the edge on the component.

 

My code-

 

Dim DocToPattern As ComponentOccurrence = ADef.Occurrences.Item(1)
Dim PatternName As String = "MyPattern"
Dim addin As ApplicationAddIn = My.Application.G._Invapp.ApplicationAddIns.ItemById("{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}")
Dim iLogicAuto As Object = addin.Automation
Dim namedEntities As Object = iLogicAuto.GetNamedEntities(_BMDoc)
Dim oEdge As Edge = namedEntities.FindEntity("PatternEdge")

Dim oParentOccs As ObjectCollection = My.Application.G._Invapp.TransientObjects.CreateObjectCollection
oParentOccs.Add(DocToPattern)

Dim oRectOccPattern As RectangularOccurrencePattern = _ADef.OccurrencePatterns.AddRectangularPattern(oParentOccs, oEdge, True, Spacing, PatternName)

 

If i replace oEdge with this, it works ok

Dim oXAxis As WorkAxis = _ADef.WorkAxes.Item(1)

 

 Thanks

 

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
322 Views
1 Reply
Reply (1)
Message 2 of 2

NachoShaw
Advisor
Advisor

Update:

 

i noticed i had not added in the Pattern Qty in the code example

 

Dim oRectOccPattern As RectangularOccurrencePattern = _ADef.OccurrencePatterns.AddRectangularPattern(oParentOccs, oEdge, True, Spacing, Qty, PatternName)

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes