Cadwork Api
The Cadwork API (Application Programming Interface) is a powerful development framework that allows users and developers to extend the core functionality of Cadwork 3D, the leading software for timber construction and BIM modeling. By using scripting languages like Python or C++, the API enables the automation of repetitive tasks, the creation of custom plugins, and the seamless integration of Cadwork data with external enterprise resource planning (ERP) or production systems. Core Capabilities and Features
The API provides deep access to the Cadwork 3D engine, allowing for programmatic manipulation of geometric and metadata elements. Key features include:
Automated Geometry Creation: Programmatically create and manipulate parts, such as beams, panels, and complex 3D connections, without manual drafting.
Data Extraction and List Generation: Automate the production of material lists, production lists, and hardware calculations directly from the 3D model.
Custom User Interfaces: Create specialized dialogs and menus using Python toolkits like Tkinter to guide users through specific workflows.
Import/Export Automation: Develop custom export routines to share data with CNC machines, web viewers, or BIM management tools. cadwork api
Element Attributes: Manage and modify an unlimited number of user attributes to structure design data for BIM compliance. Development Ecosystem
Cadwork has increasingly focused on making the API accessible through modern scripting environments:
Python Integration: Since version 27, Cadwork has offered a robust Python API (CwAPI3D). It uses CPython, allowing developers to leverage a vast ecosystem of standard and third-party libraries for complex calculations or data handling.
Integrated Learning Environment: The software includes Python IDLE, an environment for writing and testing scripts directly within the Cadwork interface.
CwAPI3D Package: For advanced users, the cwapi3d package can be installed via PyPI to enable development in professional IDEs like Visual Studio Code or PyCharm. The Cadwork API (Application Programming Interface) is a
Rhino/Grasshopper Link: Through Rhino.Inside Cadwork, developers can use Grasshopper’s visual programming to drive parametric designs directly into the Cadwork 3D environment. Practical Applications
The API is commonly used to build "helpers"—small, specific plugins that solve niche engineering problems. Examples include:
Dual Export Plugins: Simultaneously exporting shop drawings for both a container and its individual components to streamline production.
Automated Framing: Extending the standard framing modules to include specialized joinery or proprietary hardware connections.
ERP Connectivity: Linking the 3D model to external databases to ensure real-time synchronization between design and stock management. News Version 30 - cadwork 3D Cadwork API: an enlightening overview Cadwork is a
Accessing Elements
You usually work with the cwIElement interface or specific interfaces like cwIBeam.
Example: Getting selected elements
public void ProcessSelection()
selectedIds.Length == 0)
_api.messageBox("Please select an element.");
return;
// 2. Iterate through IDs
foreach (int id in selectedIds)
// Get the element interface using the ID
cwAPI.cwIElement element = _api.getElement(id);
if (element != null)
// Do something...
string name = element.getName();
double length = element.getLength();
// Output to cadwork's internal output window
_api.outputMessage($"Element: name, Length: length");
B. Modifying Attributes (User Attributes)
cadwork relies heavily on User Attributes (List Variables) for labeling and organizing.
public void SetAttributeExample(int elementId)
cwAPI.cwIElement element = _api.getElement(elementId);
// Set User Attribute 1 (Usually "Element Name" or custom field)
element.setListItem(1, "Wall_Panel_01");
// Set Group Attribute
element.setAttribute(5, "Level_01"); // Attribute 5 might be "Group"
Cadwork API: an enlightening overview
Cadwork is a suite of CAD/CAM/BIM tools popular in timber construction, carpentry, and building projects where precise joinery and fabrication data matter. The cadwork API (application programming interface) lets developers and advanced users extend, integrate, and automate cadwork workflows by exposing programmatic access to model data, geometry, and project metadata. Below is a concise, practical exploration of what the cadwork API enables, common use cases, integration patterns, and practical tips for getting started.
Step 3: Configure Debugging (Optional but Recommended)
- Go to Project Properties -> Debug.
- Select Start external program.
- Browse to the cadwork executable (e.g.,
cwexe.exe). - This allows you to hit "Start" in Visual Studio, launching cadwork with your debugger attached.
