R$0.00
0

SOLIDWORKS API Documentation: How to Find and Read It

Where the SOLIDWORKS API documentation, PDM API help and Document Manager help live, how to read an interface page, and a fast lookup workflow.
SOLIDWORKS API Documentation: How to Find and Read It
Picture of Amen Jlili

Amen Jlili

Amen Jlili is the founder and technical director of Blue Byte Systems Inc., a software company in Vancouver, Canada, specializing in automating SOLIDWORKS and PDM.

The SOLIDWORKS API documentation lives in three places: the online API Help at help.solidworks.com, a local copy you can open from inside SOLIDWORKS with Help > API Help, and the VBA Object Browser in the macro editor. The same help system covers the SOLIDWORKS API, the SOLIDWORKS PDM API and the Document Manager API. Each interface has a page listing its members, how you get a pointer to it (accessors), and per-member pages with parameters, return values, remarks, availability and examples. Once you learn that layout, you can answer most “how do I do X with the API” questions in a few minutes.

This guide is the workflow we use every day when we write macros, add-ins and PDM tools for customers. If you are new to the different APIs, start with our overview of the SOLIDWORKS APIs and come back here.

Where the SOLIDWORKS API documentation lives

There are three APIs you will touch most often, and they are documented side by side.

API What it automates Main entry point Where the help is
SOLIDWORKS API The running SOLIDWORKS application: parts, assemblies, drawings, features, UI ISldWorks Online API Help, local API Help in SOLIDWORKS
SOLIDWORKS PDM API The vault: files, folders, check in/out, variables, workflows, add-ins IEdmVault5 Online API Help, plus documentation and samples installed with the PDM client
Document Manager API Reading and writing SOLIDWORKS files without SOLIDWORKS running SwDMApplication Online API Help (requires a license key to use the API)

Online help at help.solidworks.com

The online help is the version we recommend for daily use: it is searchable, lets you choose the release year, and carries the latest revision of the text. From the help home page, pick the API Help for your release. The table of contents has separate books for the SOLIDWORKS API, the SOLIDWORKS PDM API, the Document Manager API and other APIs such as eDrawings.

Two things to watch:

  • Pick the right year. A method that exists in the 2025 help may not exist in your customer’s 2021 install. The release selector is the first thing we check.
  • Search is literal. Searching for an exact interface or method name (for example IModelDocExtension) works much better than searching for a task description.

Local help installed with the product

In SOLIDWORKS, Help > API Help opens the API documentation for the version you are running. That is useful when you are offline or behind a strict proxy, and it guarantees you are reading the help for the release installed on that machine.

The SOLIDWORKS PDM client also installs API documentation and sample code in its installation folder. The exact folder layout has changed over the years, so look under the PDM installation directory for the API or documentation subfolder rather than relying on a fixed path.

The VBA Object Browser

Inside the SOLIDWORKS VBA editor (Tools > Macro > Edit or New), press F2 to open the Object Browser. With references to the SOLIDWORKS type libraries set, it lists every interface, method, property and enumeration with its signature. It does not show remarks or examples, but it is the fastest way to answer questions like “what are the members of swSaveAsOptions_e?” or “which arguments does this method take?” without leaving the editor.

How an interface page is structured

Almost everything in the SOLIDWORKS API is an interface. IModelDoc2 is a document, IFeature is a feature, IEdmFile5 is a file in the vault. Learning to read one interface page teaches you to read all of them.

The interface page

The top-level page for an interface typically contains:

  • Description: what the object represents.
  • Accessors: the methods and properties that return this interface. This is the section beginners miss, and it is the most useful. If you have never worked with ICustomPropertyManager, the accessors tell you that you get it from IModelDocExtension.CustomPropertyManager, and from there you know you need an IModelDocExtension first.
  • Access diagram on many pages, showing where the interface sits in the object model.
  • Remarks with general behavior, threading notes or caveats.
  • Members link, which opens the full list.

The members page

The members page splits into properties and methods, each with a one-line description, with obsolete members listed separately. Scanning it is often faster than search: for drawing views, open the IView members and read down the list.

The member page

Each method or property has its own page with:

  • Syntax in VBA, VB.NET, C# and C++/CLI. Copy the signature for your language rather than translating it yourself.
  • Parameters: each argument with its type, direction (input or output), and often a link to the enumeration that defines valid values. Output parameters matter: in C# they become out or ref arguments.
  • Return value: what comes back, and frequently what a failure looks like (Nothing/null, False, or an error code from an enumeration).
  • Example links to complete sample code that uses the member.
  • Remarks: the part you must read. Remarks tell you about preconditions (the document must be active, a selection must exist), side effects, and when a value is cached.
  • Availability: the SOLIDWORKS release (and revision number) in which the member was introduced. This is how you know whether your code will run on an older install.
  • See Also links to related members.

Tip: when a call “does nothing”, go back to the Remarks. In our experience the explanation is there more often than not.

Obsolete vs current versions of methods

The SOLIDWORKS API rarely changes an existing method’s signature, because that would break existing macros. Instead, when a method needs new arguments, a new version is added with a numeric suffix and the older one is moved to the obsolete list. That is why you see families like these:

Family What happened
ISldWorks.OpenDoc6, ISldWorks.OpenDoc7 OpenDoc6 takes the options as arguments; OpenDoc7 takes a document specification object with more options
ICustomPropertyManager.Get5, Get6 Get6 adds an extra output that tells you whether the value is linked to another property
ICustomPropertyManager.Add2, Add3 Add3 lets you control what happens when the property already exists

A few rules we follow:

  1. Use the highest numbered version available in the oldest release you support. Check the Availability section of each candidate.
  2. Obsolete does not mean removed. Old members usually keep working for years, which is why recorded macros from older releases still run. But new behavior and fixes go into the newer member. How to tell whether a member is deprecated is a question that also comes up on CADOverflow.
  3. Do not assume the highest number is newest across the whole API. Numbering is per family. Always read the member pages rather than guessing.

The PDM API uses a related but different pattern: new capabilities usually arrive as new interfaces with a higher number, such as IEdmVault5 up through later IEdmVault versions, and you cast to the newer interface when you need its members. We cover that in more detail in writing add-ins with version-specific APIs.

Finding examples that actually help

The API Help ships with a large number of examples, in VBA, VB.NET and C#. There are three ways in:

  • From a member page, follow the Example link. This is the most targeted.
  • From the examples section of the table of contents, which groups samples by topic (assemblies, drawings, features, and so on). Browse here when you know the task but not the API.
  • From the PDM samples installed with the PDM client, which include complete add-in projects. They are the best starting point for your first PDM add-in.

Help examples demonstrate one thing and often skip error handling or assume a preselected entity. Treat them as a map of which calls to make, not as production code.

The SOLIDWORKS PDM API help and Document Manager help

The SOLIDWORKS PDM API reference is a separate book in the same online help. The structure is the same, with a few differences worth knowing:

  • Interfaces are prefixed with IEdm (IEdmVault5, IEdmFile5, IEdmFolder5, IEdmAddIn5), enumerations with Edm (EdmCmdType, EdmObjectType).
  • The add-in model is documented around IEdmAddIn5.GetAddInInfo and OnCmd. The EdmCmdType enumeration page is where you find every hook (pre-state change, post-add, card button, and so on).
  • Errors are returned as COM exceptions with HRESULT codes, and the help includes an error code list. Learn to look these up early.

For a broader tour of what the PDM API can do, read a practical guide to the SOLIDWORKS PDM API in 2026 and our list of things you can do with the SOLIDWORKS PDM API.

The Document Manager API help follows the same layout, starting from SwDMApplication. Its getting started topic explains how to request and use the license key, which you need before any call succeeds.

A practical lookup workflow

Here is the workflow we teach in our training. Say the task is “read the material of the active part”.

  1. Find the entry point. You have ISldWorks (the application). Its members include ActiveDoc, which returns the active document as IModelDoc2.
  2. Narrow to the right interface. Material is part specific, so open IPartDoc members and scan. GetMaterialPropertyName2 looks right.
  3. Read the member page. Check parameters (configuration name, output for the database name), return value, Remarks and Availability.
  4. Check accessors if you are stuck. If you do not know how to get from IModelDoc2 to IPartDoc, the accessors and remarks explain that the same object implements both, so you can cast it (or just assign it in VBA).
  5. Open the example, copy the relevant lines, and adapt them.
  6. Test in VBA first. The Object Browser and immediate window make it quick to confirm return values before you put the call into a C# add-in.

Here is the result of that lookup as a short VBA macro:

Option Explicit

Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swPart As SldWorks.PartDoc
    Dim dbName As String
    Dim matName As String

    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc

    If swModel Is Nothing Then
        MsgBox "Open a part first."
        Exit Sub
    End If

    If swModel.GetType <> swDocumentTypes_e.swDocPART Then
        MsgBox "The active document is not a part."
        Exit Sub
    End If

    Set swPart = swModel
    matName = swPart.GetMaterialPropertyName2("", dbName)

    If matName = "" Then
        MsgBox "No material assigned."
    Else
        MsgBox "Material: " & matName & vbCrLf & "Database: " & dbName
    End If
End Sub

The empty string for the configuration name means the active configuration, a detail the member page documents.

Habits that save time

  • Bookmark the enumeration pages you use constantly (swDocumentTypes_e, swSaveAsOptions_e, swFileSaveError_e).
  • Use early binding in VBA so the Object Browser and IntelliSense work. Our article on early binding vs late binding explains how.

Community discussions

FAQ

Is the SOLIDWORKS API documentation free?

Yes. The API Help is available online at help.solidworks.com and locally from inside SOLIDWORKS. The Document Manager API requires a license key to run, but its documentation is public.

Where is the SOLIDWORKS PDM API help?

It is the SOLIDWORKS PDM API section of the same online API Help. The PDM client installation also includes API documentation and sample projects in its installation folder.

Why are there several versions of the same method, like OpenDoc6 and OpenDoc7?

When a method needs new arguments, SOLIDWORKS adds a new numbered version instead of changing the old signature, and marks the old one obsolete. Use the newest version that exists in the oldest release you support, and check the Availability section to confirm.

Should I trust recorded macro code as documentation?

Use it as a hint for which calls to look up, not as a reference. Recorded code often uses obsolete members, late binding and hard coded selections.

Need help with this?

If you would rather have an experienced team write or review your SOLIDWORKS or PDM automation, contact us. For vault automation without writing a full add-in, take a look at PDMShell, our command line and scripting tool for SOLIDWORKS PDM.

Need this adapted to your workflow?

We build custom SOLIDWORKS macros, add-ins and PDM automation.

Picture of Amen Jlili

Amen Jlili

Amen Jlili is the founder and technical director of Blue Byte Systems Inc., a software company in Vancouver, Canada, specializing in automating SOLIDWORKS and PDM.

Leave a Comment

0
0
Your Cart
Your cart is emptyReturn to Shop