Jump to content
andy_lee

Judge cad version,If version is too low,not loader and prompt.

Recommended Posts

andy_lee

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 and Pop-up prompts.

Edited by andy_lee

Share this post


Link to post
Share on other sites
hmsilva

Something like this perhaps.

 

(if (<= (atof (getvar 'ACADVER)) 16.1);; "16.1" AutoCAD 2005
 (progn
   (Alert
     "Need CAD2005 or later"
   )
   (exit)
 )
)

 

hope that helps

Henrique

Share this post


Link to post
Share on other sites
andy_lee
Something like this perhaps.

 

(if (<= (atof (getvar 'ACADVER)) 16.1);; "16.1" AutoCAD 2005
 (progn
   (Alert
     "Need CAD2005 or later"
   )
   (exit)
 )
)

 

hope that helps

Henrique

 

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.......

Share this post


Link to post
Share on other sites
hmsilva
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.......

 

 

 

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

Edited by hmsilva

Share this post


Link to post
Share on other sites
Lee Mac

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)

Share this post


Link to post
Share on other sites
andy_lee
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

 

hmsilva, Thank you!

 

like this?

 

(defun c:[color="red"]test[/color] ()
  (if (>= (atof (getvar 'ACADVER)) 16.1);; "16.1" AutoCAD 2005
    (progn 
;;;;;;;;;;;;;;;;;;;;;;;;My routine is start ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:[color="red"]test[/color](/ *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!

Share this post


Link to post
Share on other sites
andy_lee
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)

 

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

Share this post


Link to post
Share on other sites
hmsilva
hmsilva, Thank you!

 

like this?

 

(defun c:[color=red]test[/color] ()
  (if (>= (atof (getvar 'ACADVER)) 16.1);; "16.1" AutoCAD 2005
    (progn 
;;;;;;;;;;;;;;;;;;;;;;;;My routine is start ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:[color=red]test[/color](/ *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!

 

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

Share this post


Link to post
Share on other sites
andy_lee
One way:

 

Thanks hmsilva,

 

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

Share this post


Link to post
Share on other sites
hmsilva

You're welcome, andy_lee!

Glad you got it to work.

 

Henrique

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×