Author Topic: COND vs LISTS question  (Read 465 times)

0 Members and 1 Guest are viewing this topic.

V-Man

  • Bull Frog
  • Posts: 332
  • I exist therefore I am!
COND vs LISTS question
« on: March 17, 2017, 10:48:54 am »

Hi guys,

I am trying to find the best, easiest solution to my code. From the code below I am getting the drawing name and then from that I am also able to extract the floor number base on how we name our drawings. I am then writing a condition statement  for when the floor number matches then assign a variable base on the floor number.

Code: [Select]
(setq DV:FILE-NAME (strcase (getvar "DWGNAME")));Retrieve Drawing Name
(setq DV:FLOOR-NUMBER (substr DV:FILE-NAME 5 2));Retrieve Floor Number

Code: [Select]
(cond
         ((= DV:FLOOR-NUMBER 01) (progn (setq DV:DRAWING-TITLE "1ST FLOOR PLAN")))
         ((= DV:FLOOR-NUMBER 02) (progn (setq DV:DRAWING-TITLE "2ND FLOOR PLAN")))
         ((= DV:FLOOR-NUMBER 03) (progn (setq DV:DRAWING-TITLE "3RD FLOOR PLAN")))
         ((= DV:FLOOR-NUMBER 04) (progn (setq DV:DRAWING-TITLE "4TH FLOOR PLAN")))
         ((= DV:FLOOR-NUMBER 05) (progn (setq DV:DRAWING-TITLE "5TH FLOOR PLAN")))
         )end Cond

I have a list of floors "written out" below which is just a snippet of the entire list  but if I code it with Cond then it will be very long. How can I accomplish this so the code is more manageable? Is the answer LISTS? I'm just not sure.

Code: [Select]
01:FIRST FLOOR
02:SECOND FLOOR
03:THIRD FLOOR
04:FOURTH FLOOR
05:FIFTH FLOOR


Thanks for any assistance.

AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012

Grrr1337

  • Bull Frog
  • Posts: 398
Re: COND vs LISTS question
« Reply #1 on: March 17, 2017, 11:27:36 am »
From what I know: cond for a bunch of evaluations, represents vl-some for unevaluated list (that consists functions to be evaluated).
So the alternative ways (using lists) are :

vl-some
Code - Auto/Visual Lisp: [Select]
  1. (setq DV:DRAWING-TITLE
  2.  (vl-some '(lambda (a b) (if (= a DV:FLOOR-NUMBER) b))
  3.    '(01 02 03 04 05)
  4.    '("1ST FLOOR PLAN" "2ND FLOOR PLAN" "3RD FLOOR PLAN" "4TH FLOOR PLAN" "5TH FLOOR PLAN")
  5.  ); vl-some
  6. ); setq
  7.  
But if its possible avoid lambda evaluation, especially when you can use list accessors like assoc / nth :

assoc
Code - Auto/Visual Lisp: [Select]
  1. (setq DV:DRAWING-TITLE
  2.  (cadr
  3.    (assoc DV:FLOOR-NUMBER
  4.      '((01 "1ST FLOOR PLAN")
  5.        (02 "2ND FLOOR PLAN")
  6.        (03 "3RD FLOOR PLAN")
  7.        (04 "4TH FLOOR PLAN")
  8.        (05 "5TH FLOOR PLAN")
  9.      )
  10.    )
  11.  )
  12. ); setq

nth
Code - Auto/Visual Lisp: [Select]
  1. (setq DV:DRAWING-TITLE
  2.  (nth (1- DV:FLOOR-NUMBER)
  3.    '("1ST FLOOR PLAN" "2ND FLOOR PLAN" "3RD FLOOR PLAN" "4TH FLOOR PLAN" "5TH FLOOR PLAN")
  4.  )
  5. ); setq



V-Man

  • Bull Frog
  • Posts: 332
  • I exist therefore I am!
Re: COND vs LISTS question
« Reply #2 on: March 17, 2017, 11:47:11 am »
Quote
(setq DV:DRAWING-TITLE
  (cadr
    (assoc DV:FLOOR-NUMBER
      '((01 "1ST FLOOR PLAN")
        (02 "2ND FLOOR PLAN")
        (03 "3RD FLOOR PLAN")
        (04 "4TH FLOOR PLAN")
        (05 "5TH FLOOR PLAN")
      )
    )
  )
); setq

I like this method. Thanks for the input. In my case the floor number is a string not an integer. So I had to place quotes around them.


Code: [Select]
(setq DV:DRAWING-TITLE
  (cadr
    (assoc DV:FLOOR-NUMBER
      '(("01" "1ST FLOOR PLAN")
        ("02" "2ND FLOOR PLAN")
        ("03" "3RD FLOOR PLAN")
        ("04" "4TH FLOOR PLAN")
        ("05" "5TH FLOOR PLAN")
      )
    )
  )
); setq

AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012

ronjonp

  • Needs a day job
  • Posts: 6334
Re: COND vs LISTS question
« Reply #3 on: March 17, 2017, 02:08:59 pm »
You could do something like this so you don't need to keep a list :) .
*Code removed because it didn't work.
« Last Edit: March 20, 2017, 08:54:20 am by ronjonp »

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 11800
  • AutoCAD 2015 Windows 7 London, England
Re: COND vs LISTS question
« Reply #4 on: March 17, 2017, 02:40:23 pm »
Here's another:
Code - Auto/Visual Lisp: [Select]
  1. (defun floornumber ( str )
  2.    (   (lambda ( n ) (strcase (strcat (itoa n) (LM:ordinal n) " FLOOR PLAN"))) (atoi str))
  3. )
  4. (defun LM:ordinal ( n )
  5.    (cond
  6.        (   (< 10 (rem n 100) 14) "th")
  7.        (   (nth  (rem n 10) '(nil "st" "nd" "rd")))
  8.        (   "th"   )
  9.    )
  10. )
Code - Auto/Visual Lisp: [Select]
  1. _$ (floornumber "3")
  2. "3RD FLOOR PLAN"
  3. _$ (floornumber "13")
  4. "13TH FLOOR PLAN"

@Ron  :wink::
Code - Auto/Visual Lisp: [Select]
  1. _$ (_floornumber "13")
  2. "13RD FLOOR PLAN"

Grrr1337

  • Bull Frog
  • Posts: 398
Re: COND vs LISTS question
« Reply #5 on: March 17, 2017, 04:24:24 pm »
Lee, I really like your LM:ordinal function, so I wrote this version for Bulgarian language:
Code: [Select]
(defun LM:ordinal_Bulgarian ( n / nl L s )
  (if (numberp n)
    (progn
      (setq nl (read (last (setq L (mapcar 'chr (vl-string->list (setq s (vl-prin1-to-string n))))))))
      (strcat s
        (cond
          ( (nth n '("лев" "ви" "ри")) )
          ( (vl-position n '(7 8)) "ми")
          ( (vl-position n '(3 4 5 6 9 10 11 12 13 14 15 16 17 18 19)) "ти")
          ( (zerop nl)
            (if (vl-every 'zerop (mapcar 'read (list (car (reverse L)) (cadr (reverse L))))) "ен" "ти")
          )
          ( (nth nl '(nil "ви" "ри")) )
          ( (vl-position nl '(7 8)) "ми")
          (T "ти")
        ); cond
      )
    ); progn
  ); if
); defun

ronjonp

  • Needs a day job
  • Posts: 6334
Re: COND vs LISTS question
« Reply #6 on: March 17, 2017, 05:02:33 pm »
Here's another:
Code - Auto/Visual Lisp: [Select]
  1. (defun floornumber ( str )
  2.    (   (lambda ( n ) (strcase (strcat (itoa n) (LM:ordinal n) " FLOOR PLAN"))) (atoi str))
  3. )
  4. (defun LM:ordinal ( n )
  5.    (cond
  6.        (   (< 10 (rem n 100) 14) "th")
  7.        (   (nth  (rem n 10) '(nil "st" "nd" "rd")))
  8.        (   "th"   )
  9.    )
  10. )
Code - Auto/Visual Lisp: [Select]
  1. _$ (floornumber "3")
  2. "3RD FLOOR PLAN"
  3. _$ (floornumber "13")
  4. "13TH FLOOR PLAN"

@Ron  ;) :
Code - Auto/Visual Lisp: [Select]
  1. _$ (_floornumber "13")
  2. "13RD FLOOR PLAN"
Doh ! 😁

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

V-Man

  • Bull Frog
  • Posts: 332
  • I exist therefore I am!
Re: COND vs LISTS question
« Reply #7 on: March 17, 2017, 05:06:14 pm »
Thanks Lee Mac, Grrr1337 and RonjonP for the examples. For what it's worth I am providing my completed code. I know there must be a better and/or more efficient way to code this but this does work.

Any constructive criticism always welcome. You guys have a good weekend.

Thanks,

AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012

V-Man

  • Bull Frog
  • Posts: 332
  • I exist therefore I am!
Re: COND vs LISTS question
« Reply #8 on: March 18, 2017, 12:34:05 am »
Quote
(defun floornumber ( str )
    (   (lambda ( n ) (strcase (strcat (itoa n) (LM:ordinal n) " FLOOR PLAN"))) (atoi str))
)
(defun LM:ordinal ( n )
    (cond
        (   (< 10 (rem n 100) 14) "th")
        (   (nth  (rem n 10) '(nil "st" "nd" "rd")))
        (   "th"   )
    )
)

Quote
_$ (floornumber "3")
"3RD FLOOR PLAN"
_$ (floornumber "13")
"13TH FLOOR PLAN"


Hey LeeMac, I really think your approach will fit better to keep the code shorter but in my list of floors I also have uncommon floor names. For instance....

Code: [Select]
("B1" "BASEMENT 1 FLOOR PLAN")
    ("SB" "SUB-BASEMENT 1 FLOOR PLAN")
    ("M1" "MEZZANINE 1 FLOOR PLAN")
    ("R1" "ROOF 1 FLOOR PLAN")
    ("P1" "PENTHOUSE 1 FLOOR PLAN")
    ("GF" "GROUND FLOOR PLAN")

How can I accommodate these floors?

Thanks,
AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012

hanhphuc

  • Newt
  • Posts: 51
Re: COND vs LISTS question
« Reply #9 on: March 18, 2017, 02:10:43 am »
This is just simplified cond + mapcar

Code: [Select]

(setq DV:FLOOR-NUMBER "M1")

(eval
  (cons 'cond
(mapcar '(lambda (n m)
   (list (eval (cons 'eq (list DV:FLOOR-NUMBER 'n)))
(cons 'setq
       (list 'DV:DRAWING-TITLE
     (strcat m
     " FLOOR PLAN"
     )
     )
       )
)
   )
'("B1" "SB" "M1" "R1" "P1" "GF")
'("BASEMENT 1 " "SUB-BASEMENT 1 " "MEZZANINE 1 " "ROOF 1 " "PENTHOUSE 1 " "GROUND ")
)
)
  )

;"MEZZANINE 1  FLOOR PLAN"

but your data not typical or generic i prefer assoc list like Grrr
or dcl dialog

Lee's won shortest
( apply '= "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" ) ; error: too many arguments

Grrr1337

  • Bull Frog
  • Posts: 398
Re: COND vs LISTS question
« Reply #10 on: March 18, 2017, 06:39:46 am »
Nice (eval (cons 'foo L)) technique, hanhphuc!

Some more tests, just for fun:
Code - Auto/Visual Lisp: [Select]
  1. _$ (setq n 3)
  2. 3
  3. _$ (vl-some '(lambda (x) (eval (cons 'if x)))
  4.  '(
  5.    ((= n 1) "1ST")
  6.    ((= n 2) "2ND")
  7.    ((= n 3) "3RD")
  8.    ((= n 4) "4TH")
  9.    ((= n 5) "5TH")
  10.  )
  11. )
  12. "3RD"
  13. _$ (eval
  14.  (cons 'cond
  15.    '(
  16.      ((= n 1) "1ST")
  17.      ((= n 2) "2ND")
  18.      ((= n 3) "3RD")
  19.      ((= n 4) "4TH")
  20.      ((= n 5) "5TH")
  21.    )
  22.  )
  23. )
  24. "3RD"
  25. _$



But I was always wondering why something simple like this won't work:

(apply 'cond AssocList) :
Code - Auto/Visual Lisp: [Select]
  1.  '(
  2.    ((= n 1) "1ST")
  3.    ((= n 2) "2ND")
  4.    ((= n 3) "3RD")
  5.    ((= n 4) "4TH")
  6.    ((= n 5) "5TH")
  7.  )
  8. )

(vl-some 'if AssocList) :
Code - Auto/Visual Lisp: [Select]
  1.  '(
  2.    ((= n 1) "1ST")
  3.    ((= n 2) "2ND")
  4.    ((= n 3) "3RD")
  5.    ((= n 4) "4TH")
  6.    ((= n 5) "5TH")
  7.  )
  8. )
:thinking:

V-Man

  • Bull Frog
  • Posts: 332
  • I exist therefore I am!
Re: COND vs LISTS question
« Reply #11 on: March 19, 2017, 10:20:24 am »

Thanks
Quote
hanhphuc

This seems to work. Appreciate it


Quote
(setq DV:FLOOR-NUMBER "M1")

(eval
  (cons   'cond
   (mapcar   '(lambda (n m)
         (list (eval (cons 'eq (list DV:FLOOR-NUMBER 'n)))
          (cons 'setq
                (list 'DV:DRAWING-TITLE
                 (strcat    m
                    " FLOOR PLAN"
                    )
                 )
                )
          )
         )
      '("B1" "SB" "M1" "R1" "P1" "GF")
      '("BASEMENT 1 " "SUB-BASEMENT 1 " "MEZZANINE 1 " "ROOF 1 " "PENTHOUSE 1 " "GROUND ")
      )
   )
  )

;"MEZZANINE 1  FLOOR PLAN"



Code: [Select]
(setq DV:FLOOR-NUMBER "B1")
(eval
  (cons 'cond
(mapcar '(lambda (n m)
   (list (eval (cons 'eq (list DV:FLOOR-NUMBER 'n)))
(cons 'setq
       (list 'DV:DRAWING-TITLE
     (strcat m
     " FLOOR PLAN"
     )
     )
       )
)
   )
'("B9" "B8" "B7" "B6" "B5" "B4" "B3" "B2" "B1" "S9" "S8" "S7" "S6" "S5" "S4" "S3" "S2" "S1" "SB" "M9" "M8" "M7" "M6" "M5" "M4" "M3" "M2" "M1"
  "R9" "R8" "R7" "R6" "R5" "R4" "R3" "R2" "R1" "P9" "P8" "P7" "P6" "P5" "P4" "P3" "P2" "P1" "G1" "GF" "00"
  "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30"
  "31" "32" "33" "34" "35")
'("BASEMENT 9" "BASEMENT 8" "BASEMENT 7" "BASEMENT 6" "BASEMENT 5" "BASEMENT 4" "BASEMENT 3" "BASEMENT 2" "BASEMENT 1" "SUB-BASEMENT 9" "SUB-BASEMENT 8" "SUB-BASEMENT 7"
  "SUB-BASEMENT 6" "SUB-BASEMENT 5" "SUB-BASEMENT 4" "SUB-BASEMENT 3" "SUB-BASEMENT 2" "SUB-BASEMENT 1" "SUB-BASEMENT" "MEZZANINE 9" "MEZZANINE 8" "MEZZANINE 7"
  "MEZZANINE 6" "MEZZANINE 5" "MEZZANINE 4" "MEZZANINE 3" "MEZZANINE 2" "MEZZANINE 1" "ROOF 9" "ROOF 8" "ROOF 7" "ROOF 6" "ROOF 5" "ROOF 4" "ROOF 3" "ROOF 2" "ROOF 1"
  "PENTHOUSE 9" "PENTHOUSE 8" "PENTHOUSE 7" "PENTHOUSE 6" "PENTHOUSE 5" "PENTHOUSE 4" "PENTHOUSE 3" "PENTHOUSE 2" "PENTHOUSE 1" "GROUND" "GROUND" "GROUND"
  "FIRST" "SECOND" "THIRD" "FOURTH" "FIFTH" "SIXTH" "SEVENTH" "EIGHTH" "NINTH" "TENTH" "ELEVENTH" "TWELFTH" "THIRTEENTH" "FOURTEENTH" "FIFTEENTH"
  "SIXTEENTH" "SEVENTEENTH" "EIGHTEENTH" "NINTEENTH" "TWENTIETH" "TWENTY-FIRST" "TWENTY-SECOND" "TWENTY-THIRD" "TWENTY-FOURTH" "TWENTY-FIFTH"
  "TWENTY-SIXTH" "TWENTY-SEVENTH" "TWENTY-EIGHTH" "TWENTY-NINTH" "THIRTIETH" "THIRTY-FIRST" "THIRTY-SECOND" "THIRTY-THIRD" "THIRTY-FOURTH" "THIRTY-FIFTH")
)
)
  )
;"BASEMENT 1 FLOOR PLAN"
:yes:
AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012

Lee Mac

  • Seagull
  • Posts: 11800
  • AutoCAD 2015 Windows 7 London, England
Re: COND vs LISTS question
« Reply #12 on: March 19, 2017, 11:45:22 am »
At this point you might as well go back to using an association list, i.e.:
Code - Auto/Visual Lisp: [Select]
  1. (setq DV:DRAWING-TITLE
  2.    (strcat
  3.        (cdr
  4.            (assoc DV:FLOOR-NUMBER
  5.               '(
  6.                    ("B9" . "BASEMENT 9")
  7.                    ("B8" . "BASEMENT 8")
  8.                    ("B7" . "BASEMENT 7")
  9.                    ("B6" . "BASEMENT 6")
  10.                    ("B5" . "BASEMENT 5")
  11.                    ("B4" . "BASEMENT 4")
  12.                    ("B3" . "BASEMENT 3")
  13.                    ("B2" . "BASEMENT 2")
  14.                    ("B1" . "BASEMENT 1")
  15.                    ("S9" . "SUB-BASEMENT 9")
  16.                    ("S8" . "SUB-BASEMENT 8")
  17.                    ("S7" . "SUB-BASEMENT 7")
  18.                    ("S6" . "SUB-BASEMENT 6")
  19.                    ("S5" . "SUB-BASEMENT 5")
  20.                    ("S4" . "SUB-BASEMENT 4")
  21.                    ("S3" . "SUB-BASEMENT 3")
  22.                    ("S2" . "SUB-BASEMENT 2")
  23.                    ("S1" . "SUB-BASEMENT 1")
  24.                    ("SB" . "SUB-BASEMENT")
  25.                    ("M9" . "MEZZANINE 9")
  26.                    ("M8" . "MEZZANINE 8")
  27.                    ("M7" . "MEZZANINE 7")
  28.                    ("M6" . "MEZZANINE 6")
  29.                    ("M5" . "MEZZANINE 5")
  30.                    ("M4" . "MEZZANINE 4")
  31.                    ("M3" . "MEZZANINE 3")
  32.                    ("M2" . "MEZZANINE 2")
  33.                    ("M1" . "MEZZANINE 1")
  34.                    ("R9" . "ROOF 9")
  35.                    ("R8" . "ROOF 8")
  36.                    ("R7" . "ROOF 7")
  37.                    ("R6" . "ROOF 6")
  38.                    ("R5" . "ROOF 5")
  39.                    ("R4" . "ROOF 4")
  40.                    ("R3" . "ROOF 3")
  41.                    ("R2" . "ROOF 2")
  42.                    ("R1" . "ROOF 1")
  43.                    ("P9" . "PENTHOUSE 9")
  44.                    ("P8" . "PENTHOUSE 8")
  45.                    ("P7" . "PENTHOUSE 7")
  46.                    ("P6" . "PENTHOUSE 6")
  47.                    ("P5" . "PENTHOUSE 5")
  48.                    ("P4" . "PENTHOUSE 4")
  49.                    ("P3" . "PENTHOUSE 3")
  50.                    ("P2" . "PENTHOUSE 2")
  51.                    ("P1" . "PENTHOUSE 1")
  52.                    ("G1" . "GROUND")
  53.                    ("GF" . "GROUND")
  54.                    ("00" . "GROUND")
  55.                    ("01" . "FIRST")
  56.                    ("02" . "SECOND")
  57.                    ("03" . "THIRD")
  58.                    ("04" . "FOURTH")
  59.                    ("05" . "FIFTH")
  60.                    ("06" . "SIXTH")
  61.                    ("07" . "SEVENTH")
  62.                    ("08" . "EIGHTH")
  63.                    ("09" . "NINTH")
  64.                    ("10" . "TENTH")
  65.                    ("11" . "ELEVENTH")
  66.                    ("12" . "TWELFTH")
  67.                    ("13" . "THIRTEENTH")
  68.                    ("14" . "FOURTEENTH")
  69.                    ("15" . "FIFTEENTH")
  70.                    ("16" . "SIXTEENTH")
  71.                    ("17" . "SEVENTEENTH")
  72.                    ("18" . "EIGHTEENTH")
  73.                    ("19" . "NINTEENTH")
  74.                    ("20" . "TWENTIETH")
  75.                    ("21" . "TWENTY-FIRST")
  76.                    ("22" . "TWENTY-SECOND")
  77.                    ("23" . "TWENTY-THIRD")
  78.                    ("24" . "TWENTY-FOURTH")
  79.                    ("25" . "TWENTY-FIFTH")
  80.                    ("26" . "TWENTY-SIXTH")
  81.                    ("27" . "TWENTY-SEVENTH")
  82.                    ("28" . "TWENTY-EIGHTH")
  83.                    ("29" . "TWENTY-NINTH")
  84.                    ("30" . "THIRTIETH")
  85.                    ("31" . "THIRTY-FIRST")
  86.                    ("32" . "THIRTY-SECOND")
  87.                    ("33" . "THIRTY-THIRD")
  88.                    ("34" . "THIRTY-FOURTH")
  89.                    ("35" . "THIRTY-FIFTH")
  90.                )
  91.            )
  92.        )
  93.        " FLOOR PLAN"
  94.    )
  95. )

V-Man

  • Bull Frog
  • Posts: 332
  • I exist therefore I am!
Re: COND vs LISTS question
« Reply #13 on: March 19, 2017, 03:39:26 pm »
Quote
(setq DV:DRAWING-TITLE
    (strcat
        (cdr
            (assoc DV:FLOOR-NUMBER
               '(
                    ("B9" . "BASEMENT 9")
                    ("B8" . "BASEMENT 8")
                    ("B7" . "BASEMENT 7")
                    ("B6" . "BASEMENT 6")
                    ("B5" . "BASEMENT 5")
                    ("B4" . "BASEMENT 4")
                    ("B3" . "BASEMENT 3")
                    ("B2" . "BASEMENT 2")
                    ("B1" . "BASEMENT 1")
                    ("S9" . "SUB-BASEMENT 9")
                    ("S8" . "SUB-BASEMENT 8")
                    ("S7" . "SUB-BASEMENT 7")
                    ("S6" . "SUB-BASEMENT 6")
                    ("S5" . "SUB-BASEMENT 5")
                    ("S4" . "SUB-BASEMENT 4")
                    ("S3" . "SUB-BASEMENT 3")
                    ("S2" . "SUB-BASEMENT 2")
                    ("S1" . "SUB-BASEMENT 1")
                    ("SB" . "SUB-BASEMENT")
                    ("M9" . "MEZZANINE 9")
                    ("M8" . "MEZZANINE 8")
                    ("M7" . "MEZZANINE 7")
                    ("M6" . "MEZZANINE 6")
                    ("M5" . "MEZZANINE 5")
                    ("M4" . "MEZZANINE 4")
                    ("M3" . "MEZZANINE 3")
                    ("M2" . "MEZZANINE 2")
                    ("M1" . "MEZZANINE 1")
                    ("R9" . "ROOF 9")
                    ("R8" . "ROOF 8")
                    ("R7" . "ROOF 7")
                    ("R6" . "ROOF 6")
                    ("R5" . "ROOF 5")
                    ("R4" . "ROOF 4")
                    ("R3" . "ROOF 3")
                    ("R2" . "ROOF 2")
                    ("R1" . "ROOF 1")
                    ("P9" . "PENTHOUSE 9")
                    ("P8" . "PENTHOUSE 8")
                    ("P7" . "PENTHOUSE 7")
                    ("P6" . "PENTHOUSE 6")
                    ("P5" . "PENTHOUSE 5")
                    ("P4" . "PENTHOUSE 4")
                    ("P3" . "PENTHOUSE 3")
                    ("P2" . "PENTHOUSE 2")
                    ("P1" . "PENTHOUSE 1")
                    ("G1" . "GROUND")
                    ("GF" . "GROUND")
                    ("00" . "GROUND")
                    ("01" . "FIRST")
                    ("02" . "SECOND")
                    ("03" . "THIRD")
                    ("04" . "FOURTH")
                    ("05" . "FIFTH")
                    ("06" . "SIXTH")
                    ("07" . "SEVENTH")
                    ("08" . "EIGHTH")
                    ("09" . "NINTH")
                    ("10" . "TENTH")
                    ("11" . "ELEVENTH")
                    ("12" . "TWELFTH")
                    ("13" . "THIRTEENTH")
                    ("14" . "FOURTEENTH")
                    ("15" . "FIFTEENTH")
                    ("16" . "SIXTEENTH")
                    ("17" . "SEVENTEENTH")
                    ("18" . "EIGHTEENTH")
                    ("19" . "NINTEENTH")
                    ("20" . "TWENTIETH")
                    ("21" . "TWENTY-FIRST")
                    ("22" . "TWENTY-SECOND")
                    ("23" . "TWENTY-THIRD")
                    ("24" . "TWENTY-FOURTH")
                    ("25" . "TWENTY-FIFTH")
                    ("26" . "TWENTY-SIXTH")
                    ("27" . "TWENTY-SEVENTH")
                    ("28" . "TWENTY-EIGHTH")
                    ("29" . "TWENTY-NINTH")
                    ("30" . "THIRTIETH")
                    ("31" . "THIRTY-FIRST")
                    ("32" . "THIRTY-SECOND")
                    ("33" . "THIRTY-THIRD")
                    ("34" . "THIRTY-FOURTH")
                    ("35" . "THIRTY-FIFTH")
                )
            )
        )
        " FLOOR PLAN"
    )
)

Thanks LeeMac.
AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012