how do I find out the current autocad version running using autolisp? system varibles?
|
|
|
how do I find out the current autocad version running using autolisp? system varibles?
Last edited by aaronic_abacus; 2020-06-01 at 06:23 AM.
sysvar "acadver". But you will need to translate as it returns a number+ as a string. If you have express tools loaded type _.sysvdlg
thanks dlanor, I tested across different autocad versions and got different numbers.
Last edited by aaronic_abacus; 2020-06-01 at 11:33 AM.
Try:There are code snippets to make code work with different versions usually by checking system variables as visual lisp and commands have changed over the years.Code:; Autocad version information ; BY: Tom Beauford - 7/11/2005 ; Beaufordt@LeonCountyFL.gov ; LEON COUNTY PUBLIC WORKS SURVEY & R/W SECTION ; (load "ver_name.lsp") ver_name ;============================================================= (defun c:ver_name ( / pro vlt vno strCaption) (setq pro (getvar "PRODUCT") vlt (substr (getvar "_VERNUM") 1 1) vno (substr (getvar "_VERNUM") 2) strCaption (vla-get-Caption (vlax-get-acad-object)); Thanks Matt newlen (vl-string-search " - [" strCaption) strCaption (substr strCaption 1 newlen) ) (princ "\nvno = ")(princ vno) (princ "\nstrCaption = ")(princ strCaption) (princ "\n")(princ "\n") (cond ((= vlt "R")(princ(strcat pro " 13" vno))) ((= vlt "P")(princ(strcat pro " 14" vno))) ((= vlt "T")(princ(strcat pro " 2000" vno))) ((= vlt "U")(princ(strcat pro " 2000i" vno))) ((= vlt "K")(princ(strcat pro " 2002" vno))) ((= vlt "V")(princ(strcat strCaption " 2004" vno))) ((= vlt "N")(princ(strcat strCaption " 2005" vno))) ((= vlt "Z")(princ(strcat strCaption " 2006" vno))) ((= vlt "A")(princ(strcat strCaption " 2007" vno))) ((= vlt "B")(princ(strcat strCaption " 2008" vno))) ((= vlt "C")(princ(strcat strCaption " 2009" vno))) ((= vlt "D")(princ(strcat strCaption " 2010" vno))) ((= vlt "E")(princ(strcat strCaption " 2011" vno))) ((= vlt "F")(princ(strcat strCaption " 2012" vno))) ((= vlt "G")(princ(strcat strCaption " 2013" vno))) ((= vlt "I")(princ(strcat strCaption " 2014" vno))) ((= vlt "J")(princ(strcat strCaption " 2015" vno))) ((= vlt "M")(princ(strcat strCaption " 2016" vno))) (T(princ(strcat strCaption vno))) ) (princ) )
And this for CIV3d apologise for not having authors name.
Code:; vercheck.lsp version check for *aecc objects (defun ah:vercheck ( / vrsn appstr) (vl-load-com) (setq acApp (vlax-get-acad-object)) (setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) ) C3D (vl-registry-read C3D "Release") C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1)) ) ) (setq *AeccDoc*(vla-getinterfaceobject (vlax-get-acad-object) (strcat "AeccXUiLand.AeccApplication." C3D) ) ) (princ) )Code:;vercheck.lsp version check for *aecc objects (defun ah:vercheck ( / vrsn appstr) (vl-load-com) (if ((lambda (vrsn) (cond ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09 ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;2010 ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;2011 ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;2012 ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;2013 ((vl-string-search "R19.1" vrsn)(setq appstr "10.3"));;2014 ((vl-string-search "R20.0" vrsn)(setq appstr "10.4"));;2015 ((vl-string-search "R20.1" vrsn)(setq appstr "10.5"));;2016 ((vl-string-search "R21.0" vrsn)(setq appstr "11.0"));;2017 ((vl-string-search "R22.0" vrsn)(setq appstr "12.0"));;2018 ((vl-string-search "R23.0" vrsn)(setq appstr "13.0"));;2019 ((vl-string-search "R23.1" vrsn)(setq appstr "13.2"));;2020 ((alert "This version of C3D not supported!")) ) ) (vlax-product-key) ) ; end if condition progn is true (progn (cond (*AeccDoc*) ((setq *AeccDoc* (vlax-get (cond (*AeccApp*) ((setq *AeccApp* (vla-getinterfaceobject (cond (*Acad*) ((setq *Acad* (vlax-get-acad-object))) ) (strcat "AeccXUiLand.AeccApplication." appstr) ) ) ) ) 'ActiveDocument ) ) ) ) ; end main cond ) ; end progn ) ; end if vsrn )
R.K. McSwain | CAD Panacea |