乐筑天下

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

[编程交流] overwrite _open

[复制链接]

18

主题

78

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
90
发表于 2022-7-5 19:57:48 | 显示全部楼层 |阅读模式
Hi Guys
This Code worked in some form on my last computer i have attempted to fix it. it appears that i cannot overwrite the "_open" function is there a variable for this.
  1. ;        variables set(setq tilemodevar (getvar "tilemode"))(setq varCPROFILE (getvar "CPROFILE"))(setq varFILEDIA (getvar "FILEDIA"));        close windows(COMMAND "EXTERNALREFERENCESCLOSE")(COMMAND "LAYERCLOSE")(COMMAND "PROPERTIESCLOSE")(COMMAND "ADCCLOSE");        Open drawing from vault(if (= varCPROFILE "profile_name")(progn(defun c:_open ()     (command"_vltopen"""     ) ;_ end of command ) ;_ end of progn );_ end of if (command "_open")   );_ end of defun;        autocad variables unset(setvar "FILEDIA" FILEDIAvar)
I use this to overwrite _open so when i am in a particular profile and press ctrl+O it used _vltopen
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 20:21:02 | 显示全部楼层
Check out Undefine and Redefine look at help pretty self explaining
回复

使用道具 举报

18

主题

78

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
90
发表于 2022-7-5 20:42:40 | 显示全部楼层
I have fixed it with the undefine and redefine commands as BIGAL suggested
Thanks BIGAL you legend
Work to the extent i need it to.
Startup File
  1. ; vault open(command "redefine" "open")(command "undefine" "open")(defun c:open () (progn   (load "VLT_DWG_OPEN.lsp")     ))
VLT_DWG_OPEN.lsp
  1. ;        variables set(setq tilemodevar (getvar "tilemode"))(setq varCPROFILE (getvar "CPROFILE"))(setq varFILEDIA (getvar "FILEDIA"))    ;        close windows(COMMAND "EXTERNALREFERENCESCLOSE")(COMMAND "LAYERCLOSE")(COMMAND "PROPERTIESCLOSE")(COMMAND "ADCCLOSE");        Open drawing from vault(if (= varCPROFILE "vaultprofile") (progn   (command "redefine" "open")   (command "undefine" "open")   (Defun vltautoopen ()     (command"_vltopen"""     ) ;_ end of command   ) ;_ end of Defun   (vltautoopen) ) ;_ end of progn (command "redefine" "_open")) ;_ end of if;        autocad variables unset(setvar "FILEDIA" FILEDIAvar)
 
getting this error but it still works
  1. _open Unknown command "OPEN".  Press F1 for help.1
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 20:47:01 | 显示全部楼层
Not sure if you need the redefine and then define one after each other.
回复

使用道具 举报

18

主题

78

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
90
发表于 2022-7-5 20:59:35 | 显示全部楼层
 
i was having problems when testing because i think it was failing on the "undefine" if it was already undefined. but i am not sure if that was a problem.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 00:43 , Processed in 0.406194 second(s), 62 queries .

© 2020-2025 乐筑天下

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