Jump to content

while function recall previous line to set new value


Recommended Posts

Posted (edited)
(defun c:Stair ()

(setq p1 (getpoint "\nEnter first insertion point: "))
(setq p2 (getpoint p1 "\nEnter second insertion point: "))

(setq flh (getdist "\nEnter floor height: "))
(setq fln (getint "\nEnter number of floor: ")) 
(setq rsn (getint "\nEnter number of riser: "))
(setq hr (getdist "\nEnter horizontal run: "))

(setq rh (/ flh rsn))
(setq td (- rsn 2))

(while (> rh 0.190)
    (princ "\nPlease enter height less than 0.190 m:")
    (setq rh (/ flh (getint)))

(setq fstfn (getint "\nFirst flight steps: "))

(While (>  fstfn 15)
      (princ "Enter steps  less than 15: ")
      (setq fstfn (getint))

(setq mdw (getdist  "\nEnter mid-landing depth: "))

(While(< mdw 1.20)  
      (princ "Enter mid-landing depth greater than 1.20 m: ")
      (setq mdw (getdist))

(setq tdn (- fstfn 1))  
(setq tdw (/ (- hr mdw) tdn))

(While(< tdw 0.30)  
      (princ "Enter tread depth greater than 0.30 m: ")
      (setq tdw (/ (- hr mdw) (getint)))

; Turn off OSNAP
(setvar "osmode" 0)

(Setq s1 p1)

(Repeat fstfn
(setq r1 (polar s1 (* pi 0.5) rh))
(setq t1 (polar r1 0 tdw))
(command "line"  s1 r1 t1 "")
(Setq s1 t1)

(command "line"  t1 "@1.5<0" "")

; Turn on OSNAP
(setvar "osmode" 511)


Enter mid-landing depth greater than 1.20 m: 1.2
; error: bad argument type: numberp: nil

while function not carry value of point 

Edited by maahee
Link to comment
Share on other sites

6 hours ago, fuccaro said:


(setq hr  (getdist "\nEnter horizontal run: "))

Link to comment
Share on other sites

Very nice @marko_ribar.


@maahee there is rules about stairs re rise and run. A better approach is to pick start point ground floor and end point 1st floor then work out the rise and runs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...