Staircase section
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I got a lisp routine to draw staircase section with given details like thread width, riser height, number of steps and starting point. But sometimes it works and sometimes it draws straight lines. Please help.
(defun c:STAIRSEC ()
(prompt "\nDraw Stair Section Routine: Please follow the prompts...")
;; Ask for tread width
(setq tread-width (getreal "\nEnter tread width: "))
;; Ask for riser height
(setq riser-height (getreal "\nEnter riser height: "))
;; Ask for number of steps
(setq num-steps (getint "\nEnter number of steps: "))
;; Ask for starting point
(setq start-point (getpoint "\nEnter starting point: "))
;; Set initial x, y coordinates
(setq x (car start-point)
y (cadr start-point))
;; Loop through each step and draw
(repeat num-steps
;; Calculate points for the tread and riser
(setq tread-end (list (+ x tread-width) y))
(setq riser-top (list (+ x tread-width) (+ y riser-height)))
;; Draw tread
(command "LINE" (list x y) tread-end "")
;; Draw riser
(command "LINE" tread-end riser-top "")
;; Update x and y for the next step
(setq x (+ x tread-width))
(setq y (+ y riser-height))
)
;; Notify completion
(prompt "\nStair section completed!")
(princ)
)