乐筑天下

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

[编程交流] Simple LISP, big problem

[复制链接]

52

主题

156

帖子

104

银币

后起之秀

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

铜币
260
发表于 2022-7-5 20:01:02 | 显示全部楼层 |阅读模式
I have been using a lisp routine with no issues at all on many computers and many different drawings. Until recently. I have this one drawing that crashes when the LISP routine is run. This crash may happen or may not.....most of the time it does but at different points.
This happens on every computer I have used it on....which is 5 different computers using different versions of AutoCAd and windows.....so I am certain there is something seriously worng with the file
 
Basically this routine just scrolls through paper space layouts and exports them to a drawing file. This works fine on every other drawing I have ever used.
 
Also, exporting paper space layouts to the seperate drawings manually works no problem at all. So basically I think this drawing has problems already, and something in the routine triggers it.
 
I have put the routine below. Any ideas what could be causing a total AutoCAD crash when this routine is run? and only on this one drawing?
 
  1. (defun C:p2m ()(getOldVar)(process)(reset)    )(defun process ()(setq filepath (getvar "dwgprefix")) (setq exported "Exported")(setq fulldir (strcat filepath exported))   (vl-mkdir fulldir)(foreach lo (layoutlist)(progn(setvar "CTAB" lo)(setq dwgfn (strcat fulldir "\" lo))(command "exportlayout" dwgfn));command);progn );end defun (defun getOldVar ()(setq oldcmdecho    (getvar "cmdecho"))(setq oldfiledia    (getvar "filedia"))(command "cmdecho" "0")(setvar "FILEDIA" 0)   (command "undo" "mark")(command "undo" "begin") (setq temperr *error*)(setq *error* CCerror)       ) (defun CCerror (CCerrmsg)(setq    *error* temperror)(setvar "FILEDIA"  oldfiledia)(setvar "cmdecho" oldcmdecho)(command "undo" "back")    (command "undo" "end")(command "undo" "mark")  (prompt "\nCommand Cancelled°... "))(defun reset ()(command "undo" "back")    (command "undo" "end")(command "undo" "mark")(setvar "FILEDIA"  oldfiledia)(setvar "cmdecho" oldcmdecho)  (prompt "\nExport Complete... "))
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-5 20:13:53 | 显示全部楼层
Why post the lisp routine if you have already determined the problem is with the drawing you are using it in?  Makes no sense.
 
Attach a copy of the drawing to your next post.
回复

使用道具 举报

52

主题

156

帖子

104

银币

后起之秀

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

铜币
260
发表于 2022-7-5 20:24:53 | 显示全部楼层
well I posted the routine as I thought there is obviously something in it causing a crash. I mean why would exporting the layouts manually work but using the LISP routine causes a crash? Although I feel there must be something wrong with the drawing too, its obvious this is something triggered by the LISP routine so thought it was worthputting up for review.
 
Unfortunately I cannot post the drawing due to privacy/legal etc, all that stuff.
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-5 20:38:17 | 显示全部楼层
I guess I misread this.....
"I have been using a lisp routine with no issues at all on many computers  and many different drawings. Until recently. I have this one drawing  that crashes when the LISP routine is run."
 
It's difficult to diagnose a problem when you do not have access to the drawing that the problem is evident in don't you agree?
回复

使用道具 举报

4

主题

2143

帖子

2197

银币

限制会员

铜币
-24
发表于 2022-7-5 20:43:39 | 显示全部楼层
All that is needed in the .dwg is enough so that the drawing still crashes when the LISP is run.
 
You might actually find your problem by removing one thing at a time until it stops crashing.
回复

使用道具 举报

12

主题

395

帖子

384

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
60
发表于 2022-7-5 20:51:44 | 显示全部楼层
Andrew,
 
  I would compare the DWG you are using it on to other drawings as far as the file size. Looking at the LISP alone, I don't see anything there that would cause the crash other than the fact that exporting layouts takes up some ram. There may be something in the DWG that is making the file much larger. In that case I would take the usual steps to decrease the file size (dxfout/dxfin, purge, audit, etc) and see if you still have the issue.
回复

使用道具 举报

39

主题

180

帖子

141

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
195
发表于 2022-7-5 21:01:46 | 显示全部楼层
I ran your lisp on a drawing with tabs and it worked just, you need to run an audit on you drawing...
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 01:03 , Processed in 0.711102 second(s), 66 queries .

© 2020-2025 乐筑天下

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