What’s New In the 2019 SOLIDWORKS API

Another year, another round of great updates for the SOLIDWORKS API. Although I’m not going to change the title of this blog series, this post is also going to contain updates for the PDM API and Document Manager API as well. Anyway, the continual improvement of these APIs should give amateur and professional developers confidence that SOLIDWORKS Corporation is investing in their API for the long-haul.

Below are lists of the most notable API calls and interfaces added in the 2019 versions of SOLIDWORKS, PDM, and Document Manager. You can see all additions and their related API calls in the Release Notes article in the API Help. You can find it in the local API Help by searching for “Release Notes” in the category tab. Note that the local API Help Release Notes will only be as up-to-date as the service pack you have downloaded.

New SOLIDWORKS API Calls and Interfaces
  • Access Bounding Box feature data.
  • Access Ground Plane feature data.
  • Access Tab and Slot feature data.
  • Convert an existing balloon to a stacked balloon.
  • Create a geodesic sketch offset along the curvature of a surface.
  • Create a pattern feature with a smaller subset of parameters and then extend or modify
    it using a pattern-specific feature data object.
  • Create an assembly mate with a smaller subset of parameters and then extend or
    modify it using a mate-specific feature data object.
  • Get a component’s suppression state or, if an internal ID mismatch exists, an error
  • Get an annotation’s text scale in the 3D View.
  • Get data from the Hole Wizard database.
  • Get or set more properties on linear, linear component, and circular component pattern
  • Get or set more table column types, including the equation-driven type.
  • Get or set the orientation of text in table cells.
  • Get or set whether an angle or distance mate is a limit mate.
  • Get or set whether to bidirectionally project a curve.
  • Get or set whether to enable the pushpin of an add-in’s callout.
  • Get or set whether to enable the Select Identical Components menu item in the
    context menu of a PropertyManager page selection box.
  • Get or set whether to exclude a component from the bills of materials in specified
  • Get or set whether to generate a display list for a part’s configuration.
  • Get or set whether to load external references in memory when opening a document.
  • Get or set whether to reverse the direction of a specified reference of a reference plane
  • Get the error status of an assembly mate.
  • Insert a Delete Hole feature for selected hole edges on a surface.
  • Insert, open, and update models developed in other CAD packages.
  • Repeatedly detect collisions among groups of components in a variety of
  • Specify whether to include a specified component when saving an assembly as a part.
New PDM API Calls and Interfaces

New API calls

  • Add users by login type to the vault. See IEdmUserMgr10::AddUsers3.
  • Get whether a specified user must add a state change comment for specified workflow transitions for specified documents. See IEdmVault20::GetTransitionCommentPermissions.
  • Get specified files from a vault. See IEdmVault20::GetFiles.
  • Get the archive server log. See IEdmVault20::GetArchiveServerLog.

New structure

  • EdmDocIds. Contains information about one document in the vault. Used in IEdmVault20::GetFiles.
New Document Manager API Calls and Interfaces

New API calls

  • ISwDMDocument23::GetLicenseType

Improved API calls

  • ISwDMConfiguration16::GetCutListItems (obsoletes ISwDMDocument13::GetCutListItems2)
  • ISwDMConfigurationMgr2::GetConfigurationByName2 (obsoletes
  • ISwDMConfigurationMgr::GetConfigurationByName)
  • ISwDMConfigurationMgr2::GetConfigurationCount2 (obsoletes ISwDMConfigurationMgr::GetConfigurationCount)
  • ISwDMConfigurationMgr2::GetConfigurationNames2 (obsoletes ISwDMConfigurationMgr::GetConfigurationNames)
VSTA 1.0 End-Of-Life Announcement

VSTA 1.0, which was the only way a developer could create .NET macros up until SOLIDWORKS 2018, is going to be replaced entirely by VSTA 3.0 macros in SOLIDWORKS 2021, meaning that SOLIDWORKS 2020 is the last version that will support VSTA 1.0. I wrote about my opinion about VSTA 3.0 last year but I’ll reiterate here what I said then: I have no intention of using VSTA / .NET macros anymore. Its so much simpler to just set up a stand-alone sandbox if one needs to test .NET code.

Anyway, if you want to hear the official announcement concerning VSTA 1.0, it was delivered by Daniel Seaman of SOLIDWORKS Corporation in his presentation “Upgrading SOLIDWORKS Macros to Visual Studio Tools for Applications 2015”. This is the same presentation he delivered at SOLIDWORKS World 2018, FYI. I am not sure when they will post the video of this year’s presentation (if it was even recorded) so here are the instructions for watching his 2018 presentation:

1. Visit the SolidWorks World 2018 agenda
2. Search the Sessions tab for the name “Seaman”
3. The result for “Upgrading SOLIDWORKS Macros to Visual Studio Tools for Applications 2015” should appear and you can click Watch Video on the right (requires a free account)

Does anything we’ve covered stand out to you as particularly useful or exciting? If so then let us know in the comments!

Want to keep up with future CADSharp.com content and training events? Join our newsletter!

By |March 4th, 2019|0 Comments

How To Ask A Good Programming Question

In a hurry? Skip right to the section called Guidelines for the meat of this article.


Over one year ago we introduced tech support through Slack, where you can ask your SOLIDWORKS API and PDM API questions to our team and get high-quality answers within hours or even minutes. Our members have absolutely loved it for its speed and simplicity. But whether you’re posting in our Slack, the SOLIDWORKS API forum, or StackOverflow for a general programming question, these four little words carry so much truth:

“Help us help you.”

Indeed, one of the most frustrating parts of using any technical support resource, whether you’re helping others or simply doing research, is wading through a long thread in which the experts are trying to extract all of the necessary information from the asker so they can actually offer help. Technical help sites like StackOverflow deal with this problem by using a Q&A format instead of a forum / thread format, but they still constantly delete low-quality questions in which the asker didn’t “help us help you”.

All of this to say: asking a well-written programming-related question takes a lot of effort and is not intuitive to many askers. In this post I hope I can give you some clear-cut rules for guaranteeing that your question conveys all of the information necessary for an expert to help you get the answer you need as quickly as possible. By doing so you will protect your time and theirs.


1. Keep it short, simple, and to the point

a. Your first sentence should state your question or summarize your problem.
b. Questions with unnecessary details and background explanations are harder to answer.
c. Use a bullet or number list to convey details. They’re easier to read than paragraphs.
d. Break complicated problems down into smaller problems and post about each problem separately.

2. Share the minimum amount of info necessary to completely convey the problem

a. Please post any relevant code. If you do post code:
    i. Only include code that is necessary to repeat the problem.
    ii. Your code should compile. Do not post a code snippet that others are forced to complete in order to test.
b. If you’re getting an error message, share that error message and what line it occurs on.
c. If your problem occurs only under a certain situation in SolidWorks (e.g., when a certain model is oepn):
    i. State specifically what that situation is.
    ii. Include the simplest possible model that includes that situation, if necessary.

3. Proofread your question

a. At CADSharp, we speak over fifteen languages between all of our technical support representatives. If you would prefer to receive help in another language, just ask. But no matter what language you use, be sure to proofread your question so its as clear as possible.


Let me share an example of poor a question / request:


My boss has asked me to write some macros that prepare our models for-check in. The macro needs to check each part and add a Material property if it doesn’t exist. Should also put the Description property in each configuration and the delete the Author property. Works on my test models but stopped working on my production models. Here is the code:

[code]swModel.DeleteCustomInfo2(“Default”, “test”)[/code]


Unfortunately, this help request is so lacking that I would be wasting my time even trying to help this person. The main reason is that I would be guessing as to what their problem is and might potentially solve a problem they don’t have. Specifically, this is how this question should be improved:

1. Clarify whether the macro is run in a part, assembly, or both.
2. Clarify whether custom properties are supposed to be added to assembly components or only part components.
3. Clarify whether the Description property is supposed to be moved or copied.
4. Clarify whether the Author property is deleted from the document-level custom properties, the configuration-level custom properties, or both.
5. Use bullet or number lists to differentiate the different problems.
6. Give an explanation of what “stopped working” means. Does it mean the macro runs successfully but produces incorrect results or does it mean that an error occurs (and what is the error message)? Does it refer to some or all of the tasks?
7. Include the full source code.
8. Include a sample model.

Obviously this is an exaggerated example, but I have read some help requests before like this. Keep in mind: technical support cannot read your mind. Instead of assuming they are familiar with your workflow (simply because it makes so much sense to you!), put yourself in their shoes and ask, “What would they need need to know to solve my issue?”

The XY Problem

The above guidelines assume that the asker knows what their problem is. Sometimes, this isn’t the case, and it can waste a lot of time for both the asker and the support technician. The situation I’m speaking of is known as the XY Problem. It occurs when someone asks for help with their attempted solution rather than their actual problem. A good example in the SOLIDWORKS API world would be someone asking for help on getting a point on a face so they can select it with IModelDocExtenion.SelectByID2, when in reality they should have simply asked for help on how the best way to select a particular face, because the aforementioned API call is not appropriate for selecting faces.

Basically, the XY Problem is a technical term to describe askers who are ignorantly pursuing the wrong solution. While its great to encourage people to step back and think, “What problem am I actually trying to solve?”, the XY problem itself is problematic for two reasons:

1. Sometimes its just as much a waste of time to wade through lots of background information on the problem only to discover that the user was pursuing the correct solution.
2. The simple fact is that much of the time the asker will not know enough about the subject at hand to know whether they are asking the wrong the question. In that case, it is the support technician’s responsibility to ask the questions necessary to uncover the actual problem.

I get the impression that this term was coined by support technicians or forum participants who easily get annoyed helping askers — which is frequently the case on sites like StackOverflow, some of whose users are known for their alarming rudeness and presumptuousness.

When you use CADSharp’s technical support, you can be assured that even if you’re asking the wrong question, you will always be treated with kindness and patience, because its our pleasure to help you reach your SOLIDWORKS API and PDM API automation goals.

Helping you help us help you,

Want to keep up with future content and training events? Sign up for our newsletter.

By |March 1st, 2019|0 Comments

CADSharpTools: .NET Developer Toolkit

CADSharp is pleased to announce that our industry-leading SOLIDWORKS API and SOLIDWORKS PDM API libraries are now available to CADSharp.com Power User members. This is the ultimate toolkit for those who want to speed up their .NET addin and stand-alone development by utilizing our hand-made library of commonly used functions and classes. Best of all, it’s regularly updated by CADSharp team members with great new functionality.


Possibly the best way to demonstrate the power of this toolset is to compare two addins, one that uses CADSharpTools and one that does not. These addins both accomplish the same thing: creating dropdown menus in SolidWorks that appear in particular document types and display message boxes when clicked.

You will notice that the example using CADSharpTools requires fewer imports, fewer classes, fewer lines of code (about a third less), and is much more readable. More importantly, you can imagine how much faster developing an addin is using CADSharpTools. You can set up your own template with CADSharpTools already utilized or quickly update old addins. You might even discover a better way to accomplish certain tasks using our toolset.


Note: While this is complete list of classes, the descriptions do not state all functionality in each class.

[expand title=”CTAddin”]Contains classes that let you easily create drop-down menus and CommandManager tabs (saving you possibly hundreds of lines of code), register and unregister your addin with SolidWorks, and perform “cleanup” when unloading the addin.[/expand]
[expand title=”CTAssembly”]Contains functions that let you rename components, get a component’s instance, get a component’s name without the instance number, and create an array of unique components in the assembly.[/expand]
[expand title=”CTConstants”]Contains dozens of useful file extension and file filter constants.[/expand]
[expand title=”CTDocManager”]Lets you input your Document Manager license key via the constructor and then easily work with a document’s custom properties, get a document’s configuration names, and more.[/expand]
[expand title=”CTDrawings”]Provides flexible options for searching for and updating notes, getting a note’s position relative to the sheet margin, and locating views.[/expand]
[expand title=”CTExcel”]Lets you store a spreadsheet’s contents in a .NET DataTable, get worksheet and workbook pointers, create Excel visibly or invisibly, quit Excel, and determine if any Excel processes are active.[/expand]
[expand title=”CTFileSystem”]Lets you safely create, copy, delete, and rename files and folders in Windows. You can also determine if a file is read-only, verify its extension, verify whether a file name is legal, and read text files.[/expand]
[expand title=”CTFormUtility”]Lets you sort ListView controls in ascending or descending order, as well as create file and folder browsers that add the browsed location to a text box.[/expand]
[expand title=”CTLogger”]Lets you easily handle various aspects of logging, namely creating the log entries and accessing the log folder in the user’s AppData folder.[/expand]
[expand title=”CTModel”]Performs various tasks related to two or more SolidWorks model types, including toggling graphics updating, creating named views, working with display states, creating a pack and go, and saving the model (Save or Save As) in any format.[/expand]
[expand title=”CTPart”]Performs tasks related to parts, including getting IBody2 pointer given a body name, getting a body’s folder feature, and getting a body’s cut list feature.[/expand]
[expand title=”CTSolidWorks”]Lets you create an instance of a SolidWorks (for use with a stand-alone) with the ability to specify the desired year if multiple installations are present, exit SolidWorks (for use with a stand-alone), determine if any SolidWorks processes are active, open a SolidWorks model, get a model’s document type from its file path, and get a list of all SolidWorks models of a particular type in a folder.[/expand]
[expand title=”CTTopology”]Lets you search geometry and topology, such as getting the length of an edge and getting the largest planar face in a body.[/expand]
[expand title=”CTUtility”]Lets you easily get the data from a project’s Assembly Information, display a message with the product name as the title, save out an embedded icon to the local disk and get its file path, convert an enumerator to string, and compare two values given a tolerance.[/expand]
[expand title=”CTXmlHandler”]Lets you read read a specific XML node, update a specific XML node, and get a list of all material names in a SolidWorks material database. [/expand]

How Can I Use It?

If you are a Power User member and wish to use CADSharpTools then you may visit our this page to learn how to obtain it. You can either download the DLL and add it as a reference to your project or you can copy and paste individual portions of the source code into your code. The documentation is available in the repository. You can also submit bug reports and enhancement requests using the repository’s built-in issue tracker. If you’re new to online repositories and have any questions, let us know.

Think of it as similar to our Macro Library, except 1) the entire codebase can be downloaded and referenced in a project, 2) the codebase is in .NET. As long as you kindly do not share the DLL or the code outside of your organization with individuals who aren’t CADSharp, the sky is the limit. (Note: it is fine to use the code in a project that you will sell to a customer. Please the entire Usage Agreement here.)

Want to keep up with future content and training events? Sign up for our newsletter.

By |August 13th, 2018|0 Comments

Fix These 4 Common PDM Vault Addin Errors

Have you ever attempted to develop a SOLIDWORKS PDM addin and run into errors when adding it to the vault? This short posts discusses four different types of errors one might actually see when adding a new PDM addin to a vault.

1. The DLL is not com module 

This error simply means that your DLL is com-compliant. Your types were not registered for com interops and probably are not com-visible. You can fix this by:

  • Decorating the class with the ComVisible(“true”) attribute and guid:

  • Going to Project > Build (Compile for VB.NET) and then checking register for com interop.

2. Please Select at least one DLL implementing the IEdmAddIn5 Interface


Your add-in class must  implement the IEDMAddIn5 interface.  To implement this interface, you must reference a dll that contains this interface.

  • Add a reference to <SOLIDWORKS PDM INSTALLATION FOLDER>/EPDM.interop.epdm.dll. This assumes you are writing a add-in for CLR4 (SOLIDWORKS 2013 and newer). Here’s a table that summarises the different versions of the PDM interops:
     PDM Professional versions… Support .NET Framework…
    2013 and later 4.0 and later
    2009 – 2012 3.5, 3.0, and 2.0
    2008 and earlier 2.0

    To target earlier version of the CLR, follow this link for instructions.

  • Implement the interface like follow:

    Normally, after writing MyPDMAddInClass : IEdmAddIn5, Visual Studio will show a squiggly line under IEdmAddIn5, press Ctrl + ; and then implement explicity:

3. The add-in ‘<Path>’ cannot be installed since it returned an invalid required version SOLIDWORKS PDM version from its GetAddInInfo Method

This is because of an incomplete implementation of the GetAddInInfo method. A sample implementation of the GetAddInInfo would look like this:

4. The archive server could not open  the Windows registry

This error is because of windows permissions. If you are running Windows 7/10, make sure the run the administration tool with administrator privileges.
If you have downloaded the add-in dll, make sure it’s not blocked by windows. To unblock, simply right on it and go to properties:

Questions or comments? Please share in the comments below!

Amen Jlili

Want to keep up with future CADSharp.com content and training events? Join our newsletter!

By |August 1st, 2018|0 Comments

What’s New in the 2018 SolidWorks API

SolidWorks 2018 was released over half a year ago, but it’s never too late to talk about the new enhancements in the SolidWorks API. Aside from covering new API calls, we will look at what is undoubtedly this version’s most notable upgrade: VSTA 2015. This lets programmers create .NET macros in Visual Studio instead of the lackluster VSTA editor.

New API Calls and Interfaces

Below is a list of the most notable API calls and interfaces added in SolidWorks 2018. You can see all additions and their related API calls in the Release Notes article in the API Help. You can find it in the local API Help by searching for “Release Notes” in the category tab. Note that the local API Help Release Notes will only be as up-to-date as the service pack you have downloaded.

I have bolded those API calls that I find particularly interesting. Those with an asterisk I could not find when I looked at the release notes.

  • Access general tolerance table annotations and features.
  • Work with hidden cells, rows, and columns in tables.
  • Add a distance mate between cylindrical components of an assembly.
  • Add rebuild and save marks to multiple configurations and remove them from all configurations.
  • Add specific display dimensions by type.
  • Create a spline constrained to a surface.
  • Create a trimmed sheet body with a specified tolerance.*
  • Create advanced assembly mates and sweeps.
  • Create advanced holes in parts.
  • Create bidirectional twist and thin-walled sweep features.
  • Create internal and external threads.
  • Handle pre- and post-notify events when converting bodies.
  • Import and export Hole Wizard and Toolbox data.
  • Modify control points and interior knots in sketch splines.
  • Offload PhotoView 360 rendering to other networked machines.
  • Optionally rebuild a model after adding configurations.
  • Quickly check whether an interference exists between components.
  • Save and restore the current SolidWorks settings. (Appears to mimic Copy Settings Wizard)
  • Advanced exploded view editing.
  • Set table anchors at selected sketch points on drawing sheets.
  • Show the preview of a configuration selected in the ConfigurationManager.
  • Edit third-party native CAD components in assemblies.*
  • Get corresponding objects between drawing views and parts or assemblies.
  • Get layer items by type.
  • Get or set a custom property builder template for parts or weldments.
  • Get or set whether to automatically rebuild equations.
  • Get or set whether to automatically repair files on opening.
Accessor Diagrams

New interfaces added this year not only have the typical accessor list you have come to expect but also a PDF that visually shows an interface’s accessors and the interfaces that it gives access to. At this point I don’t see myself using these very much, but perhaps others will find them helpful.

Important Updates to VSTA

VSTA (Visual Studio Tools for Applications) is the technology that allows you to create .NET macros. Previously you had to use the VSTA editor, which looked like a rudimentary version of Visual Studio but launched from SolidWorks like the VB Editor. I really despises the VSTA editor so I am pleased that creating .NET macros can now be done in Visual Studio. This change is possible because SolidWorks 2018 upgraded from VSTA 1.0 to VSTA 3.0 (also known as VSTA 2015). In the General tab of the System Settings, you can toggle between using VSTA 1.0 and 3.0 in 2018 and eventually only VSTA 3.0 will be available, therefore it is important to upgrade one’s .NET macros sooner rather than later.

Personally, I am still going to avoid .NET macros because its unclear whether the DLL stability issue that existed with VSTA 1.0 still exists in VSTA 3.0. I also have encountered numerous people who can’t get VSTA installed properly even though it is checked in the SolidWorks Installation Manager. Altogether, the hassle involved with VSTA isn’t worth it and I’d rather simply use VBA macros for testing and .NET stand-alones and addins for production. Nevertheless, if you end up using VSTA 3.0 with Visual Studio then please share your experience with us in the comments below.

To learn more about how to use VSTA 3.0, watch Daniel Seaman (SolidWorks API Tech Support Manager) deliver a presentation on the topic from SolidWorks World 2018. Steps to do this:

1. Visit the SolidWorks World 2018 agenda
2. Search the Sessions tab for the name “Seaman”
3. The result for “Upgrading SOLIDWORKS Macros to Visual Studio Tools for Applications 2015” should appear and you can click Watch Video on the right (requires a free account)

Context-Sensitive Help Viewer

According to the release notes: When you install SOLIDWORKS 2018, SOLIDWORKS and SOLIDWORKS enumerator context-sensitive helps are registered and integrated with the Help Viewer of the Visual Studio installed on your machine. After installing SOLIDWORKS 2018, configure Visual Studio to launch Help Viewer F1 help by selecting Help –> Help Preference –> Launch in Help Viewer.

To be honest, I haven’t figured out how to use this with Visual Studio Community 2017. If anyone has gotten it to work, let me know in the comments below. At this point its unclear to me if this saves that much time beyond simply creating a shortcut to apihelp.chm.

Workgroup PDM API No Longer Supported

As the title says, SolidWorks Corp is no longer offering technical support for the Workgroup PDM API since Workgroup PDM is no longer shipped with SolidWorks as of this version. Obviously the intent is to push all PDM users, even the small and mid-sized companies that Workgroup PDM was created for, toward SolidWorks PDM Standard or Professional (formerly Enterprise PDM).

Does anything we’ve covered stand out to you as particularly useful or exciting? If so then let us know in the comments!

Want to keep up with future CADSharp.com content and training events? Join our newsletter!

By |March 1st, 2018|0 Comments

Join Us At SolidWorks World 2018

We are excited to announce that we will presenting and exhibiting at SolidWorks World 2018 in Los Angeles, CA on Feb 4-7. If you’ve never been, I highly encourage you to attend this high-energy event that I like to describe as “one-third learning, one-third networking, and one-third party”. If you are a CADSharp customer or simply have an interest in the SolidWorks API, here’s some ways you can join us:

Beginner and Advanced API Presentations

Getting Serious with the SolidWorks API – Tuesday, Feb 6, 10:30 AM – 12:00 PM – Have you hit a ceiling in your API skills? Is your code a patchwork of recorded macros and other peoples’ code? Can you barely make sense of most API code? Using live examples, this session will take you take control of your code by demystifying the SOLIDWORKS API Object Model and the API Help.

Write a SolidWorks Addin From Scratch – Monday, Feb 5, 10:30 AM – 12:00 PM – Curious how professional developers create add-ins from the ground up? This hands-on session, which assumes attendees have at least a basic knowledge of object-oriented programming, will walk through DLL registration, hooking into SOLIDWORKS, menu creation, and debugging in Visual Studio.

Visit Our Exhibit Booth for Macro Mania!

Please visit us at Partner Pavilion booth 533, which is located in directly in the back of the hall near Model Mania. Our exhibit will feature customer case studies, upcoming product demos, and our own “Macro Mania”! The latter gives you opportunity to test your skills at writing a macro from scratch using only the SolidWorks API Help for reference. Top three finishers will receive an Amazon gift card.

Even if competition isn’t for you, please stop by to have a chat and learn about our upcoming products and events. For example, we will be unveiling “PMP Sandbox”, which is a tool that allows you to quickly generate PropertyManagerPages code (VBA, VB.NET, or C#) using a GUI.

Meet With Our Technical Director

If you have any interest in meeting with our Technical Director, Keith Rice, to talk about your automation needs, please email him and he’ll make sure he’s at the CADSharp booth at that time. Thanks and see you in LA!

Want to keep up with future content, training, and events like SolidWorks World? Join our monthly newsletter!

By |December 14th, 2017|0 Comments
Go to Top