Try this and if it doesn't work upload a sample DWG with the landings clearly marked for me to test.
;; CAB 04.23.08
(defun c:stair2 (/ CNT DIR DN LANDING LANDLEN MAXRISERS MINRISERS P1 P2 P3 PT
PTS RISE RISER RISERCNT TOE TREAD ZDIR MaxRise MinRise MakePoly
)
(setq MaxRise 178
MinRise 172
toe 25.0
)
(setq LandLen 1105.0)
(or *tread* (setq *tread* 300))
(defun MakePoly (pts layer / zdir elv)
(setq zdir (trans '(0 0 1) 1 0 t)
elv (caddr (trans (car pts) 1 zdir))
)
(entmakex
(append
(list '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
(cons 8 layer)
(cons 90 (length pts))
(cons 70 0) ; 1 for closed 0 overwise
(cons 38 elv)
(cons 210 zdir)
)
(mapcar '(lambda (pt) (cons 10 (trans pt 1 zdir))) pts)
)
)
)
(if (and
(setq p1 (getpoint "\nPick Top of stair."))
(setq p2 (getpoint "\nPick Bottom of stair."))
(setq p3 (getpoint "\nPick Side for stair."))
)
(progn
(initget 6)
(if
(setq
tread (getint (strcat "\nEnter Tread width: <" (itoa *tread*) ">"))
)
(setq *tread* tread)
(setq tread *tread*)
)
;; adjust rise as ACAD rounding error prevents (/ 4300.0 172.0) 25
(setq rise (+ (- (cadr p1) (cadr p2)) 1e-6)
MaxRisers (fix (/ rise (float MinRise)))
MinRisers (fix (+ (/ rise (float MaxRise)) 0.99))
)
(if (= MinRisers MaxRisers)
(setq riserCnt MinRisers)
(while
(progn
(initget 6)
(setq riserCnt (getint (strcat "\nEnter number of risers ["
(itoa MinRisers) " to "
(itoa MaxRisers) "] "
)
)
)
(if (<= MinRisers RiserCnt MaxRisers)
nil ; exit loop
(princ "\nOut of range, try again.")
)
)
)
)
(setq riser (/ rise RiserCnt))
(if (zerop (rem RiserCnt 2)) ; even number
(setq landing (/ RiserCnt 2)) ;
(while
(progn
;; riser number from the bottom
(setq tmp (fix (/ MaxRisers 2.)))
(initget 6)
(setq landing (getint (strcat "\nEnter the riser # for the landing. <"
(itoa tmp) "> ")))
(or landing (setq landing tmp))
(if (< 1 landing MaxRisers)
nil
(princ "\nOut of range, try again.")
)
)
)
)
(if (> (car p1) (car p3)) ; stair left
(setq dir pi)
(setq dir 0.0)
)
;; Start Stair at top
(setq pt p1
Pts (list pt)
dn (* pi 1.5) ; down direction
cnt RiserCnt
)
(repeat (1- RiserCnt)
(if (= landing (setq cnt (1- cnt)))
(progn
(setq pt (polar (polar pt dn Riser) (+ dir pi) toe)
Pts (cons pt Pts)
pt (polar pt dir toe)
Pts (cons (polar pt dir LandLen) Pts)
)
(makePoly pts (getvar "clayer"))
(setq pts (list pt))
(if (zerop dir)
(setq dir pi)
(setq dir 0.0)
)
)
(setq pt (polar (polar pt dn Riser) (+ dir pi) toe) ; riser
Pts (cons pt Pts)
pt (polar pt dir (+ tread toe)) ; tread
Pts (cons pt Pts)
)
)
)
;; add last riser
(setq pt (polar (polar pt dn Riser) (+ dir pi) toe)
Pts (cons pt Pts)
pt (polar pt dir toe)
Pts (cons pt Pts)
)
(makePoly pts (getvar "clayer"))
)
)
(princ)
)
(prompt "\nStair with Landing Loaded, Enter Stair2 to run.")
(princ)
cabbbb,,,, youve ace it again mannn ,,, thanks,,,,
just thought i could still push your great program,,, is there a way for this to prompt the user for its minimum/ maximum riser height then store it as the default till user change it again in the command prompt, instead of "opening the lips and amending its parameters (min. max. riser ht.)"
(setq [color=red]MaxRise 178[/color]
[color=red]MinRise 172[/color]
toe 25.0
)
,,, this would be superbbb for me, if youve have time that is,,, right now your program has been gaining popularity in my office,, thanks to you,,,
muchas gracias amigo (hope u dont mind me calling you amigo's)