Hi All,
I was trying to write a function to draw the basic outline of staircase.
One or two times it worked perfectly for me. But after that it just draws some crap. Could anyone look into the code below and suggest something?
(defun c:Stp()
(setq Point (getpoint "\nPick a Point:"))
(setq Rise (getdist "\nEnter rise of each step:"))
(setq Tread (getdist "\nEnter tread of each step:"))
(setq Nos (getint "\nEnter number of steps:"))
(setq LandingAt (Getint "Number of steps in first flight:"))
(setq P1 (list (car Point) (cadr Point)))
(setq LandingLength (getdist "\nEnter Length of Landing:"))
(setq n 0)
(While (< n Nos)
(if
(<= n LandingAt)
(Progn ;If True
(Setq
P2 (polar Point (GetRad 90) Rise)
P3 (Polar P2 0 Tread)
)
)
(progn ;Else
(Setq
P2 (polar Point (GetRad 90) Rise)
P3 (Polar P2 (GetRad 180) Tread)
)
)
)
(command "LINE" Point P2 P3 "")
(Setq Point P3)
(setq n (1+ n))
);While Ends
);STP Ends
;======================================::::::
;Function to Convert Degrees to Radians::::::
;======================================::::::
(defun GetRad(Ang)
(/ (* 3.14 Ang) 180)
)