Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions solidworks-api/document/delete-model-equations/Macro.vba
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Sub main()

Set swApp = Application.SldWorks

try_:
On Error GoTo catch_

Set swModel = swApp.ActiveDoc

Dim hasDeleted As Boolean
Expand All @@ -16,7 +19,7 @@ Sub main()

If swModel.GetType = swDocumentTypes_e.swDocASSEMBLY Then

If MsgBox("Do you want to delete equations in all components of the assembly?", vbYesNo) = vbYes Then
If swApp.SendMsgToUser2("Do you want to delete equations in all components of the assembly?", swMessageBoxIcon_e.swMbQuestion, swMessageBoxBtn_e.swMbYesNo) = swMessageBoxResult_e.swMbHitYes Then

Dim swAssy As SldWorks.AssemblyDoc
Set swAssy = swModel
Expand Down Expand Up @@ -59,6 +62,12 @@ Sub main()
swModel.ForceRebuild3 False
End If

GoTo finally_

catch_:
swApp.SendMsgToUser2 Err.Description, swMessageBoxIcon_e.swMbStop, swMessageBoxBtn_e.swMbOk
finally_:

End Sub

Sub DeleteEquationsFromModel(model As SldWorks.ModelDoc2, ByRef hasDeleted As Boolean)
Expand Down Expand Up @@ -94,4 +103,4 @@ Function IsEquationBroken(eqMgr As SldWorks.EquationMgr, index As Integer) As Bo

IsEquationBroken = (eqMgr.Status = STATUS_BROKEN)

End Function
End Function