I want to create an add-in that can automate some of our workflow in SolidWorks CAM 2021.
Is it possible to access the SolidWorks CAM module through a custom add-in?
Preferably through C# code. But I cant find any documentation of this.
I want to create an add-in that can automate some of our workflow in SolidWorks CAM 2021.
Is it possible to access the SolidWorks CAM module through a custom add-in?
Preferably through C# code. But I cant find any documentation of this.
What's funny is that I can't find the interop PIA for CAMWorks in SW 2021. I'm tempted to believe that you might need to use tlbimp.exe to get that interop for .NET. Make sure not to embed interop types in your project properties.
Best place to ask is apisupport@solidworks.com
Thanks, I'll try contacting the api support team.
But I'm pretty sure it's because I'm doing it the wrong way.
I'm only able to find an example using Simulation COSMOPOL: 2018 SOLIDWORKS API Help - Accessing SOLIDWORKS Add-in Objects
In this example they can extract the CosmoWorks interface.
Adding references to the Solidworks CAM Type Library includes a CAMWORKS module.
However I cant find a suitable interface in the CAMWORKS module. I've tried CWApp, but the application still crashes.
I have access to the CAMWorks API. Hopefully the api is the same as for Solidworks CAM. (But it seems weird that there's no documentation from Solidworks' side.)
However I can't seem to figure out how to acces the api interface from my C# project.
I have the following so far:
dynamic SWCAMObject = default(dynamic);
dynamic SWCAM = default(dynamic);
SWCAMObject = iSwApp.GetAddInObject("{CCAC6208-0E19-6455-2017-2021CEB541FA}");
if (SWCAMObject == null) ErrorMsg(iSwApp, "SWCAMObject object not found");
Debug.WriteLine($"SWCAMObject loaded: {SWCAMObject}");
SWCAM = SWCAMObject.CAMWORKSADDINLib; <---- Breaks here, not at all sure how to extract the addin interface.
if (SWCAM == null) ErrorMsg(iSwApp, "SWCAM object not found");
Debug.WriteLine($"SWCAM loaded: {SWCAM}");
Does anyone know how to do this correctly?