乐筑天下

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

[编程交流] question about batch, lisp, sc

[复制链接]

8

主题

80

帖子

72

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 11:52:08 | 显示全部楼层 |阅读模式
I have a compilation of .bat, .lsp, and .scr files to purge multiple drawings at one time.  The problem that I have is that when it runs it opens autocad runs the routines and then closes.  It then opens autocad again and does the process to the next drawing.  Is there a way to perform these operations with autocad only opening once and going through all the drawings in the designated folder?
回复

使用道具 举报

8

主题

80

帖子

72

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 11:57:24 | 显示全部楼层
another quick question.. #2  I've ran into problems when calling the .bat file or .lsp, or .scr from another file directory than that which the drawings are placed in.  Do these all need to be in the same folder so that they run correctly?
回复

使用道具 举报

48

主题

1073

帖子

1043

银币

后起之秀

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

铜币
238
发表于 2022-7-6 12:00:37 | 显示全部楼层
I wrote our department a script generator that opens each drawing (path included in name) and adds the listed actions followed by a QSAVE and open the next drawing. Before that we created the file using the DOS DIR *.dwg /b > list.scr syntax and by carefully using FIND|REPLACE within excel.
 
Obviously, this doesn't answer either of your questions and is only posted to show how clever I am.
 
 
 
Oh, or could be used to think of other ways around what you are doing.
回复

使用道具 举报

8

主题

80

帖子

72

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 12:02:48 | 显示全部楼层
clever indeed.. the wheels are turning..
回复

使用道具 举报

15

主题

209

帖子

121

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
163
发表于 2022-7-6 12:07:28 | 显示全部楼层
Are you using MDI mode?
 
Also check your script for close or exit.  You want to close the drawing not exit autocad.
回复

使用道具 举报

48

主题

1073

帖子

1043

银币

后起之秀

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

铜币
238
发表于 2022-7-6 12:11:07 | 显示全部楼层
oh yes, forgot to say I prefer to work in SDI mode. Some of my scripts create 1500 drawing files. I don't like the idea of having that files open in one go.
回复

使用道具 举报

8

主题

80

帖子

72

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 12:11:30 | 显示全部楼层
I have SDI = 0 ; which i'm pretty sure allows for opening of multiple drawings.  Here is what I've done starting with the batch file calling the script which purges and then loads the lisp that updates the drawing to an "update" folder.
batch file:  
MD C:\PURGED
for %%f in (P:\"ACTIVE PROJECTS"\"10573 - EE - NYSE - DATACENTER SUBSTATION"\DRAWINGS\"Working Drawings"\*.dwg) do start /wait C:\"Program Files"\Autodesk\"Acade 2008"\acad.exe "%%f" /b "P:\DOCUMENTS\purge.scr"
script file:
zoom
e
-purge
a
*
n
;THIS LOADS THE TBUPDATE LISP TO SAVE THE NEW DRAWINGS IN THE DESIGNATED UPDATE FOLDER AND UNCHANGING THE ORIGINAL
(load "C:\\TBUPDATE.LSP")
TBUPDATE
QUIT
Y
lisp file:
(defun C:TBUPDATE(/ dn pa panbdn)
  (setq dn (getvar "dwgname"))
  (setq pa (getvar "dwgprefix"))
  (setq panbdn (strcat pa "PURGED\\" dn))
  (command "SAVE" panbdn)
)
回复

使用道具 举报

15

主题

209

帖子

121

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
163
发表于 2022-7-6 12:16:03 | 显示全部楼层
 
I think you want to change this to be CLOSE instead.
回复

使用道具 举报

8

主题

80

帖子

72

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 12:19:46 | 显示全部楼层
When I change it to close it runs and saves the updated folder but then it doesnt continue to the next drawings in the folder, is there a repeat command or something that I need to add into the batch file maybe?  the way i had it before did it and left the originals unchanged and updated the drawings but opened autocad everytime. I'm just tryin to figure out if there is a way around that happening?  The book that I'm referencing says that the quit command in a script  results in a different prompt than it does when in autocad directly.  the prompt for script version is REALLY  want to discard all changes to drawing?  , which requires the response y to quit without saving.  I appreciate all your help Tim
回复

使用道具 举报

48

主题

1073

帖子

1043

银币

后起之秀

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

铜币
238
发表于 2022-7-6 12:20:43 | 显示全部楼层
I got caught by the swapping of the responses - have a search through this forum and you will find I have highlighted it several times.
 
I don't know if it would help you here but I end my scripts with RESUME. This is the command you can use to continue an interupted script. If you have a  at the end of a script it repeats the last completed command, sometimes with unexpected results. Ending RESUME gets around this by looking for the next command. If the next command is a series of spaces it will keep resuming until all spaces are exhausted.
 
Also try your script in both SDI=0 and SDI=1 mode. You do get different results.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 10:26 , Processed in 0.721924 second(s), 72 queries .

© 2020-2025 乐筑天下

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