andy_lee 发表于 2022-7-5 23:01:49

Judge cad version,If version i

Judge cad version,If version is too low,not loader and prompt.
 
I have a table routine, need cad 2005 later version,
If routine call command is "test" , so call "test" , frist,judge cad version ,if CAD2005 previous versions, not run andPop-up prompts.

hmsilva 发表于 2022-7-5 23:11:34

Something like this perhaps.
 

(if (

andy_lee 发表于 2022-7-5 23:15:45

 
hmsilva, Thanks, but not that.
 
Your routine is when "appload", check cad version and Pop-up prompts.
I mean is after appload, after input command in the command bar, after press Enter or space key, check cad version.......

hmsilva 发表于 2022-7-5 23:27:23

 
 
 
andy_lee,
you shouldn't have edited and removed the code that you had posted at msg #1...
That code is not my code, is yours, I just modified it to work with AutoCAD 2005 or later ones...
 
If I understood you correctly, perhaps something like this
 
 

(defun c:test ()(if (>= (atof (getvar 'ACADVER)) 16.1);; "16.1" AutoCAD 2005    (progn;;; your routine here      (Alert "You have the correct CAD version!!!");; just for demo    );; progn    (Alert "Need CAD2005 or later"));; if);; test
 
 
HTH
Henrique

Lee Mac 发表于 2022-7-5 23:29:14

Here are some other properties/functions/system variables which may also help:

(vla-get-caption (vlax-get-acad-object))(vla-get-version (vlax-get-acad-object))(getvar 'acadver)(getvar 'product)(getvar 'program)(getvar '_vernum)(ver)(_ver)

andy_lee 发表于 2022-7-5 23:40:52

 
hmsilva, Thank you!
 
like this?
 

(defun c:test ()(if (>= (atof (getvar 'ACADVER)) 16.1);; "16.1" AutoCAD 2005    (progn ;;;;;;;;;;;;;;;;;;;;;;;;My routine is start ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defun c:test(/ *error* dlg p a i l 1p sc e pl h gr rot r)................ ) (princ));;;;;;;;;;;;;;;;My routine is over;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;      (Alert "You have the correct CAD version!!!");; just for demo    );; progn    (Alert "Need CAD2005 or later"));; if);; test
 
1.Command must be the same?   your routine command is "test", my routine command must "test" too,
2. if version is right , show "you have the correct cad version" ,this can omit.
I mean if version is low ,show "Need Cad2005 or later" ,if is right , not prompt,Direct calling program.
 
Thanks!

andy_lee 发表于 2022-7-5 23:42:00

 
Thanks ,lee ,how to Judge Express Tools is install ?

hmsilva 发表于 2022-7-5 23:54:37

 
One way:

;;;;;;;;;;;;;;;;;;;;;;;;My routine is start ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defun c:test (/ *error* dlg p a i l 1p sc e pl h gr rot r) ;; first test AutoCAD version (if (>= (atof (getvar 'ACADVER)) 16.1);; "16.1" AutoCAD 2005    (progn;; if test returns T;; your routine start................;;your routine end    );; progn   ;; if test AutoCAD version returns nil    (Alert "Need CAD2005 or later"));; if (princ));; test;;;;;;;;;;;;;;;;My routine is over;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HTH
Henrique

andy_lee 发表于 2022-7-5 23:59:31

 
Thanks hmsilva,
 

;;your routine end );; progn ;;I delete this , OK! Otherwise an error   ;; if test AutoCAD version returns nil    (Alert "Need CAD2005 or later"));; if (princ));; test;;;;;;;;;;;;;;;;My routine is over;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

hmsilva 发表于 2022-7-6 00:06:26

You're welcome, andy_lee!
Glad you got it to work.
 
Henrique
页: [1]
查看完整版本: Judge cad version,If version i