3 Replies Latest reply on Jun 30, 2015 6:55 PM by Tim Webb

    EPDM SWTaskAddIn and writing SolidWorks VBA Scripts

    Greg Thomson

      Does anyone know, is there any documentation or posts around for writing SolidWorks VBA Scripts within the EPDM SWTaskAddIn?

       

      In particular, I'm wondering...

      -Is the VBA script limited to whatever functions and subroutines I can put into the script?  Or, can I also reference/add classes.

      -How do I go about adding references to external assemblies like the PDMWorks Enterprise 2014 Type Library?

      -Any general guidelines on developing and debugging these scripts?

      -What determines the Pass/Fail criteria of a Task?  Can I provide a return code somehow?  Can I customize the Failed email so it might have more detail?

       

      Newbie,

        • Re: EPDM SWTaskAddIn and writing SolidWorks VBA Scripts
          Paul Tormey

          Hi Greg,

          Did you get anywhere on this query or using VBA Scripts with Solidworks?

          Regards

          Paul

            • Re: EPDM SWTaskAddIn and writing SolidWorks VBA Scripts
              Greg Thomson

              Its been a few months since I wrote a VBA script within an EPDM SWTaskAddIn.  If memory serves me, here are my basic observations...

               

              -You have to write one big long script file.  Anything valid in a standard VBA file is allowed within this script.

              -You cannot reference or add additional classes, structures (files), but you can define multiple functions/subroutines within the same script.  I suspect you could just as easily define multiple enumerations, classes, structures etc., as long as its within the same script.

              -You can't statically reference external DLLs and such, but you can dynamically load them within a script.  So, you can dynamically load external components.  Or, create your own VB.NET project, place the bulk of your code in there (with classes and all), and then dynamically load it within the script to run.

              -There's no facility for debugging a script within EPDM, as it simply hands it off to a SolidWorks station and executes.  However, you can develop the script locally on your computer within the SolidWork'ss VBA environment; test, develop and debug, and then paste the final source code into the script window for the task within EPDM.  This is what I did.

               

              Definitely some draw backs, but you can accomplish pretty much anything you put your mind too.

               

              Hope this helps... hope its accurate.

               

              Greg,