乐筑天下

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

请帮我看看这个程序执行后为什么会死机?

[复制链接]

8

主题

21

帖子

1

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
53
发表于 2004-8-9 16:02:00 | 显示全部楼层 |阅读模式
(defun c:setpapersize (/ tempx tempy)
         (setq ID (load_dialog "title.dcl"))
         (if (not (new_dialog "mypaper" ID))
                         (exit)
                         (progn
                                         (set_tile "a4" "1")
                                         (setq papersize 4)
                                         (setq paper 0)
                                         (setq tempx (dimx_tile "pic"))
                                         (setq tempy (dimy_tile "pic"))
                                         (start_image "pic")
                                         (slide_image 0 (/ tempy -8) tempx tempy "safqa4.sld")
                                         (end_image)
                                         (action_tile "a1" "(setq papersize 1)(image-change)")
                                         (action_tile "a2" "(setq papersize 2)(image-change)")
                                         (action_tile "a3" "(setq papersize 3)(image-change)")
                                         (action_tile "a4" "(setq papersize 4)(image-change)")
                                         (action_tile "partrait" "(setq paper 0)(image-change)")
                                         (action_tile "landscape" "(setq paper 1)(image-change)")
                                         (action_tile "accept" "(setpaper)(done_dialog)")
                                         (action_tile "cancel" "(exit)")
                                         (start_dialog)
                         )
         )
)
(defun setpaper        (/ paperfile)
         (if (= paper 0)
                         (progn
                                         (cond
        ((= papersize 1)
         (setq paperfile "safqa1.dwg")
        )
        ((= papersize 2)
         (setq paperfile "safqa2.dwg")
        )
        ((= papersize 3)
         (setq paperfile "safqa3.dwg")
        )
        ((= papersize 4)
         (setq paperfile "safqa4.dwg")
        )
                                         )
                         )
                         (progn
                                         (cond
        ((= papersize 1)
         (setq paperfile "safqa1-0.dwg")
        )
        ((= papersize 2)
         (setq paperfile "safqa2-0.dwg")
        )
        ((= papersize 3)
         (setq paperfile "safqa3-0.dwg")
        )
        ((= papersize 4)
         (setq paperfile "safqa4-0.dwg")
        )
                                         )
                         )
         )
         (done_dialog)
         (unload_dialog ID)
         (command "insert"
                         paperfile
                         (getpoint "Insrt point:")
                         ""
                         ""
                         ""
         )
)
(defun image-change (/ tempx tempy)
         (setq tempx (dimx_tile "pic"))
         (setq tempy (dimy_tile "pic"))
         (start_image "pic")
         (fill_image 0 0 tempx tempy -2)
         (end_image)
         (cond
                         ((= paper 0)
                                 (cond
                                                 ((= papersize 1)
        (start_image "pic")
        (slide_image 0 (/ tempy -8) tempx tempy "safqa1.sld")
        (end_image)
                                                 )
                                                 ((= papersize 2)
        (start_image "pic")
        (slide_image 0 (/ tempy -8) tempx tempy "safqa2.sld")
        (end_image)
                                                 )
                                                 ((= papersize 3)
        (start_image "pic")
        (slide_image 0 (/ tempy -8) tempx tempy "safqa3.sld")
        (end_image)
                                                 )
                                                 ((= papersize 4)
        (start_image "pic")
        (slide_image 0 (/ tempy -8) tempx tempy "safqa4.sld")
        (end_image)
                                                 )
                                 )
                         )
                         ((= paper 1)
                                 (cond
                                                 ((= papersize 1)
        (start_image "pic")
        (slide_image 0 (/ tempy -8) tempx tempy "safqa1-0.sld")
        (end_image)
                                                 )
                                                 ((= papersize 2)
        (start_image "pic")
        (slide_image 0 (/ tempy -8) tempx tempy "safqa2-0.sld")
        (end_image)
                                                 )
                                                 ((= papersize 3)
        (start_image "pic")
        (slide_image 0 (/ tempy -8) tempx tempy "safqa3-0.sld")
        (end_image)
                                                 )
                                                 ((= papersize 4)
        (start_image "pic")
        (slide_image 0 (/ tempy -8) tempx tempy "safqa4-0.sld")
        (end_image)
                                                 )
                                 )
                         )
         )
)
附件是对话框及其它一些文件。
我的目的是插入一个图框。
如果去掉(command "insert" .....)就不会有问题,但得不到结果。
回复

使用道具 举报

26

主题

3072

帖子

10

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3177
发表于 2004-8-9 16:46:00 | 显示全部楼层
附件在哪儿?
不过问题是在使用DCL对话框时不可以使用COMMAND的,你仔细看看帮助文件中对话框显示时的函数限制部分
回复

使用道具 举报

8

主题

3171

帖子

10

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3203
发表于 2004-8-9 17:02:00 | 显示全部楼层
试一下改过的程序:
(defun c:setpapersize (/ tempx tempy)
        (IF (> (SETQ ID (LOAD_DIALOG "title")) 0)
         (IF (NEW_DIALOG "mypaper" ID "") (PROGN
                 (set_tile "a4" "1")
                 (setq papersize 4)
                 (setq paper 0)
                 (setq tempx (dimx_tile "pic"))
                 (setq tempy (dimy_tile "pic"))
                 (image-change)
                 (action_tile "a1" "(setq papersize 1)(image-change)")
                 (action_tile "a2" "(setq papersize 2)(image-change)")
                 (action_tile "a3" "(setq papersize 3)(image-change)")
                 (action_tile "a4" "(setq papersize 4)(image-change)")
                 (action_tile "partrait" "(setq paper 0)(image-change)")
                 (action_tile "landscape" "(setq paper 1)(image-change)")
                 (action_tile "accept" "(done_dialog 1)")
                 (action_tile "cancel" "(done_dialog 0)")
                 (SETQ RE (start_dialog))
         ) (PROGN
                 (ALERT "Unable to display dialog box!")
                 (UNLOAD_DIALOG DCL_ID)
         ))
         (ALERT "Unable to load dialog box!")
        )
        (IF (= RE 1) (SETPAPER))
)
(defun setpaper (/ paperfile)
        (SETQ PAPERFILE (STRCAT "safqa" (ITOA PAPERSIZE) (IF (= PAPER 0) "" "-0") ".dwg"))
        (command "insert" paperfile (getpoint "Insrt point:") "" "" "")
)
(defun image-change (/ tempx tempy SLDNAME)
         (setq tempx (dimx_tile "pic"))
         (setq tempy (dimy_tile "pic"))
         (start_image "pic")
         (fill_image 0 0 tempx tempy -2)
         (end_image)
         (SETQ SLDNAME (STRCAT "safqa" (ITOA PAPERSIZE) (IF (= PAPER 0) "" "-0") ".sld"))
         (start_image "pic")
         (slide_image 0 (/ tempy -8) tempx tempy SLDNAME)
         (end_image)
)
回复

使用道具 举报

8

主题

21

帖子

1

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
53
发表于 2004-8-9 18:57:00 | 显示全部楼层
谢谢楼上的。我试了一下,是可以但我还没有搞清楚我错在哪里。虽然在对话框里不能用(command ),但我已用了(done_dialog)和(unload_dialog)退出了对话框。请告知。
        
附件在哪儿?
不过问题是在使用DCL对话框时不可以使用COMMAND的,你仔细看看帮助文件中对话框显示时的函数限制部分.
附件人用上传文件附上去了,但到哪去了我也不知道。
回复

使用道具 举报

8

主题

3171

帖子

10

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3203
发表于 2004-8-10 08:46:00 | 显示全部楼层
楼主:您用了两次(DONE_DIALOG),所以会出错。
回复

使用道具 举报

8

主题

21

帖子

1

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
53
发表于 2004-8-10 08:55:00 | 显示全部楼层
谢谢楼上的。问题好象不在这。
回复

使用道具 举报

26

主题

3072

帖子

10

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3177
发表于 2004-8-10 08:57:00 | 显示全部楼层

你仔细看看,是先DONE_DIALOG再使用COMMAND的吗?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-8-19 09:58 , Processed in 2.107388 second(s), 66 queries .

© 2020-2025 乐筑天下

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