ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
DMDaniel Martin17/02/2020

I am trying to turn the 'merge faces' option on in a part using the api but it does not show changes in the part. Running the macro I have written below (I have isolated only the relevant part of the code) I can see the setting starts 'off', I then switch it 'on' in the code and the debug.print confirms this, however the actual part in solidworks remains with the setting switched off. What am I doing wrong? or is this the same for everyone?

Sub main2()
Dim swApp As SldWorks.SldWorks
Dim swFeat As SldWorks.Feature
Dim swModel As ModelDoc2
Dim swFlatPatt As SldWorks.FlatPatternFeatureData

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swFeat = swModel.FirstFeature

Do While Not swFeat Is Nothing
Select Case swFeat.GetTypeName
Case "FlatPattern"
Set swFlatPatt = swFeat.GetDefinition
Debug.Print swFeat.Name & " Merged Faces? " & swFlatPatt.MergeFace
swFlatPatt.MergeFace = True
Debug.Print swFeat.Name & " Merged Faces? " & swFlatPatt.MergeFace
End Select
Set swFeat = swFeat.GetNextFeature
Loop
End Sub