TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Biscuits on July 02, 2015, 11:23:50 AM

Title: How do I combine these
Post by: Biscuits on July 02, 2015, 11:23:50 AM
Hello everyone...hopin' to get a little help from my friends.
In the following code each of the first three lines of code work fine to acquire an attribute for modifying.
I need to comment out two of the three for the routine they reside in to work.
I'm constantly changing the  ":" to accommodate the situation.
Hope I'm making sense here.

The last line of code is my attempt to combine the first three into one. But, no go.

Any ideas?
Thanks in advance



Code: [Select]
(if (= (cdr (assoc 1 (entget ename))) "---")
:(if (= (cdr (assoc 1 (entget ename))) "MM/DD/YY")
:(if (= (cdr (assoc 1 (entget ename))) "XX/XX/XX")


(if (= (cdr (assoc 1 (entget ename))) "---" "MM/DD/YY" "XX/XX/XX")



Title: Re: How do I combine these
Post by: Keith™ on July 02, 2015, 11:43:47 AM
or?
Code: [Select]
(if (or (= (cdr (assoc 1 (entget ename))) "---")
        (= (cdr (assoc 1 (entget ename))) "MM/DD/YY")
        (= (cdr (assoc 1 (entget ename))) "XX/XX/XX")
    )
;;; do stuff here
)
Title: Re: How do I combine these
Post by: Biscuits on July 02, 2015, 11:53:24 AM
OMG....I have vapor-lock on the brain these days!
Works perfectly!
Thank you, Keith..............drinks on me!
Title: Re: How do I combine these
Post by: CAB on July 02, 2015, 12:38:00 PM
And another :
Code: [Select]
(if (vl-position  (cdr (assoc 1 (entget ename))) '("---" "MM/DD/YY" "XX/XX/XX"))
;;; do stuff here
)
Title: Re: How do I combine these
Post by: Lee Mac on July 02, 2015, 12:55:06 PM
One more:
Code - Auto/Visual Lisp: [Select]
  1. (if (wcmatch (cdr (assoc 1 (entget ename))) "---,MM/DD/YY,XX/XX/XX"))
  2.     ;;; do stuff here
  3. )
Title: Re: How do I combine these
Post by: Biscuits on July 02, 2015, 01:47:14 PM
Thanks for the replies, gang!
Obviously more than one way to skin the kat!