What does it take to learn the SolidWorks API?

27Mar13

The SolidWorks API allows users to automate tasks in SolidWorks, thereby increasing productivity. Nevertheless, the learning the SolidWorks API can be a challenge if you don’t know where to start. In this post I want to answer the question, “What does it take to learn the SolidWorks API?”

Those interested in the SolidWorks API typically fall into one of two categories:

  1. Those wanting to hire someone who knows the SolidWorks API to write custom macros and addins.
  2. Those wanting to learn the SolidWorks API on their own, in order to write custom macros and addins.

As with any other discipline, there is always a tradeoff between time and money. If you have money but not time, you need a consultant. If you have time but not money, you may consider learning the discipline yourself.

Most engineers interested in the API fall into the second category. Then again, what engineer really has gobs of time to spend learning a new discipline? Not many of us do. Nevertheless, I can help you develop a general idea of how long it will take you to learn the API—assuming you use the best resources available.

Three Essential Skills to SolidWorks API Programming

First, let’s consider the skills that an API programming novice will need to learn in order to use the SolidWorks API:

  1. Programming using either Visual Basic for Applications, VB.NET, C#, or C++
  2. Navigating and using the SolidWorks API Help file
  3. Understanding the SolidWorks API object hierarchy

Why Are These Skills Important?

  1. API stands for “Application Programming Interface”. Without learning programming, you’re stuck using the macro recorder or copying other people’s code. Trust me, this gets old fast. If you’re new to programming, you should definitely learn the SolidWorks API using Visual Basic for Applications (VBA). It is by far the simplest language to learn and use with the API. Also, since most examples are in VBA, it is also much easier to study other people’s code. The main drawback is that you cannot write addins and stand-alones, only macros. This isn’t an issue for most automation projects, however.
  2. Whereas many help files are notorious for being useless, the SolidWorks API help file is exactly the opposite. It is essential to seriously using the SolidWorks API. Without it, researching what code to write is either tedious or impossible. That being said, it is written for programmers. Learning how to use the API Help best occurs in the context of learning basic programming.
  3. When you program with the SolidWorks API, you are constantly interacting with “objects”. These objects can refer to nearly anything you can think of within SolidWorks—a part, a feature, a face, a drawing view, a dimension, a mate, etc. These objects all have a specific relationship to one another within the SolidWorks API. Without grasping the relationships of these objects to one another, it is very difficult to quickly write API code. These relationships, formally called the SolidWorks API Object Model, are explained in summary here.

Fastest Way to Learn These Skills?

As with learning any discipline, you’re more than welcome to dive right in without any professional instruction or guidance. You can play around with the macro recorder, look at code samples you find online, try cutting and pasting your own macros together, etc. Needless to say, if you have no prior programming experience, you’ll end up with 1) sloppy code that doesn’t do a whole lot, 2) a lot of frustration because you don’t really understand how the code works (and therefore how to modify it to your needs).

Alternatively, what if you could have a professional SolidWorks API programmer sit beside you and walk you through all of the basics, and well beyond? This exact experience may not be possible, but you can get pretty close using SolidWorks API video tutorials like those found here. In particular, I recommend using dual monitors—have the video on one screen and your code editor on the other screen. Do you know of any faster ways to learn the SolidWorks API?

So what’s it really going to cost me?

The truth is, learning the SolidWorks API isn’t like learning any other SolidWorks feature. It requires skills that may be completely new to you. This means you’ll have to put in the time to practice and get better. Of course, the end result is more than worth it. Who doesn’t want to automate some or all of their workflow? Who doesn’t want to increase their company’s bottom line? Who doesn’t want to learn skills that separate them from their peers?

Do you want these things and enjoy learning? The API is for you. If you’re considering taking your first plunge into the SolidWorks API, feel free to email me if you want more advice.

Advertisements


No Responses Yet to “What does it take to learn the SolidWorks API?”

  1. Leave a Comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: