乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 93|回复: 9

[编程交流] Judge cad version,If version i

[复制链接]

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 23:01:49 | 显示全部楼层 |阅读模式
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.
回复

使用道具 举报

1

主题

475

帖子

481

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 23:11:34 | 显示全部楼层
Something like this perhaps.
 

[code](if (
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 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.......
回复

使用道具 举报

1

主题

475

帖子

481

银币

初来乍到

Rank: 1

铜币
5
发表于 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
 
 
  1. (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
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 23:29:14 | 显示全部楼层
Here are some other properties/functions/system variables which may also help:
  1. (vla-get-caption (vlax-get-acad-object))(vla-get-version (vlax-get-acad-object))(getvar 'acadver)(getvar 'product)(getvar 'program)(getvar '_vernum)(ver)(_ver)
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 23:40:52 | 显示全部楼层
 
hmsilva, Thank you!
 
like this?
 
  1. (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!
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 23:42:00 | 显示全部楼层
 
Thanks ,lee ,how to Judge Express Tools is install ?
回复

使用道具 举报

1

主题

475

帖子

481

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 23:54:37 | 显示全部楼层
 
One way:
  1. ;;;;;;;;;;;;;;;;;;;;;;;;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
回复

使用道具 举报

27

主题

146

帖子

119

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
137
发表于 2022-7-5 23:59:31 | 显示全部楼层
 
Thanks hmsilva,
 
  1. ;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
回复

使用道具 举报

1

主题

475

帖子

481

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 00:06:26 | 显示全部楼层
You're welcome, andy_lee!
Glad you got it to work.
 
Henrique
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 03:32 , Processed in 0.780860 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表