06-07-2019
08:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-07-2019
08:58 AM
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.
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"