Introduction Designing stairs in AutoCAD requires absolute geometric precision. The open-source AcadCalcStair utility automates these complex calculations, ensuring your designs comply instantly with building codes. By modifying its core source code, you can customize the underlying mathematics to fit your specific regional standards or project parameters. The Core Math: Blondel’s Theorem
At the heart of the AcadCalcStair source code is Blondel’s ancient but universally trusted formula for stair ergonomics. The code uses this relationship to balance riser height ( ) and tread run ( 2R+T=Stride Length2R plus T equals Stride Length
In the default source code, this is typically programmed using standard international architectural constants:
;; Default Blondel Limits in AcadCalcStair (setq min_stride 600.0) (setq max_stride 640.0) Use code with caution. Key Code Blocks and How to Customize Them
To modify how the utility calculates stair geometry, you must locate and edit specific functions within the source file. 1. Customizing the Ideal Riser Height
The script determines the total number of risers by dividing your total floor-to-floor height by an ideal target riser. Find the initialization block:
(defun C:AcadCalcStair ( / total_rise target_riser num_risers ) (setq target_riser 170.0) ; Default target riser in mm Use code with caution.
To Customize: Change 170.0 to match your local requirements. For example, change it to 180.0 for commercial utility stairs, or convert to inches (7.0) if working in imperial units. 2. Modifying Code Compliance Constraints
The software filters out invalid layout options using hardcoded boundary values. Look for the conditional validation function:
(defun validate_stair_math ( riser tread ) (and (<= riser 190.0) ; Maximum allowable riser height (>= tread 250.0) ; Minimum allowable tread run ) ) Use code with caution.
To Customize: If your local building code restricts risers to a maximum of 180mm and requires a minimum 280mm tread, update those values directly in the and statement to prevent the routine from generating non-compliant designs. 3. Adjusting the Proportionality Factor
If you want to shift from Blondel’s formula to the common American “Riser plus Tread” rule ( inches), rewrite the constraint logic loop:
;; Custom R+T Rule Integration (setq rt_sum (+ riser tread)) (if (and (>= rt_sum 430.0) (<= rt_sum 445.0)) ; Metric equivalent of 17-17.5 inches (print “Valid Geometry”) (print “Invalid Geometry”) ) Use code with caution. How to Compile and Load Your Custom Script
Save your modified code with a .lsp extension (e.g., CustomCalcStair.lsp). Open AutoCAD. Type APPLOAD into the command line and press Enter. Browse to your saved file, select it, and click Load.
Type AcadCalcStair (or your modified command macro) to execute your custom mathematical model. To help tailor this guide further, let me know:
Leave a Reply