ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
CJChris Johnson02/04/2014

Hi All,

Im trying to delete an equation but cant get it working.

does anyonwe see where im going wrong?

Sub main()

   

    Dim swApp                   As SldWorks.SldWorks

    Dim swModel                As SldWorks.ModelDoc2

    Dim swEqnMgr             As SldWorks.EquationMgr

    Dim i                           As Long

   

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swEqnMgr = swModel.GetEquationMgr

   

         

    For i = i To swEqnMgr.GetCount - 1

   

     Debug.Print swEqnMgr.Equation(i)

     ' This returns: "D1@Sketch1" = 7

    

           If swEqnMgr.Equation(i) = """D1@Sketch1""=" & "=" & "7" Then

                swEqnMgr.Suppression(i) = True 'suppress To delete the Equation

                swEqnMgr.Delete

           

            End If

    Next i

End Sub

Thank you!

Chris