AnsweredAssumed Answered

Run standalone application from a SWP macro

Question asked by Alexandre Gragnano on Jul 3, 2015
Latest reply on Jul 7, 2015 by Alexandre Gragnano

Hi everyone,

 

I would like to run a standalone C# application from a VBA SWP launcher by passing the SolidWorks process id as argument in case of multiple SolidWorks instances.

 

macro.swp (VBA launcher)

---------------------------------------------------------------------------------------------------------

Sub Main()
    Shell """C:\...\macro.exe"" " + CStr(Application.SldWorks.GetProcessID)
End Sub

 

 

macro.exe (C# standalone application)

---------------------------------------------------------------------------------------------------------

static void Main(string[] args)
{
    int processId = Convert.ToInt32(args[0]);
    Process process = Process.GetProcessById(processId);
    // How to get SldWorks instance from process?
}

 

 

Need help

Best regards

Outcomes