3 Replies Latest reply on Jul 14, 2015 11:18 AM by George Bon

    Does a VSTA macro run "in-process"?

    Alex Totev

      Hello to all,


      From what I understand, stand alone SW routines will run slower because they are run "out-of-process" vs a SWP macro which runs

      "in-process." Ok, fine. But, what about a VSTA vb.net macro?


      Since the compiled VSTA .dll is loaded within SolidWorks, is it running "in-process"?


      I did a quick test to get some numbers...

      The tests were run on an assembly containing 64 components and a total of 2575 bodies.


      The routine goes through each Component in the assembly and gets the list of Bodies. The name of the Feature associated with each body is stored to a variable.


      Time to complete:
      VSTA = 6.5s

      SWP = 0.09s

      VB.NET stand-alone Form = 2.7s (with commandinprogress=true)

      VB.NET stand-alone Form = 107s (witout commandinprogress=true)


      Add-in would be around the same time as the SWP.


      So why is the VSTA so slow? Slower than a stand-alone in fact.


        • Re: Does a VSTA macro run "in-process"?
          Keith Rice

          Stand-alones are the only type of program that run outside of the SLDWORKS.EXE process.


          Are you timing the macro from the moment you click the run button or within the code (by printing the current time to the debug window)? Because if you are doing the former then your test is not accurate. VSTA macros do take longer to start load before they run, at least from the VSTA editor.



          SolidWorks API Tutorials

          • Re: Does a VSTA macro run "in-process"?
            George Bon

            I have similar issues when doing a VSTA .dll macro.


            The macro is using a windows form and runs through the features and changes appearances based on criteria in the form.


            I have noticed the program is running fast when the form is made modal, but very slowly when it is made modeless. Here are the times for 1 example:


            modal:               1,398ms

            modeless:        26,878ms


            Could the answer be to switch from modal to modeless and vice-versa as required? Unfortunately I haven't found a way to do this without closing the form. Any idea?