This installs the official cadwork Python interface.
A single misplaced bolt hole can ruin an expensive glulam beam on the job site.
The Cadwork API transforms the software from a standalone 3D CAD environment into a fully customizable, programmable BIM engine. By automating geometry generation, standardizing attribute assignment, and linking Cadwork directly to ERP and CNC systems, timber companies can achieve unprecedented levels of efficiency.
Then came the (Application Programming Interface). And suddenly, the library developed a ghost. cadwork api
Instead of manually drawing complex joinery or repetitive framing layouts, the API allows you to build parametric scripts. By defining inputs such as span, pitch, and timber dimensions, the script automatically calculates geometric intersections and places elements with millimeter precision. 2. Automated Joinery and Processing
This code demonstrates some common patterns: importing controller modules, retrieving element IDs, and calling API functions to manipulate the 3D environment.
import cadwork import element_controller as ec import geometry_controller as gc def create_automated_timber_beam(): # 1. Define the geometric points in 3D space start_point = gc.point_3d(0.0, 0.0, 0.0) direction_vector = gc.point_3d(1000.0, 0.0, 0.0) # 1 meter length along X-axis up_vector = gc.point_3d(0.0, 0.0, 1.0) # 2. Set dimensions (Width, Height, Length) width = 140.0 # mm height = 240.0 # mm length = 1000.0 # mm # 3. Use the element controller to generate the beam new_beam_id = ec.create_rectangular_beam_vectors(width, height, length, start_point, direction_vector, up_vector) if new_beam_id: # 4. Assign structural attributes ec.set_name([new_beam_id], "Automated_Glulam_Beam") ec.set_material([new_beam_id], "GL24h") print(f"Successfully generated beam with ID: new_beam_id") else: print("Failed to generate geometric element.") if __name__ == "__main__": create_automated_timber_beam() Use code with caution. Advanced Use Cases in Timber Engineering Parametric Truss Generators This installs the official cadwork Python interface
Mass timber projects (CLT and Glulam) require highly precise layouts. For instance, instead of manually modeling a complex glulam truss, you can write a script that takes span, height, and load inputs to draw the complete truss—including mechanical connections—in seconds. 2. ERP and Manufacturing Integration
visualization_controller : Controls how elements look in the active 3D window (colors, visibility, rendering styles). A Simple Example: Creating a Beam via Python API
By leveraging the Cadwork API, developers, engineers, and BIM managers can automate repetitive modeling tasks, build custom plugins, and create seamless data pipelines between design offices and CNC fabrication shops. What is the Cadwork API? Instead of manually drawing complex joinery or repetitive
In the modern architecture, engineering, and construction (AEC) landscape, timber construction is experiencing a massive resurgence. Driven by sustainability goals and advancements in mass timber engineering (like CLT and Glulam), speed and precision are more critical than ever. At the center of this digital fabrication revolution is Cadwork, the market-leading 3D CAD/CAM software for timber construction.
The API provides deep access to the software’s internal architecture. Here is what you can control and manipulate:
In the end, the most interesting thing about the Cadwork API is not the code. It is the question it poses to every timber engineer: Will you remain a passenger in your own tools, or will you learn to drive the machine from inside its own engine? For those who answer with Python and patience, the gantry saws roar to life—not as mindless cutters, but as collaborators.
A typical Cadwork API script follows these fundamental steps:
The script automatically populates the wall with studs at 16-inch or 24-inch centers, doubles up studs at openings (king and jack studs), and applies top/bottom plates.