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.

Author

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. With over a decade of experience, he has authored several courses and open-source frameworks related to the SOLIDWORKS API. His leadership ensures that Blue Byte Systems prioritizes customer satisfaction and delivers high-quality software and CAD design solutions.