乐筑天下

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

[编程交流] 'Uber' Gatte

[复制链接]

55

主题

243

帖子

188

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
275
发表于 2022-7-6 12:14:20 | 显示全部楼层 |阅读模式
hi
I am trying to write some code that applies the ATTIN command across all tabs in a drawing. It cycles through the tabs but I can not seem to make the path (TextFile) work with ATTIN command. Any ideas what needs to change?
Thanks
 
  1. (defun c:UberGatte(/ TextFile OldFld LayList)(setq OldFld (getvar "filedia"))  (setvar "filedia" 0)(setq TextFile(dos_getfiled "Select a Text file for global attributes edit"       "C:\\Documents and Settings\\rxbeeto0\\Temp\"       "Text files (*.txt)|*.txt|All files (*.*)|*.*||"))(setq LayList (layoutlist))(foreach Ln LayList(setvar "CTAB" Ln)(command "ATTIN" TextFile ));foreach(setvar "filedia" OldFld)(princ));defun
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 12:19:54 | 显示全部楼层
I can not find info on ATTIN ? but I think I know the answer to your problem
 
C:\\Documents and Settings
 
Once the directory path has a space in it the file name stops try a new path without spaces (underscores etc are ok). I had to use a bit of vba code within lisps to get round this problem. If Autodesk is listening it may be a bug in the software.
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 12:25:06 | 显示全部楼层
Attin is an Express Tools' Lisp Routine. I cannot be called with (command "attin")
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 12:29:30 | 显示全部楼层
Really? I've never experienced that problem.
回复

使用道具 举报

55

主题

243

帖子

188

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
275
发表于 2022-7-6 12:30:38 | 显示全部楼层
BigAl Thanks
No  - that does not work. eg I tried C:\\Temp\\ and I still have the same problem.
There is info regarding ATTIN command. You need to go to express tools and then HELP.
As ATTIN is not compiled I could edit the file but I am not really sure how to.
Perhaps someone could help me?
回复

使用道具 举报

55

主题

243

帖子

188

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
275
发表于 2022-7-6 12:37:36 | 显示全部楼层
Hi Alanjt - So if I can not use (command "ATTIN" ....
then what do I use?
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 12:41:35 | 显示全部楼层
 
 
Have to do a little research and get a little creative:
 
Completely untested, since I know nothing about AttIn.
 
  1. (defun c:UberGatte (/ TextFile) (and   (or bns_attin (load (findfile "attout.lsp") nil))   (setq TextFile (getfiled "Select a Text file for global attributes edit"                            "C:\\Documents and Settings\\rxbeeto0\\Temp\"                            "txt;*"                            8                  ) ;_ getfiled   ) ;_ setq   (foreach Ln (layoutlist)     (setvar "CTAB" Ln)     (if (equal 4 (logand 4 (getvar "cmdactive")))       (bns_attin TextFile nil) ;a script is running so no interactive placement       (bns_attin TextFile T) ;Allow interactive placement     ) ;_ if   ) ;_ foreach ) ;_ and (princ)) ;_ defun
I hope you don't mind, I did a little reworking on your code. BTW, you can use getfiled when only needing to select 1 file and avoid relying on dos_lib.
回复

使用道具 举报

55

主题

243

帖子

188

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
275
发表于 2022-7-6 12:43:20 | 显示全部楼层
Thanks! Alan you are pure genius!!
Just wondering what the function bns_attin does and how it does work?
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 12:49:03 | 显示全部楼层
 
It's just the subroutine that performs all the functions that AttIn facilitates.
 
Did it work?
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 12:50:24 | 显示全部楼层
I updated the code to check for existence/load AttOut.lsp before file selection. That way, it will exit if it can't find the file. Sorry, wasn't thinking clearly.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 06:23 , Processed in 0.400836 second(s), 72 queries .

© 2020-2025 乐筑天下

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