Jump to content

COND statement help


ssm-jt

Recommended Posts

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

Link to comment
Share on other sites

(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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

(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")))

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.

Guest
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...