Author Topic: Flexible Function to Test for Acad Release  (Read 2269 times)

0 Members and 1 Guest are viewing this topic.

matthewj

  • Newt
  • Posts: 42
  • Vanilla
Flexible Function to Test for Acad Release
« on: October 29, 2012, 06:34:51 PM »
Since I'm supporting several different version of autocad at work, I made this quick library routine to test for autocad releases.  Its pretty simple, but fairly flexible as you can use operators.
I hope someone else finds a use for it.

Code - Auto/Visual Lisp: [Select]
  1. ;######################################
  2. ;###   Get Autocad Release Number   ###
  3. ;######################################
  4. ;v 0.1   MDJ 2012
  5. ;
  6. ;(acad-ver '< "2011")     ;;return T if version is less than 2011
  7. ;(acad-ver '>= "2011")     ;;return T if version is equal to or greater than 2011
  8. ;(acad-ver '> "2009")     ;;return T if version is greater than 2009
  9.  
  10. (defun acad-ver (operator version / version-list )
  11.         (setq version-list '(
  12.                 ("R13" . 13.0)
  13.                 ("2000" . 14.0)
  14.                 ("2001i" . 15.05)
  15.                 ("2002" . 15.06)
  16.                 ("2004" . 16.0)
  17.                 ("2005" . 16.1)
  18.                 ("2006" . 16.2)
  19.                 ("2007" . 17.0)
  20.                 ("2008" . 17.1)
  21.                 ("2009" . 17.2)
  22.                 ("2010" . 18.0)
  23.                 ("2011" . 18.1)
  24.                 ("2012" . 18.2)
  25.                 ("2013" . 19.0)
  26.         ))
  27.         (if ((eval operator) (atof (getvar "ACADVER")) (cdr (assoc version version-list)))
  28.                 T
  29.                 nil
  30.         )
  31. ) ;defun

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Flexible Function to Test for Acad Release
« Reply #1 on: October 29, 2012, 09:51:29 PM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Flexible Function to Test for Acad Release
« Reply #2 on: October 30, 2012, 07:18:35 AM »
Thanks Matthew  :-)

Here's another to check file version:
http://www.theswamp.org/index.php?topic=42960.msg481835#msg481835