Skip to main content

Solidworks API Programming

From now on, I am going to talk about famous 3D modeling tool Solidworks from the scratch. Specifically speaking, this talk is about Solidworks API 2006 Programming. At first, I recommend you scrutinize API Help and establish the architecture of API in mind. Let's start.
  1. Go to http://www.solidworks.com/pages/services/APIDownloads.html and download Solidworks 2006 Online Help.
  2. Run apihelp.chm
  3. Browse Solidworks API Help in the Contents tab.
- Programmer's Guide: Must read !!
- Getting Started
  • Standalone Application and Add-in Application
    .NET (VB, C#, C++), ATL COM C++
  • Solidworks Macro and VBA script
- Solidworks API Object Model: Must check !!
  • Sldworks (Solidworks itself)
  • ModelDoc2 (Modeling Files)
  • PartDoc / AssemblyDoc / DrawingDoc

- Examples and Projects:
Very helpful example snippets and complete code for VBA and VB. But, insufficient for VB.NET, C# and particularly ATL COM C++. You can look for examples at solidworks.com's api support but not enough for novice.

- APIs:
Object description such as methods, properties and events . Programmers should always refer to these parts.

Before you dive into API programming, you should decide which kind of program you want to make because it would take longer time than you think. Program could be simple time-saving macros through the sophiscated add-in programs. Even if you are willing to make simple VB macro, Implementing the specific function generally - not specifically - requires lots of time. For example, let's say you want to select any rectangular face and add the rectangular extrusion on it using VBA, C#, C++ whatever. In this case, you should consider the normal vector of plane which could be skewed from the absolute coordinate. Chances are you confuse model and sketch coordinate. if never, you are a genius. I really envy you.

Next time, I will explain coordinate issues based on my works in detail. Go for it!

Comments

Popular posts from this blog

How to use pySW - a Python Solidworks VBA API wrapper

 Recently I found a python package called "pySW" to be useful for those who are interested in both Solidworks API programming and python language. If you are familiar with Visual Studio Code and shell command in the terminal, you can easily install and play with it. You may want to visit its author's github repository and try his sample test program. I modified a little to read the lens template and generate the variants. It is almost identical to his box generation sample program. It looks like pySW project has never been updated for last 3 years though. Once the package is installed, you need modify a few lines to make it work. Let me explain one by one.  The web page link PySW 1.4 project in PyPI:  https://pypi.org/project/pySW/ Github repository:  https://github.com/kalyanpi4/pySW Package installation and test program workaround Install pySW Run the following command. You should install other dependent python packages.  pip install pySW ...

How to Fix Microsoft Mouse 3500 Wheel Scrolling Issue - Jump or Random Movement

 It is hard to deny the fact that a mouse is one of most important peripheral devices of a desktop or laptop computer - inexpensive and portable input device. Personally I don't want to replace it with other alternatives such as trackpad, trackball or trackpoint.   Microsoft 3500 is one of reasonably priced wireless mouse products available in the market. You may experience small or large troubles while using any mouse products. I experienced jumping or random movement while scrolling the web pages or zooming a object in and out in 3D software such as Solidworks or Blender. The quick and easy actions we can take is to replace battery, check other software, restart the computer, reinstall the mouse driver, switch USB port, and so on. Since my gut told me it would be a physical issue, I decided to open the mouse and check the wheel.   First I thought simply cleaning dust around the wheel would be sufficient. According to previous experiences of other mouse product...

Solidworks API Programming: Centerline Macro

Solidworks API Programming Part 2: Sketching the cross center line on random rectangular surface Precisely speaking, this program is for the random surface which has even number of edges. Nevertheless, this program is used to draw centerline within sketch on the surface. No matter how it forms angle with front, top or right plane, program should sketch the centerline correctly. So it's not simple. To do so, I need to consider transformation between 3D space and 2D sketch coordinates. Of course This kind of transformation function is supported by Solidworks API. Way to go! 1. Make new macro Just click Tools - Macro - New 2. Source code analysis In VBA, Comment symbol is ' (single quotation) and Continuation symbol is _ (underscore). '-------------------------------------- ' ' Preconditions: ' (1) Part or assembly is open. ' (2) Face is selected. ' ' Postconditions: Plane or face on which ' selected sket...