3 Replies Latest reply on May 6, 2014 1:55 AM by Yuan M

    C# Accessing current solidwork session

    Yuan M

      I would like to connect my C# standalone application to a running solidwork session. I've tried to use

       

      SldWorks swApp = Activator.CreateInstance(Type.GetTypeFromProgID("SldWorks.Application")) as SldWorks;
      swApp.Visible = true;
      

       

      suggested on here. From what I understand this should create a solidwork session if theres none and join the latest if there is one. But that seem to create a new instance of solidworks ie a new window, separate from the current running one. This page uses CreateObject() but that's for VBA and I could not find a similar method for C#.

       

      I can verify the number of SLDWORK.exe running using

       

                Process[] pro = Process.GetProcessesByName("SLDWORKS");
      

       

      Am I doing the right thing or is there another way of connecting to solidworks?

       

      EDIT: Possibly useful information, this was observed on both visual studio 2010 and 2012. Built for 64bit application.