AnsweredAssumed Answered

Macro Setting equations works for some but not all

Question asked by Vince Riha on Feb 1, 2019
Latest reply on Mar 11, 2019 by Vince Riha

I have been working a larger macro to make life easier for our designers and up until two days ago it was working pretty well. the only thing I can see that changes was a windows office components update was installed by IT.

The macro reads the equation manger table and set variables for the three parts of each equation (Index number, name, value). Then i have a form that displays the values and allows users to change them. next I have a button that runs a routine to update changed equations.  Up to two days ago this was working smoothly, now I have a few that when changed crash the system. I only change values of equations in that are global variables and these are used by other equations to set dimension values or used to evaluate conditions in the feature equations. The assembly has components that are suppressed and unsuppressed based on these variables and this is where i see the issue now.  I have other components that I suppress and unsuppress that are working fine but one particular one works if I change the m directly in equation manager but when doing it from the macro form it crashes when going from suppressed to unsuppressed.


Here is a simplified version of the code I am using:


Function Fix_Vars() ' applies current variables to the current model


Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swDoc = swApp.ActiveDoc


Dim swEM As SldWorks.EquationMgr

Set swEM = swDoc.GetEquationMgr


swEM.Equation(var_IDX) = "" & var & "= " & var_VAL


End Function


     I don't believe its an issue with the code because i have 74 variables and only 2 care causing a crash, Other components being suppressed in the same mannr work just fine (Knock on wood). I'm at a loss where to look. I have tried to manually enter the (index, name and value and it still fails) I tried disabling auto solve and auto order and same results. I pulled older version of the macro and models and they are now not working either.  I am running 2018 SP2.0 and I cannot upgrade (due to the havoc it will cause on a corporate level with Driveworks and PDM) 


Any ideas?