3 Replies Latest reply on Mar 3, 2014 9:29 AM by Ramon F. Herrera

    How would you decide whether to implement an Addin vs. a Macro?

    Ramon F. Herrera

      I just began evaluating SolidWorks and its automation capabilities. Compared with Macros, the structure of Addinis much more complex, requiring registration and many ancillary files, which are generated automatically by templates.

       

      Under which circumstances would you choose one over the other?

       

      TIA

        • Re: How would you decide whether to implement an Addin vs. a Macro?
          Artem Taturevych

          Currently you have a very big choice. In addition to COM based add-ins and VBA macros it is also possible to write macros in C# and VB.NET as the VSTA macro just inside the SolidWorks. Previously some developers prefer add-ins due to above fact but now it is no longer the case. You can also write stand-alone applications in any language (http://www.youtube.com/watch?v=aoXJGKAwhbc).

           

          I would list advantages and disadvantages of all approaches. This is my view only. Someone can have different view.

           

          Feature\Method

          VBA Macros

          Add-ins

          VSTA Macros

          Stand-Alone

          Comment

          Easy to start

          Yes

          No

          Yes

          Yes

          Average time spent for a not experienced user to start a solution

          Easy To Deploy

          Yes

          No

          No (should be easy but in practice usually a lot of problems)

          Yes

          Time spent to make your software work on another machines

          Protected Code

          No (only password protection)

          Yes (binaries)

          Yes (binaries)

          Yes (binaries)

          A ways to IP protect your code

          Scope of available Utility Libraries

          No (only obsolete VB6 libraries)

          Yes

          Yes

          Yes

          Availability of utility functions for working with Databases, Files, XML etc.

          Scope of available SolidWorks functions

          Limited

          Full

          Limited

          Limited

          Some interfaces will only operate within the add-in such as the ones from SWPublished library

          Reliability

          No (usually the problems with missed libraries etc)

          Yes

          Yes

          Yes

          How much the solution is reliable across the SoldiWorks versions and PC workstations.

          Debugging

          Easy (out of process)

          Complicated (in-process). Slow to restart because requiring to restart add-in/SolidWorks

          Complicated (in-process)

          Easy (out of process)

          For in-process applications it is not possible to see and change SolidWorks at runtime from UI.

          Requirement of additonal software

          No

          Development IDE required

          No

          Development IDE required

          Development IDE usually consist of code text editor and compiler (e.g Visual Studio, Eclipse, CBuilder etc.)

          User Friendly for the beginners

          Yes

          No

          No

          No

           

          Performance

          Normal

          Good

          Good

          Normal

          Operating performance

           

           

          So, as the summary. There are 3 major factors which influence of what approach to use: the type of task, level of experience, software availability.

          • Re: How would you decide whether to implement an Addin vs. a Macro?
            Roland Schwarz

            Addins let you do some things that macros don't

            • Run in background without added drag
            • Detect events (e.g. file save, selection) while running in background
            • Add menus, toolbars, RMB-click menus