call Add-in from Macro
call Add-in from Macro
I am looking for a way to call an Add-in from a Macro, alternatively to launch an Add-in function from the command line. We are trying to "batch process" a large number or part files and we would like to launch SolidWorks, process a bunch of files, and then close SolidWorks without any user intervention. I know how to call a macro from the command line, but I would prefer to write all this in C#.
Re: call Add-in from Macro
You can look into creating a standalone tool instead of add-in.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
SOLIDWORKS Consultant/Blogger
Re: call Add-in from Macro
We looked into this. Unfortunately, as far as I can tell, the functionality we want to do (generate PNG and STEP files) can't be done from a standalone tool, only an add-in or macro.
Re: call Add-in from Macro
Not sure what led you to believe this. Any external program can call any SW API. Your program will still have to launch SW and tell it what to do, but there aren't any features of SW that you can do with a macro that you can't do with basically the same API calls from an external program. I've launched SW and called its API from Excel and even VBScript.
Not that I think you'd try it, but VBScript is actually quite limited in what it can do in SW due to the fact that it can't handle arrays of objects passed from external functions. It can count them but you can't get any of them.... C# would not have this limitation.
Not that I think you'd try it, but VBScript is actually quite limited in what it can do in SW due to the fact that it can't handle arrays of objects passed from external functions. It can count them but you can't get any of them.... C# would not have this limitation.
Re: call Add-in from Macro
I had made standalone tool to do similar tasks. The standalone tool will start the SW (if an instance is not running) and then can open the required files and export in the desired formats.
Here is an example by @artem exporting to various formats using API and eDrawings https://www.codestack.net/edrawings-api/output/export/
Deepak Gupta
SOLIDWORKS Consultant/Blogger
SOLIDWORKS Consultant/Blogger