明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1594|回复: 6

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

[复制链接]
发表于 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" .....)就不会有问题,但得不到结果。
发表于 2004-8-9 16:46:00 | 显示全部楼层
附件在哪儿?


不过问题是在使用DCL对话框时不可以使用COMMAND的,你仔细看看帮助文件中对话框显示时的函数限制部分
发表于 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)
)
 楼主| 发表于 2004-8-9 18:57:00 | 显示全部楼层
谢谢楼上的。我试了一下,是可以但我还没有搞清楚我错在哪里。虽然在对话框里不能用(command ),但我已用了(done_dialog)和(unload_dialog)退出了对话框。请告知。


       


附件在哪儿?





不过问题是在使用DCL对话框时不可以使用COMMAND的,你仔细看看帮助文件中对话框显示时的函数限制部分.


附件人用上传文件附上去了,但到哪去了我也不知道。
发表于 2004-8-10 08:46:00 | 显示全部楼层
楼主:您用了两次(DONE_DIALOG),所以会出错。
 楼主| 发表于 2004-8-10 08:55:00 | 显示全部楼层
谢谢楼上的。问题好象不在这。
发表于 2004-8-10 08:57:00 | 显示全部楼层
badgirl发表于2004-8-9 18:57:00谢谢楼上的。我试了一下,是可以但我还没有搞清楚我错在哪里。虽然在对话框里不能用(command ),但我已用了(done_dialog)和(unload_dialog)退出了对话框。请告知...

你仔细看看,是先DONE_DIALOG再使用COMMAND的吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-9-30 20:12 , Processed in 0.161148 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表