Problem with IF/OR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Afternoon Forum,
I have this program which allows the user to select a color from a pre-defined list for a particular plant when that plant is inserted. You can see from the code the plant is called "Bougainvillea Bush". RIght above that you will see the entire list of plants which have custom colors. I have been unable so far to incorporate any of the other plant types into the list to be able to select a color from a pre-defined set. Whenever I copy the code to define the color list, I cannot get it to work. I think my problem is with the IF/OR function or maybe with the placement of the code. The working code is:
;;; USE : (PLANTINSERT "PLANTTYPE" "PLANTNAME" "BOTANICALNAME")
(DEFUN PLANTINSERT (PLANTTYPE PLANTNAME PLNTBOTNM / COLR PNT SCL prntstr)
(GV)
(0V)
(SETVAR 'CMDECHO 1)
(setvar 'nomutt 0)
(dict-put PLANTNAME "botanical" (strcase PLNTBOTNM T))
(GETPLNTSIZ PLANTNAME)
(if (or (= PLANTNAME "Crape Myrtle")
(= PLANTNAME "Oleander")
(= PLANTNAME "Oleander Bush")
(= PLANTNAME "Dwarf Oleander")
(= PLANTNAME "Hibiscus")
(= PLANTNAME "Katie Ruellia")
(= PLANTNAME "Lady Banks Rose")
(= PLANTNAME "Rose")
(= PLANTNAME "Bougainvillea Bush")
(= PLANTNAME "Lemon")
(= PLANTNAME "Lime")
(= PLANTNAME "Orange")
(= PLANTNAME "Grapefruit")
(= PLANTNAME "Apricot")
(= PLANTNAME "Tangerine")
(= PLANTNAME "Tangelo")
(= PLANTNAME "Nectarine")
)
(if (= PLANTNAME "Bougainvillea Bush")
(progn
(initget 1 "OUG ANG ARB LA RAI RAS ROS SUP TEM")
(setq COLR (GETKWORD "\n\t\ *>> Select Type [bOUGainvillea sp./bANGkok red/bARBara karst/LA jolla/RAInbow gold/RASberry ice/ROSenka/SUPerstition gold/TEMple fire]: "))
(cond ((= COLR "OUG") (setq COLR "Bougainvillea sp."))
((= COLR "ANG") (setq COLR "Bangkok Red"))
((= COLR "ARB") (setq COLR "Barbara Karst"))
((= COLR "LA") (setq COLR "La Jolla"))
((= COLR "RAI") (setq COLR "Rainbow Gold"))
((= COLR "RAS") (setq COLR "Rasberry Ice"))
((= COLR "ROS") (setq COLR "Rosenka"))
((= COLR "SUP") (setq COLR "Superstition Gold"))
((= COLR "TEM") (setq COLR "Temple Fire"))
)
(dict-put PLANTNAME "COLOR" (strcase COLR))
)
(progn (setq prntstr (strcat "\n\t\ =>> What Color " PLANTNAME " : "))
(dict-put PLANTNAME "COLOR" (setq COLR (getstring T prntstr)))
)
)
)
And I was trying to insert this:
(if (= PLANTNAME "Orange")
(progn
(initget 1 "ARI NAV BLO VAL TRO")
(setq COLR (GETKWORD "\n\t\ *>> Select Type [ARIzona Sweet/NAVel/BLOod/VALencia/TROvita]: "))
(cond ((= COLR "ARI") (setq COLR "Arizona Sweet"))
((= COLR "NAV") (setq COLR "Navel"))
((= COLR "BLO") (setq COLR "Blood"))
((= COLR "VAL") (setq COLR "Valencia"))
((= COLR "TRO") (setq COLR "Trovita"))
)
(dict-put PLANTNAME "COLOR" (strcase COLR))
)
(progn (setq prntstr (strcat "\n\t\ =>> What Color " PLANTNAME " : "))
(dict-put PLANTNAME "COLOR" (setq COLR (getstring T prntstr)))
)
)
Thanks for looking and for any help in advance.
Matt