5 Replies Latest reply on Dec 27, 2017 5:19 PM by Oleg Oleg

    How to import .dll using C#, or Simulation is not loading

    Oleg Oleg

      Greetings, i've been trying to load add-in Simulation through api written in C#, but it didn't work.

      As for preparations, i've been toggling options in Tools -> Add-ins -> SOLIDWORKS Simulation in all possible ways to ensure, but the api still couldn't load Simulation.

       

      Variants of a piece of code i've been testing for this purpose:

      1. CWAddinCallBack = (CwAddincallback)swApp.GetAddInObject("CosmosWorks.CosmosWorks");

      2. CWAddinCallBack = (CwAddincallback)swApp.GetAddInObject("SldWorks.Simulation");

      3. CWAddinCallBack = (CwAddincallback)swApp.GetAddInObject("SldWorks.Simulation.2");

      Either way gets CWAddinCallBack as null in the end. The only way it works, it's me manually turning on Simulation in SW, then launching the api, which doesn't fit for me.

       

      And i've got all needed references for SW and Simulation in particular, so there's no reference or version problems.

      I've noticed that i can open cosworks.dll in SW and it turns add-in on. Can i use alike OpenDoc6 methods to load-in cosworks.dll in my api?