I've trying to make a macro that switches the "merge faces" option to "True" in sheet metal flat patterns. However, I keep getting a Run-time error 91. I think I set all of the objects but maybe I'm missing something obvious.
Option Explicit
Dim swApp As Object
Dim swModelDoc As SldWorks.ModelDoc2
Dim swFlatPattern As SldWorks.FlatPatternFeatureData
Dim swFeat As SldWorks.Feature
Dim swModel As SldWorks.ModelDoc2
Sub main()
Set swApp = Application.SldWorks
Set swModelDoc = swApp.ActiveDoc
Set swFeat = swModel.FirstFeature
Set swFlatPattern = swFeat.GetDefinition
swFlatPattern.MergeFace = True
End Sub
EDIT: This is supposed to run on an already-open sheet metal part.
SolidworksApi/macros