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

Hi @felix.cortes5K3Y2 .

 

Attached is an example part file ( saved in Inventor 2017 ) for you to look at.

 

I just adapted the code/file found at this link for this example.

https://forums.autodesk.com/t5/inventor-customization/rectangular-pattern-part-ilogic/m-p/7599859#M7...

 

Below is the code found in the file in cases it helps future searches.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'try to delete previous pattern, just for testing
Try
ThisApplication.ActiveDocument.ComponentDefinition.Features("TestPattern").delete
Catch
End Try

Dim oPD As PartDocument
oPD = ThisApplication.ActiveDocument

Dim oPCD As PartComponentDefinition
oPCD = oPD.ComponentDefinition

Dim oSWP As WorkPlane
oSWP = oPCD.WorkPlanes.Item(4)

Dim oBjCol As ObjectCollection
oBjCol = ThisApplication.TransientObjects.CreateObjectCollection

Call oBjCol.Add(oSWP)

Dim oSL3D As SketchLine3D
oSL3D = oPCD.Sketches3D.Item(1).SketchLines3D.Item(1)

Dim qtypattern As Integer
qtypattern = InputBox("How many to Pattern?", "Quantity of Pattern")


Dim oPath As Object
oPath = oPCD.Features.CreatePath(oSL3D)

Dim oRecFeat As RectangularPatternFeature
DistPrompt1 = InputBox("Input Distance of Pattern in cm?", "Distance of Pattern")

oRecFeat = oPCD.Features.RectangularPatternFeatures.Add(oBjCol, oPath, True, qtypattern, DistPrompt1, PatternSpacingTypeEnum.kDefault)

'rename pattern
oRecFeat.Name = "TestPattern"