Jump to content

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


andy_lee

Recommended Posts

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

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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)

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...