LISP for Architects: Automatically Generating Curved Stairs from an Arc
In architectural drafting, stairs are one of the most common yet repetitive elements to draw. When designing curved stairs, the process can become time-consuming because each step must be carefully distributed along a curved path while maintaining consistent spacing and alignment.
Using LISP, architects and CAD technicians can automate this process and significantly reduce drafting time. This article introduces a simple yet powerful concept: automatically generating a curved stair layout from a selected arc.
The Problem with Manual Drafting
When creating a curved stair manually in PTCAD, the typical workflow involves:
-
Drawing the center arc of the staircase.
-
Calculating the angle division for each step.
-
Drawing radial lines for each riser.
-
Adding inner and outer boundaries.
-
Labeling the steps.
For a staircase with 15–20 steps, this can easily take several minutes. In large projects where multiple stairs exist, the time spent becomes significant. In addition, manual work increases the risk of errors such as:
-
Uneven step spacing
-
Incorrect stair width
-
Misaligned riser lines
-
Inconsistent geometry
The LISP Solution
A custom LISP routine can automate the entire process. With a single command, the user simply:
-
Selects an Arc representing the stair direction.
-
Inputs the number of steps.
-
Specifies the inner and outer radius of the stair.
The script then automatically:
-
Divides the arc into equal angular segments
-
Draws riser lines between the inner and outer radius
-
Generates the stair layout instantly
This transforms a multi-step manual process into a few seconds of automated drafting.
How the Algorithm Works
The logic behind the LISP routine is straightforward:
-
Read the arc geometry:
-
Center point
-
Start angle
-
End angle
-
-
Calculate the total arc angle:
-
Divide the arc angle by the number of steps:
-
Generate radial lines using polar coordinates from the arc center.
Each step is positioned by incrementally adding the step angle and projecting points using the polar function.
Example Workflow
An architect designing a curved staircase might follow this process:
-
Draw the stair center arc.
-
Run the command:
ARCSTAIR
-
Select the arc.
-
Enter the number of steps (e.g., 12).
-
Input the inner and outer radii.
Within seconds, the stair layout is generated automatically.
Benefits for Architectural Practice
Using LISP for curved stair generation offers several advantages:
1. Speed
Tasks that normally take several minutes can be completed in seconds.
2. Accuracy
Steps are mathematically distributed along the arc, eliminating spacing errors.
3. Consistency
Every staircase in a project follows the same geometric logic.
4. Productivity
Architects and drafters can focus more on design rather than repetitive drafting work.
Typical Stair Design Considerations
When applying this automation tool, architects should still follow common stair design guidelines:
| Parameter | Typical Range |
|---|---|
| Riser Height | 150–180 mm |
| Tread Depth | 250–300 mm |
| Stair Width | 900–1500 mm |
The LISP routine simply assists in drafting the geometry; the designer still controls the parameters.
Expanding the Tool
This basic curved stair generator can be extended further to include:
-
Automatic step numbering
-
Stair UP/DOWN arrows
-
Stair width control
-
Automatic dimension placement
-
Generation of 3D stair geometry
-
Automatic stair schedule export
With these enhancements, LISP can evolve from a simple drafting aid into a powerful architectural productivity tool.
Conclusion
Curved staircases are visually elegant but can be tedious to draft manually. By leveraging LISP automation, architects can transform a repetitive process into a fast and reliable workflow.
A simple script that generates stairs from an arc demonstrates how small automation tools can dramatically improve efficiency in architectural drafting. For firms that frequently work with complex geometry, investing in custom LISP tools can lead to significant gains in both productivity and drawing quality.
Source code
r1 r2 tread i a p1 p2 mid txtpt)
(prompt "\nSelect ARC for stair centerline: ")
(setq ent (car (entsel)))
(setq ed (entget ent))
(if (= (cdr (assoc 0 ed)) "ARC")
(progn
(setq cen (cdr (assoc 10 ed)))
(setq rad (cdr (assoc 40 ed)))
(setq ang1 (cdr (assoc 50 ed)))
(setq ang2 (cdr (assoc 51 ed)))
(setq step (getint "\nEnter number of steps: "))
(setq r1 (getreal "\nInner radius: "))
(setq r2 (getreal "\nOuter radius: "))
(setq ang (/ (- ang2 ang1) step))
(prompt "\nCreating stairs...")
(setq i 0)
(while (<= i step)
(setq a (+ ang1 (* ang i)))
(setq p1 (polar cen a r1))
(setq p2 (polar cen a r2))
(command "LINE" p1 p2 "")
(setq i (+ i 1))
)
(setq i 0)
(while (< i step)
(setq a (+ ang1 (* ang (+ i 0.5))))
(setq mid (polar cen a (/ (+ r1 r2) 2)))
(setq txtpt mid)
(PRINC (ITOA i))
(setq txh (* r1 0.03))
(command "TEXT" txtpt txh 0 (itoa (+ i 1)))
(setq i (+ i 1))
)
(command "ARC" (polar cen ang1 r1) "C" cen (polar cen ang2 r1))
(command "ARC" (polar cen ang1 r2) "C" cen (polar cen ang2 r2))
(setq mid (polar cen (+ ang1 (/ (- ang2 ang1) 2)) r2))
(command "LEADER" mid (polar mid (/ pi 2) 1.0) "" "UP" "")
(prompt "\nCurved stair created successfully.")
)
(prompt "\nSelected object is not ARC.")
)
(princ)
)
No comments:
Post a Comment