ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
SNSumeet Nale13/04/2016

Hello,

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%

     Exit

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.