ssm-jt Posted March 20, 2012 Posted March 20, 2012 what am i doing wrong with this "cond" please.....i would like it to perform both setq statements if quant-type = "A" or "L" (setq quant-type "A") (cond ((= quant-type "L")(= quant-type "A") (setq obj-startpt (getpoint"\n select approximate START point Station of object")) (setq obj-endpt (getpoint"\n select approximate END point Station of object")) )) thanks Quote
ssm-jt Posted March 20, 2012 Author Posted March 20, 2012 i would normally use the IF statement but wanted to try Cond Quote
LISP2LEARN Posted March 20, 2012 Posted March 20, 2012 (setq quant-type "A") (setq obj-startpt (getpoint"\n select approximate START point Station of object")) (setq obj-endpt (getpoint"\n select approximate END point Station of object")) (cond ((= A (distance obj-startpt obj-endpt)) (princ "Equal")) (t (princ "Not Equal")) ) (princ) Quote
David Bethel Posted March 20, 2012 Posted March 20, 2012 There are lots of ways to it: (setq quant-type "A") (cond ((or (= quant-type "L") (= quant-type "A")) (initget 1) (setq obj-startpt (getpoint"\n select approximate START point Station of object: ")) (initget 1) (setq obj-endpt (getpoint obj_startpt "\n select approximate END point Station of object: ")))) You could also use a (member) call as the boolean test: (member quant-type '("A" "L")) -David Quote
SLW210 Posted March 20, 2012 Posted March 20, 2012 Please read the CODE POSTING GUIDELINES and edit your post. Quote
pBe Posted March 22, 2012 Posted March 22, 2012 (setq quant-type "A") (set (setq x (read (cond ((= quant-type "L") (setq pr "obj-startpt")) ((= quant-type "A") "obj-endpt")))) (getpoint (strcat "\nSelect approximate " (if pr "START" "END") " point Station of object"))) Quote
Recommended Posts
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.