Hi. I am trying to make a standalone application using SolidWorks and Cosmos. When I was only opening SolidWorks and modifying a part, this worked fine, but I can't find an example of how to use the simulation software without already having SolidWorks open. My code is attached. In my code, as in the example I was following, I attempt to get reference to Cosmos as an add-in, but this only works if SolidWorks is open and you have established Cosmos that way. Is there a way to, say, open a study that you have already created? Once I have that I can finish this just fine.
SolidworksApi macros
I should probably clarify. What I am having trouble doing is getting a COSMOSWorks object that will work with the instance of SolidWorks that I open in my code. Once I have that I can get the current document, open my study, etc.
Alright. The more I try and get this to work, the more I start to understand about the probelm. I think I have it narrowed down at least.
So now I'm using the following two commands:
swApp.LoadAddIn("C:\\Program Files\\SolidWorks Corp\\SolidWorks\\api\\redist\\SolidWorks.Interop.cosworks.dll");
CWObject = (CwAddincallback)swApp.GetAddInObject("CosmosWorks.CosmosWorks");
But CWObject remains null. The example in the API help used "SldWorks.Simulation" rather than CosmosWorks.CosmosWorks, and I tried that, but it did not work either.