乐筑天下

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

[编程交流] Autolisp Dictionary - batch pr

[复制链接]

41

主题

120

帖子

84

银币

后起之秀

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

铜币
200
发表于 2022-7-5 18:02:44 | 显示全部楼层 |阅读模式
Hello
I wrote a simple code, which wanted to check whether a file exists in the Dictionary
  1. (defun c:dtest (/ na )(setq na (list "c:\\tt\\1.dwg""c:\\tt\\2.dwg""c:\\tt\\3.dwg""c:\\tt\\4.dwg"))(foreach %  na(command "_.OPEN"  %  )(princ "\n-  ")(princ (dictsearch (namedobjdict) "T_DATA"))(If ( > (getvar "DBMOD") 0) (command "_close" "_y") (command "_wClose" ))))
The files contain dictionaries and the function returns nil.
 
 
 
 
What is wrong?
 
I would not use a script
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 18:38:50 | 显示全部楼层
AutoLISP can only run within the active drawing, therefore when another drawing becomes active, the AutoLISP program will terminate.
 
For your task, you will need to either use ObjectDBX to interface with each drawing without opening the drawing in the AutoCAD Editor, or open each drawing sequentially using a Script.
回复

使用道具 举报

41

主题

120

帖子

84

银币

后起之秀

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

铜币
200
发表于 2022-7-5 19:31:24 | 显示全部楼层
I hoped that it could be done using a simple function.
Thank you for your reply.
Back to the topic at hand, it would be probably easier to write a script. But I do have a question regarding the script:
How should the syntax of the script look like if it were supposed to first check whether a drawing could be edited,  save the name to the variable if not, and finally provide information which files were not reloaded?
Another question: how could the commandline be cleared effectively then? Unfortunately the variable “cmdecho” does not seem to work.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 23:45 , Processed in 0.449129 second(s), 58 queries .

© 2020-2025 乐筑天下

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