Cadwork Api -
This object-oriented structure makes programming with the API intuitive, as you can directly interact with virtual representations of real-world construction objects.
Design your scripts so they can be run multiple times on the same model without creating duplicate elements. Check for existing elements before generating new ones.
# Get all elements in the current selection context element_ids = cadwork.element.get_active_identification() cadwork api
def main(): # Get all currently selected/active element IDs element_ids = ec.get_active_identifiable_element_ids()
"
A new plugin is created by placing a folder (containing your Python script) inside the designated API x64 folder within the user profile’s 3D directory.
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 # Get all elements in the current selection
"I can't do it manually," Elias admitted. "I need an intervention."