The machine is waiting for your commands. Why type them out every single time?
Programmatically manage and structure unlimited user attributes—essential for modern, data-rich BIM models.
Retrieve selected elements to process them.
Programmatically create, modify, copy, and delete architectural components, timber beams, panels, and hardware items. cadwork api
As a developer, have you ever struggled with accessing and manipulating CAD data in your applications? Look no further! The CADwork API is here to revolutionize the way you interact with CAD files and data. In this post, we'll explore the capabilities of the CADwork API and how it can benefit your development projects.
To ensure your scripts and plugins continue to work, keep these best practices in mind:
The Definitive Guide to Cadwork API: Automating Timber Construction & 3D Engineering The machine is waiting for your commands
Don’t know the syntax for a specific tool? Turn on the "Macro Recorder" in cadwork. Do the action manually (e.g., create a mortise and tenon joint). Stop the recorder. cadwork will show you the exact API code it just used. Copy, paste, tweak.
At its core, the cadwork API is the "digital wiring" that allows external programs to communicate directly with the cadwork 3D engine. Think of it as a bridge. On one side, you have the powerful modeling capabilities of cadwork; on the other, you have the unlimited logic and processing power of a programming language like Python or C++.
import cadwork import element_controller as ec import geometry_controller as gc # Define the start and end points of the beam using 3D vectors start_point = gc.point_3d(0.0, 0.0, 0.0) end_point = gc.point_3d(3000.0, 0.0, 0.0) # 3 meters along the X-axis # Define the cross-section dimensions (Width, Height) width = 140.0 # mm height = 240.0 # mm # Create the beam element in the active 3D document new_beam_id = ec.create_square_beam(width, height, start_point, end_point) # Set an attribute for the newly created beam ec.set_name([new_beam_id], "Main Truss Chord") print(f"Successfully created beam with ID: new_beam_id") Use code with caution. Business Benefits of API Automation Retrieve selected elements to process them
What specific repetitive tasks are you hoping to automate within Cadwork?
Let's look at a practical code example. The cadwork API organizes functionalities into "controllers." For example, element_controller handles element selection, and geometry_controller handles dimensions.
Investing in custom API development yields significant returns for timber prefabrication companies: