Blog about software development, automating SOLIDWORKS with macros and API, C# Visual Basic, WPF, WCF, web development, tips & tricks

CodeStack library with hundreds of SOLIDWORKS macros is now open-source

24 Jul, 2020

CodeStack is now open-source
CodeStack is now open-source

Our vision is to make the learning material and automation tools for SOLIDWORKS as accessible as possible. We maintain several open-source projects for SOLIDWORKS automation, such as CAD+ Toolset and xCAD.NET. Our library of hundreds of macros and SOLIDWORKS API tutorials at www.codestack.net is available for everyone and it is free and doesn't require registration.

We are excited to announce that we bring www.codestack.net even closer to the community and open source all content articles which are now available on GitHub.

We will continue to maintain this resource and publish new articles regularly. We would also appreciate any contributions from the community. This includes but not limited to modifying existing articles and code snippets, correcting errors, submitting new requests and bugs, etc.

The article can be modified by clicking the edit article link

Editing the CodeStack article
Editing the CodeStack article

Most of the macros and code snippets in CodeStack are stored in a separate file instead of being embedded into the article. This makes it easier to maintain.

To edit the specific macro click the Edit Code Snippet button next to the snippet

Editing code snippet
Editing code snippet

You can also fork the full repository at github.com/xarial/codestack

Button to fork GitHub repository
Button to fork GitHub repository

If you have any questions do not hesitate to contact us at info@xarial.com

The video below demonstrates how it is possible to contribute to www.codestack.net

Contributing Guidelines

CodeStack is built using the Docify engine.


index.md file represents a new article. This file should be placed into the folder which will represent the part of the url. This should be a short name.

Place all of the assets related to this article (e.g. images, code snippets, etc.) at the same folder next to the index.md

Writing Content

Follow the Creating static markdown content in Docify article for the syntax of markdown used in CodeStack articles.

Currently, the only supported language is English, however, CodeStack is planning to extend its articles to other languages in the future.

Each page should contain the attribution defined in page metadata

caption: Short title of the page. This title is displayed in the table of content
title: Long title of the page. Contains the full information about the article
description: Detailed description of the article
image: Optional image associated with the article in .png or .svg format

Referencing Code Snippets

It is recommended not to embed the code snippets directly into the article as it will make maintenance more complicated. Instead, use the syntax of Code Snippet Plugin.

Place the snippet file next to the article. Use the file extensions of the corresponding language. For VBA macros use .vba extension.

Refer the snippet in the article as follows:

{% code-snippet { file-name: Macro.vba } %}

Publishing SOLIDWORKS Tool Macro

There are 2 main categories of macros published to CodeStack:

  • Educational macros. Those are showing the use of certain API, but the macro itself does not solve any problem. It is intended to be used by SOLIDWORKS API developers
  • Utility macro. Although it can be also used for educational purposes, this macro solve a certain problem and can be used by anyone, regardless of SOLIDWORKS API development skills. Such macros are published to SOLIDWORKS 'Goodies' section.

In order to declare the article as SOLIDWORKS tool, it is required to assign 2 additional attributes to the page: layout should be equal to sw-tool and group should be equal to the category of this macro. Currently, supported groups are:

  • Model
  • Materials
  • Frame
  • Developers
  • Custom Properties
  • Part
  • Assembly
  • Drawing
  • Security
  • Sketch
  • Performance
  • Geometry
  • Import/Export
  • Motion Study
  • Options
  • Cut-List

Groups list can be extended by modifying this file.

layout: sw-tool
group: Drawing
Subscribe to Newsletter

Powered by Docify