Automating SOLIDWORKS parts, assemblies and drawings using API

Edit ArticleEdit Article

Automating of SOLIDWORKS documents with API
Automating of SOLIDWORKS documents with API

SOLIDWORKS documents (parts, assemblies and drawings) provide large amount of API functions for automation.

There are common functionalities which are available for all types of documents and usually accessible via IModelDoc2 or IModelDocExtension SOLIDWORKS API interfaces.

This includes but not limited to:

  • Annotations
  • Sketch
  • Feature Manager

There are also specific functionalities available only for the specific types of documents

  • Parts APIs are available via IPartDoc interface
  • Assemblies APIs are available via IAssemblyDoc interface
  • Drawings APIs are available via IDrawingDoc interface

Specific interface can be cast to the generic interface and vice verse.

IModelDocExtension can be accessed via IModelDoc2::Extension property.


All articles and code at CodeStack are now open-source and hosted on GitHub. If you want to contribute by modifying existing articles and code snippets, submitting new ones, reporting errors and bugs etc. please follow this blog post for more information. We appreciate any contribution.

Product of Xarial Product of Xarial