3 Replies Latest reply on Feb 15, 2013 2:57 PM by Daen Hendrickson

    Is there a replacement method for VB in equations since SW2012

    Daen Hendrickson

      We upgraged from SW2011 to SW2012 only recently. Since we have not initiated a new project yet I only just discovered that the SW2012 equation editor has decapitated the whole "VB in equations" methodology championed by Josh Brady.

       

      Has anyone found / developed a suitable replacement for these undocumented capabilities or will this type of handywork need to be managed with macros / full force programming?

       

      Does SW2013 bring anything back or are equations managed similarly to SW2012?

       

      Thanks, Daen

        • Re: Is there a replacement method for VB in equations since SW2012
          Josh Brady

          What level of that functionality had you been using?  The "live" equation syntax checking looks like it is breaking this functionality.  However, it seems that most of the time that's just a warning.  If you keep the "no good" equation and do an  actual rebuild, I think it still works (if I remember from the brief look I did a while back).

           

          Small update:

          You can't create a new equation that SW thinks is invalid.  When you try to exit the dialog you will get the syntax warning and the equation is not created.  However, once the equation is created and you exit the equation dialog, you can then go back in and edit the equation to include VBA code.  You will still get the warning when exiting the dialog, but the equation will evaluate properly.

           

          The other thing that kind of sucks is that when SW pulls your equation into the dialog box from where it actually stores it, the dialog box will try to make sense of it as an equation and it will display with a bunch of extra quotation marks and stuff.  However, as long as you don't actually make a change to any given equation, the displayed contents won't actually be written back to wherever it's stored and it will still work. If you do need to edit an equation, you'll have to fix the entire thing back to the correct syntax (that SW thinks is wrong).

            • Re: Is there a replacement method for VB in equations since SW2012
              Josh Brady

              Interestingly enough, it looks like it wouldn't be too difficult to write a new equation editor macro that would restore easy editing functionality.

               

              Luke Malpass at AngelSix.com has an equation that mimics the functionality of the old "edit all" button.  That is probably your best shot at practically using the VBA stuff in equations.  It seems to work pretty well and bypasses the new editor.  You will need to do a free registration on his site to download it.

              • Re: Is there a replacement method for VB in equations since SW2012
                Daen Hendrickson

                Josh,

                 

                I like to use your methodology for simple custom property manipulations - particularly taking part of one property and using it to manipulate another with .get and .set.

                 

                I had noticed the observations you pointed out but had not come to the conclusions you had. When I opened a SW2011 file with VB in the equations, they were flagged and the additional quotation marks were inserted. But the custom property they drove still worked. When I tried to add a new equation the equation manager tossed it out.

                 

                If I understand you correctly, I can put in a temporary valid equation to get the manager to accept it. Exit and re-launch the equation manager and then edit the temporary equation syntax to my liking and it should stick although with error notifications.

                 

                I'll give that a try.

                 

                As far as creating the macro... an area I know too little about. I keep having good intentions of learning this stuff (have written VBA code in the distant past in Access) but never seem to find that "spare time".

                 

                Thanks again for the input.

                 

                Daen

                 

                EDIT: Gave this method a try (in SW2012) and it seems to work. THANKS Josh!