0 Replies Latest reply on Sep 3, 2018 12:06 AM by Daniel McRae

    Solidworks Composer API not opening files

    Daniel McRae

      Hi,

       

      We're trying to write a tool that opens Composer, then iterates over a bunch of Solidworks files, opening each in turn, setting a few views and then saving the resultant Composer file out. However, the API is failing us.

       

      We have the standard

      DSComposer.Application compApp = new DSComposer.Application();

      compApp.Visible = true; // On the other computer, so this may be wrong, but the right command is used

      Document compDoc = compApp.Open("C:\\Path\\to\\SolidWorks\\Model.sldprt");

      if(compDoc == null)

          MessageBox.Show("Failed to open file");

       

      We always get compDoc equal to null as the application never opens the file. We can do other stuff with the application, such as set it visible and display the about box. Both of these work. But as soon as we try to open a file, it just can't do it.

       

      What are we doing wrong? It works fine on the (external) developer's laptop, but it fails on any of the computers we're using to trial the tool the developer wrote., even when stepping through with Visual Studio.

       

      Thanks,

      Daniel