jan_ek 发表于 2022-7-5 18:02:44

Autolisp Dictionary - batch pr

Hello
I wrote a simple code, which wanted to check whether a file exists in the Dictionary

(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

Lee Mac 发表于 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.

jan_ek 发表于 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.
页: [1]
查看完整版本: Autolisp Dictionary - batch pr