Hi, Could anyone explain to me how to use the FeatureLinearPattern5 method for components in an assembly? I am trying to create a linear component pattern of a part using the API in VBA.
The below is what I am using at the minute:
boolstatus = swModel.Extension.SelectByID2(" *PART TO BE PATTERNED*", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0) 'Select Part to be Patterned
boolstatus = swModel.Extension.SelectByID2("Top Plane", "PLANE", 0, 0, 0, True, 2, Nothing, 0) 'Direction to Pattern 1
boolstatus = swModel.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, True, 4, Nothing, 0) 'Direction to Pattern 2
' Linear Pattern
Dim swLinearPattern As Feature
Set swLinearPattern = swModel.FeatureManager.FeatureLinearPattern2(4, 0.2, 2, 0.1, True, True, "FRONT PLANE", "TOP PLANE", False)
This code selects the parts but the final line does nothing - swLinearPattern remains set to 'Nothing' in the locals window.
Hi Peter,
You need to use Mark "1" so select the component, you have used "0". 'FeatureLinearPattern2' is obsolete try using 'FeatureLinearPattern5'.
Here is an API example: 2017 SOLIDWORKS API Help - Create Linear Pattern of Subassembly Example (VBA)