Yes or no

Yes or no

etilley327KA
Advocate Advocate
439 Views
6 Replies
Message 1 of 7

Yes or no

etilley327KA
Advocate
Advocate

Hello, im trying to work on this LISP that gets a slope for a driveway and creates a text of the returning data. I still have alot of work to do, but Im having trouble with the initial selection of Yes or No. What am I doing wrong? Please help a noob.

 

(defun c:XC (/ mn dp tof tofn toc tocn dis tmn tdp mtof mtoc mdis slope mdn apron)
  (initget "Yes No")
   (if =(getkword "\nSelection? [Yes/No] <Y>: ");selection of data or manual entry
        ((setq mn(getreal "\nEnter SLOPE tolerance: "))
            (setq dp
              (cond
                ((getreal "\nEnter standard drop <Enter for 0.67>: "))
                (0.67)
              )
            )
          (setq tof (entsel "\nSelect TOF: "))
          (setq tofn (atof (getpropertyvalue tof "ELEV2")))


          (setq toc (entsel "\nSelect TOC: "))
          (setq tocn (atof (getpropertyvalue toc "ELEV2")))
         
          (setq dis (getdist tofn tocn))
        )
            (setq tmn (getreal "\nEnter SLOPE tolerance: "))
            (setq tdp
              (cond
                ((getreal "\nEnter standard drop or <Enter for 0.67>: "))
                (0.67)
              )
            )
            (setq mtof (getreal "\nEnter TOF: "))
            (setq mtoc (getreal "\nEnter TOC: "))
            (setq mdis (getreal "\nEnter Distance: "))
              (setq slope (* 100 (- mtof tdp (/ mtoc mdis)))); Slope [TOF-STANDARD DROP-TOC/DISTANCE=% SLOPE]
              (setq mdn (- mtof (+ mtoc (* tmn mdis)) 0.375)); Drop needed [TOF-(DESIRED SLOPE*DISTANCE)+TOC-0.375=DROP NEEDED]
              (setq apron (- mtof (+ 0.375 mdn))); apron [TOF-(0.375+DROP NEEDED)=RECOMMENDED APRON]
            (print slope apron mtoc mtof mdis tdp)
     
   )
(princ)
)
0 Likes
Accepted solutions (1)
440 Views
6 Replies
Replies (6)
Message 2 of 7

ВeekeeCZ
Consultant
Consultant

(progn (initget "Yes No") (getkword "\nSelection? [Yes/No] <Y>: "))

 

Copy-paste this line into the command line and try all the options and watch its returns. Then figure out the program to handle all of them accordingly.

 

BTW your current code does not really worth a commentary - so bad it is!!

0 Likes
Message 3 of 7

etilley327KA
Advocate
Advocate

Thanks, that got me past the first hurdle, but selecting "No" doesnt go down to the manual entry section. What do I need to do for that?

0 Likes
Message 4 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution
(if (/= "No" (getkword "\nSelection? [Yes/No] <Y>: "))
    (progn		; Yes
      ....)

    (progn		; No
      )
    )
0 Likes
Message 5 of 7

etilley327KA
Advocate
Advocate
Dang it, what am I doing wrong?
 
(defun c:XC (/ )
    (initget "Yes No")
    (if (/= "No" (getkword "\nSelection? [Yes/No] <Y>: "));selection of data or manual entry
      (progn    ;yes
          selection process)
        (progn    ;No
          manual entry)
     )
)
0 Likes
Message 6 of 7

etilley327KA
Advocate
Advocate

Disregard, I guess it was frozen or something. Restarted and it worked. Thanks.

0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

There is a doslib version of Yes No dcl rather than using initget, for me I use my multi radio buttons.lsp

(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(setq ans (ah:butts 1 "h"  '("Yes or No" "Yes" "No"))) 
; ans holds the button picked value

SeaHaven_0-1670626437597.png

 

 

 

 

0 Likes