2 Replies Latest reply on Apr 14, 2016 6:09 AM by Sumeet Nale

    Start SolidWorks in background and run SW macro for SW file parsed in batch file

    Sumeet Nale



      Is it possible to create SolidWorks session in background and run macro in it while opening one SW file in the session.

      So far I have created this batch file which asks user to provide complete file location and sets an argument for that. But I don't know how to open that file in SolidWorks.


           @echo off

           Set /p sldasm_file="Enter full path of the SolidWorks assembly: "

           Set sld_macro="C:\MyMacro.swp"

           %sldasm_file% /m %sld_macro%



      There are three macros in that swp file, two of them are private sub and one is main() function. The macro gets location of all components and name of the file in an assembly (including).


      Any idea? Please help.