Author Topic: Detect AutoCAD version  (Read 9239 times)

0 Members and 1 Guest are viewing this topic.

Daniel J. Ellis

  • Swamp Rat
  • Posts: 811
Re: Detect AutoCAD version
« Reply #15 on: January 11, 2011, 04:24:52 PM »
Thanks CAB, et al, it's the ACAD version I need, so RTOS (ACADVER) is the way to go.

I'll probably read the wikilink just to be geeky, though ^_^

Ronjonp, If I read your method right it searches for the acad.exe file and extrapolates the version from the path?  Could this differential between two different versions on the same computer (I have both R2011 and R2010 installed)?


dJE

http://en.wikipedia.org/wiki/.dwg

No info on 2011 yet.

There are many ways to do it.

Drawing version
http://www.theswamp.org/index.php?topic=6774.msg333989#msg333989

ACAD version
Code: [Select]
((= (rtos(atof(getvar "ACADVER"))2 2) "15.00") 2000))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "15.05") 2000i))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "15.06") 2002))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "16.00") 2004))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "16.10") 2005))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "16.20") 2006))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "17.00") 2007)) ; 7 8 9
 ((= (rtos(atof(getvar "ACADVER"))2 2) "18.00") 2010))
===
dJE

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Detect AutoCAD version
« Reply #16 on: January 11, 2011, 04:26:27 PM »
my version
Code: [Select]
(atoi (substr (ver) 13))

Bravo  8-)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Detect AutoCAD version
« Reply #17 on: January 11, 2011, 04:27:15 PM »
Thanks CAB, et al, it's the ACAD version I need, so RTOS (ACADVER) is the way to go.

I'll probably read the wikilink just to be geeky, though ^_^

Ronjonp, If I read your method right it searches for the acad.exe file and extrapolates the version from the path?  Could this differential between two different versions on the same computer (I have both R2011 and R2010 installed)?


dJE

http://en.wikipedia.org/wiki/.dwg

No info on 2011 yet.

There are many ways to do it.

Drawing version
http://www.theswamp.org/index.php?topic=6774.msg333989#msg333989

ACAD version
Code: [Select]
((= (rtos(atof(getvar "ACADVER"))2 2) "15.00") 2000))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "15.05") 2000i))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "15.06") 2002))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "16.00") 2004))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "16.10") 2005))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "16.20") 2006))
 ((= (rtos(atof(getvar "ACADVER"))2 2) "17.00") 2007)) ; 7 8 9
 ((= (rtos(atof(getvar "ACADVER"))2 2) "18.00") 2010))
Beware of your dimzin variable being something other than zero (suppressing zeros will cause problems when comparing strings).
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Detect AutoCAD version
« Reply #18 on: January 11, 2011, 04:37:28 PM »
personally I prefer this:
Code: [Select]
(atoi (vl-string-right-trim " (en)" (vl-string-left-trim "Visual LISP " (ver))))
Code: [Select]
(defun getacadversion (/)
  (vl-list->string
    (vl-remove-if-not (function (lambda (x) (and (> x 47) (< x 58)))) (vl-string->list (ver)))
  )
)

I like that one  8-)  Forgot about (ver)  :lol:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Detect AutoCAD version
« Reply #19 on: January 11, 2011, 04:38:33 PM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Detect AutoCAD version
« Reply #20 on: January 11, 2011, 04:39:26 PM »
my version
Code: [Select]
(atoi (substr (ver) 13))

Bravo  8-)

X2
X3
He has a way of making us all look/feel stupid and happy, at the same time.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Detect AutoCAD version
« Reply #21 on: January 11, 2011, 04:47:37 PM »
Mood has improved! Thank you :)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Detect AutoCAD version
« Reply #22 on: January 11, 2011, 05:26:24 PM »
Quote
Thanks CAB, et al, it's the ACAD version I need, so RTOS (ACADVER) is the way to go.

I'll probably read the wikilink just to be geeky, though ^_^

Ronjonp, If I read your method right it searches for the acad.exe file and extrapolates the version from the path?  Could this differential between two different versions on the same computer (I have both R2011 and R2010 installed)?

...

Whichever AutoCAD version the code is run in should match... unless for some reason the other acad path is in the search paths as well.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

did.ave

  • Guest
Re: Detect AutoCAD version
« Reply #23 on: January 12, 2011, 04:53:41 AM »
coucou

Evgeniy is always the most concise

i'm french, so I say merci

amicalement

Chris

  • Swamp Rat
  • Posts: 548
Re: Detect AutoCAD version
« Reply #24 on: January 12, 2011, 08:46:27 AM »
my version
Code: [Select]
(atoi (substr (ver) 13))

Bravo  8-)

X2
X3
He has a way of making us all look/feel stupid and happy, at the same time.
X4 - I'm changing my code.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Detect AutoCAD version
« Reply #25 on: January 12, 2011, 06:19:44 PM »