SOLIDWORKS PDM API TIP: Writing Add-ins with Version-Specific APIs

When writing an add-in for SOLIDWORKS PDM, it is essential to consider compatibility across different versions of the software. Some API calls introduced in newer versions may not be available in older versions, potentially causing runtime errors for clients using older systems.

Scenario

Suppose your add-in uses an API feature introduced in SOLIDWORKS PDM 2022, but some clients are still using SOLIDWORKS PDM 2018. To ensure compatibility, you can programmatically check the PDM version installed on the client’s machine before calling the new API.

Solution: Use the GetVersion Method

The GetVersion method allows you to retrieve the major and minor version numbers of the installed SOLIDWORKS PDM Professional. Based on the version, your code can decide whether to execute the new API call or fall back to an alternative logic for older versions.

Implementation

Here is an example in Visual Basic:

This approach ensures your add-in remains robust and user-friendly, even in environments with mixed PDM versions.

Leave a Comment