zhanzhe 发表于 2009-8-18 00:59:00

求助:关于对话框嵌套

本帖最后由 作者 于 2009-8-18 22:40:03 编辑 <br /><br /> <p></p><p>非常感谢四楼大哥的提醒(程式序乱,DCL文件重名<a>\\\\\\</a>)现在我改正过来了,问题解决了.不过又有新的问题了:</p><p>我可以打开主对话框,也可以打开子对话框,可是当我执行其中任意一子对话框,点击OK按钮时,它并没执行,反而却回到了主对话框(本应该消失对话框,执行子对话框的程序才对啊),查看了很久,确实看不出错在哪里了.小弟还是希望哪位高人耐心指导一下.今再次上传我修正后的源文件,先谢谢了!</p>

yxp 发表于 2009-8-18 05:29:00

程序不完整啊,DCL嵌套在于你的lisp如何控制,论坛上这种程序太多了,建议你看看别人是怎么做的。

zhanzhe 发表于 2009-8-18 08:26:00

大哥,小弟實在不知道怎麼找類似的案例,幫忙指個明路吧,我只是百思不得其解,為什麼只能打開其中一個子對話框,另一個子對話框就是打不開

yxp 发表于 2009-8-18 08:39:00

本帖最后由 作者 于 2009-8-18 9:20:22 编辑 <br /><br /> <p>够乱的,DCL重名、字符乱码、lisp有错误,这是下载别人的程序吧?</p><p>DCL关键字都乱码了你还怎么调用?</p>

zhanzhe 发表于 2009-8-18 10:45:00

大哥,繁體字在簡體系統上當然亂碼啊,這的確是我剛寫的,只不過是參照了下別人的,DCL重名不行嗎?lisp我都沒開始完成,只是剛開始,想把主體結構設計出來,沒想到會這樣啊,請再幫幫忙,大哥?謝謝你了!

zhanzhe 发表于 2009-8-18 22:47:00

请高手大哥再帮我看看吧,我已经改正了........只是它又不执行子对话框的程序了,点击OK它又回到了主对话框,不知是什么原因.....请多指教.TKS!

zhanzhe 发表于 2009-8-19 12:03:00

求助:求版主幫我看看吧,小弟謝謝了

ZZXXQQ 发表于 2009-8-19 21:22:00

1、变量名与函数名相同了;
2、显示幻灯子程序有一个就够,为什么写仨?

;子对话框调用 明经 ZZXXQQ 2009.8.19改
(defun C:ee (/ dcl_id)
(setvar "cmdecho" 0)
(if (> (setq dcl_id (load_dialog "box1.dcl")) 0) (progn
(setq result 3)
(while (> result 1)
   (if (new_dialog "box1" dcl_id) (progn
    (show_sld "kimage" "D:/Lisp-Draw/Letter-Box-Part/Box1.sld")
    (action_tile "Left-plate" "(done_dialog 2)")
    (action_tile "Right-plate" "(done_dialog 3)")
    (action_tile "Mid-Ver-plate" "(done_dialog 4)")
    (action_tile "Mid-Hor-plate" "(done_dialog 5)")
    (action_tile "Front-draw" "(done_dialog 6)")
    (action_tile "accept" "(done_dialog 1)")
    (action_tile "cancel" "(done_dialog 0)")
    (setq result (start_dialog))
   ) (progn
    (setq result 0)
    (alert "Unable to display dialog box!\n无法显示对话框!")
   ))
   (cond
    ((= result 2) (Left-plate))
    ((= result 3) (Right-plate))
    ((= result 4) (Mid-Ver-plate))
    ((= result 5) (Mid-Hor-plate))
    ((= result 6) (Front-draw))
   )
);end while
(unload_dialog dcl_id)
)
(alert "Unable to load dialog box!\n无法装载对话框!")
);end if
;(if (= result 1) (1-1))
;(unload_dialog dcl_id )
(princ)
)
(defun show_sld (key sld)
(setq x (dimx_tile key))
(setq y (dimy_tile key))
(start_image key)
(fill_image 0 0 x y -2)
(slide_image 0 0 x y sld)
(end_image)
(set_tile key sld)
)
(defun Left-plate ()
(if (> (setq dcl_id1 (load_dialog "D:/Lisp-Draw/Letter-Box-Part/view1.dcl")) 0) (progn
(if (new_dialog "view1" dcl_id1) (progn
   (show_sld "kimage1" "D:/Lisp-Draw/Letter-Box-Part/box1.sld")
   (set_tile "L1" " ")
   (set_tile "L2" " ")
   (set_tile "L3" " ")
   (set_tile "L4" "15")
   (set_tile "W" " ")
   (set_tile "T1" "1.0")
   (set_tile "K" "0")
   (action_tile "accept" "(ok_Left-plate)(done_dialog 1)")
   (setq dd (start_dialog))
)
   (alert "Unable to display dialog box!\n无法显示对话框!")
)
(unload_dialog dcl_id1)
)
(alert "Unable to load dialog box!\n无法装载对话框!")
)
(if (= dd 1) (draw_Left-plate))
)
(defun ok_Left-plate ()
(setq n1 (atof (get_tile "L1")))
(setq n2 (atof (get_tile "L2")))
(setq n3 (atof (get_tile "L3")))
(setq n4 (atof (get_tile "W")))
(setq n5 (atof (get_tile "L4")))
(setq n6 (atof (get_tile "T1")))
(setq n7(atof (get_tile "K")))
)
(defun draw_Left-plate ()
(command "circle" "0,0" 10)
)
(defun Right-plate ()
(if (> (setq dcl_id2 (load_dialog "D:/Lisp-Draw/Letter-Box-Part/view2.dcl")) 0) (progn
(if (new_dialog "view2" dcl_id2) (progn
   (show_sld "kimage2" "D:/Lisp-Draw/Letter-Box-Part/box2.sld")
   (set_tile "Z1" " ")
   (set_tile "Z2" " ")
   (set_tile "Z3" " ")
   (set_tile "Z4" "15")
   (set_tile "Z5" " ")
   (set_tile "Z6" "1.0")
   (set_tile "Z7" "0")
   (action_tile "accept" "(ok_Right-plate)(done_dialog 1)")
   (setq de (start_dialog))
)
   (alert "Unable to display dialog box!\n无法显示对话框!")
)
(unload_dialog dcl_id2)
)
(alert "Unable to load dialog box!\n无法装载对话框!")
)
(if (= de 1) (draw_Right-plate))
)
(defun ok_Right-plate()
(setq X1 (atof (get_tile "L1")))
(setq X2 (atof (get_tile "L2")))
(setq X3 (atof (get_tile "L3")))
(setq X4 (atof (get_tile "W")))
(setq X5 (atof (get_tile "L4")))
(setq X6 (atof (get_tile "T1")))
(setq X7(atof (get_tile "K")))
)
(defun draw_Right-plate()
(command "circle" "0,0" 20)
)

zhanzhe 发表于 2009-8-20 11:58:00

Ok,非常感謝版主大哥,我終於明白錯在哪裡了!非常感謝! 非常感謝大哥的提醒,小弟剛學不久,以後請多多指教!謝謝!

5061220 发表于 2009-8-20 15:04:00

呵呵,学OpenDCL工具吧,比CAD自带的DCL好用多了。
页: [1] 2
查看完整版本: 求助:关于对话框嵌套