ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
PMPeter McCourt21/09/2017

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.