CodeStack

repository·master·Indexed 43 days ago

https://github.com/xarial/codestack

An educational resource and repository of automation tools, macros, and API tutorials for SOLIDWORKS and its ecosystem, including PDM Professional API, Document Manager API, and eDrawings API. It provides code examples for Visual Basic (VBA) and C#, as well as guides for hosting eDrawings controls in Windows Forms and WPF.

Tokens
120.8K
Snippets
344
Records
619
Agent score
56%

What's inside CodeStack

  1. Overview of Geometry++ for SOLIDWORKS

    master
    Geometry++ is a SOLIDWORKS add-in designed to extend geometry creation and manipulation capabilities. It is fully integrated into the SOLIDWORKS interface, maintaining the native look and feel. A key advantage is that all features preserve parametric behavior, meaning they automatically regenerate when dependencies change within the model.
  2. Overview of SOLIDWORKS Document Manager API

    master

    The SOLIDWORKS Document Manager API is a lightweight (approx. 13 MB), stand-alone library provided by SOLIDWORKS. It allows developers to read and write metadata directly from SOLIDWORKS file streams without requiring a full SOLIDWORKS installation on the machine. Because it accesses data directly from the stream, it is significantly faster than loading full files into memory.

    Key Benefits:

    • Stand-alone: No SOLIDWORKS installation required.
    • Lightweight: Small footprint (~13 MB).
    • High Performance: Direct stream access avoids full file loading.
    • Cost: Free for SOLIDWORKS customers or partners (research, solution, or gold) on subscription.
  3. Overview of SwEx.PMPage framework

    master

    SwEx.PMPage is an advanced framework designed for developing SOLIDWORKS Property Manager Pages. It is inspired by the .NET Framework's PropertyGrid control and enables data-driven User Interface development within the SOLIDWORKS API.

    Instead of manually constructing UI elements, the framework uses a data model structure to drive the User Interface. It automatically generates the required interface and implements data binding between the model and the UI, making property pages more scalable, maintainable, and easier to extend.

  4. Overview of Visual Basic and its derivatives

    master

    Visual Basic is a Microsoft-developed programming language and IDE based on the Component Object Model (COM). While the original Visual Basic is considered legacy, its derivatives remain widely used:

    • Visual Basic for Applications (VBA): An integrated environment for creating and executing macros within applications like MS Office, SOLIDWORKS, and AutoCAD.
    • VBScript: A language used for Windows scripting and client-side web page scripting (originally the language of Active Server Pages).
    • VB.NET: An object-oriented successor to Visual Basic built on the .NET Framework.

    Key language features include an easy learning curve, COM object support (enabling Windows API access), IntelliSense, a drag-and-drop GUI environment, and automatic memory management via reference counting.

  5. Overview of CodeStack resources

    master
    CodeStack is a free online resource designed for learning programming and automating engineering software, specifically focusing on the SOLIDWORKS ecosystem. It provides hundreds of downloadable code examples, macros, and tutorials across several specialized domains including API automation and language learning.
  6. Overview of SOLIDWORKS API Automation

    master

    The SOLIDWORKS Application Programming Interface (API) is a set of libraries that exposes public functions to allow 3rd party software to invoke native SOLIDWORKS commands programmatically. Developers can use the API to:

    • Automate repetitive tasks: Implement routines for batch processing or grouping commands to reduce manual effort.
    • Develop specialized software: Build tools for specific workflows such as rendering, CAM, animation, steel fabrication, or wood fabrication.
    • Extend functionality: Add new commands to the SOLIDWORKS interface via add-ins.

    Essentially, almost any action a user can perform via the SOLIDWORKS graphical user interface can be emulated through the API.

  7. Batch export files to foreign formats via eDrawings API

    master

    This C# console application allows for the batch export of SOLIDWORKS, DXF, DWG, and eDrawings files into various foreign formats (such as .jpg, .stl, .htm, etc.) using the free version of SOLIDWORKS eDrawings API.

    Key Advantage: It does not require SOLIDWORKS to be installed or a SOLIDWORKS license to be present; it only requires the eDrawings API functionality.

  8. Batch export SOLIDWORKS files to PDF via eDrawings API

    master

    This console application (developed in VB.NET) allows for the batch export of SOLIDWORKS, DXF, and DWG files to PDF format using the free version of SOLIDWORKS eDrawings via its API.

    Key Features:

    • Does not require SOLIDWORKS to be installed.
    • Does not require a SOLIDWORKS license.
    • Supports Windows 8.1 and onwards.
    • Can be run via command line.

    Note: This functionality is also integrated into the eXport+ utility.

  9. Call SOLIDWORKS add-in functions via Running Objects Table (ROT)

    master

    You can expose an Application Programming Interface (API) within a SOLIDWORKS add-in by registering an API object in the Windows Running Objects Table (ROT). This allows stand-alone applications or scripts to call add-in functions without needing to reference SOLIDWORKS type libraries, interops, or the main add-in DLL directly.

    Key Benefits

    • Abstraction: Third-party applications only need to reference a lightweight DLL containing interface definitions.
    • Decoupling: You can control add-in functionality without direct SOLIDWORKS API commands in the client application.
    • Security: Using a proxy object pattern prevents exposing internal add-in objects to external callers.
  10. Run VBA macro on model load using Macro Feature

    master
    This tool uses the SOLIDWORKS API to insert a 'macro feature' into a model. Once inserted, the feature triggers a specific VBA macro every time the model is loaded. This is useful for automating tasks like updating custom properties or logging information upon model load. The feature is visible in the FeatureManager design tree and can be embedded into document templates.
  11. What is a SOLIDWORKS Macro Feature?

    master

    A Macro Feature is a custom element that can be added to the SOLIDWORKS Feature Manager Design tree via the SOLIDWORKS API. It behaves identically to standard SOLIDWORKS features (such as Boss-Extrude or Mate) and supports the parametric nature of SOLIDWORKS, meaning it can automatically regenerate if its parent features or dependencies change.

    Macro features are driven by three main handlers:

    1. Regeneration: Triggered when the feature is rebuilt (due to a model force rebuild or dependency updates). During this phase, the macro feature can create new bodies or act as a metadata-only element.
    2. Edit: Triggered when the user requests to edit the feature's definition.
    3. State update: Triggered whenever the feature's state changes (e.g., when the feature is selected or refreshed).

    Macro features can also store additional metadata, including dimensions and selection references.