Can I use multi threading with Solidworks API?

Hi All,
I am working on a project to export Solidworks parts into dxf files using This API . I should activate part configuration prior to exporting the document using IModelDoc2.ShowConfiguration2("configurationName"); . Consequently I should process parts one by one! Is there a way to somehow process a batch of items in parallel?
This Article From Javeline suggest multi threading is possible in Solidworks but I found many questions on solidworks forum that suggest otherwise.

Not possible. All of your API calls will execute on the main thread of SOLIDWORKS with the possible exception of event handling code that might be triggered for a background thread started by SOLIDWORKS when opening large assemblies (ie concurrent loading of multiple documents).

You literally have no control over threading with SOLIDWORKS. That probably won’t change.

If you are using Winforms and you attempt to async wait API calls, you will actually make SOLIDWORKS slower because of cross thread overhead.

Achieving a responsive UI is truly a tricky deal.

If you want to achieve some sort of concurrency, try loading multiple instances of SOLIDWORKS and split your work into smaller chuncks that each process can handle independently.

1 Like

Thanks Amen, that was my last solution to create multiple instances of the application, I doubt it would be as easy as that though, I’ll update this post once I’ve tested it.

I was going to suggest one of the dozen ways to speed up the API, like disabling the feature tree, but I don’t think any of those methods will make exporting faster. Maybe hiding the window will do something.

Here’s my current list of options:

3 Likes

Some good resource! Thanks for sharing!