明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 862|回复: 1

关于对话框的程序

[复制链接]
发表于 2008-5-23 23:16 | 显示全部楼层 |阅读模式

我在做毕业设计,要求是由对话框选择数据然后进行自动绘图,现在程序写到第一步总是提示  错误: 参数类型错误: stringp 10 的错误

自己调试了,我觉得是我的图像按钮出了错误,但是我步确定,也步知道怎么改

大侠们帮帮忙,要交了...

问题2:编辑框中的数据怎样传递到后面的绘图程序中,我的程序的方法是对的吗?

希望大家解解难,谢谢了!

(defun c:mjdg()
  (setvar "cmdecho" 0)
  (dcl_mjdg)
  (prinl)
  )
(defun dcl_mjdg()
  (if (< (setq index (load_dialog "mjdg")) 0 ) (exit))
  (if (not (new_dialog "mjdg" index )) (exit))
  (set_tile "kd" "5")
  (set_tile "kl" "50")
  (set_tile "kl2" "20")
  (set_tile "rb2" "1")
  (set_tile "kimage1" "1")

  (cond ((= "kimage1" "1")(mode_tile "长度 L" 1))
 ((= "kimage2" "1")(mode_tile "长度 L2" 0)(mode_tile "长度 L2" 4))
 )
 
  (start_image "kimage1")
  (setq x (dimx_tile "kimage1"))
  (setq y (dimy_tile "kimage1"))
  (fill_image 0 0 x y -2)
  (end_image)
  (setq x (dimx_tile "kimage1"))
  (setq y (dimy_tile "kimage1"))
  (start_image "kimage1")
  (slide_image 0 0 x y "Drawing1.sld")
  (end_image)
 
  (start_image "kimage2")
  (setq x (dimx_tile "kimage2"))
  (setq y (dimy_tile "kimage2"))
  (fill_image 0 0 x y -2)
  (end_image)
  (setq x (dimx_tile "kimage2"))
  (setq y (dimy_tile "kimage2"))
  (start_image "kimage2")
  (slide_image 0 0 x y "Drawing2.sld")
  (end_image)

  (start_list "kd")
  (setq dlst '("3" "4" "5" "6" "8" "10" "12"))
  (mapcar 'add_list dlst)
  (end_list)

  (action_tile "rb0" "(setq aa 0)")
  (action_tile "rb1" "(setq aa 1)")
  (action_tile "rb2" "(setq aa 2)")
  (action_tile "rb3" "(setq aa 3)")
  (action_tile "rb4" "(setq aa 4)")
  (action_tile "kmage1" "(setq ddtype 1)")
  (action_tile "kmage2" "(setq ddtype 2)")
 
  (action_tile "kd" "(setq d17 $value)")
  (start_dialog)
  (setq d17 (read d17))
  (setq d17 (nth d17 dlst) d17 (read d17))
  (if (= ddtype 1)((data1a)(fget1 d17 "data1"))((data2a)(fget1 d17 "data2")))
 
 
  (action_tile "accept" "(setq d (atof (get_tile "kd")))(setq L (atof (get_tile "kl")))(setq L2 (atof (get_tile "kl2")))")
  (unload_dialog index)
  (cond ((and (= ddtype 1)(= aa 0))(tgtx1 1 0)) ; 执行不同型号零件和不同图号的绘图程序
 ((and (= ddtype 1)(= aa 1))(tgtx1 1 1))
 ((and (= ddtype 1)(= aa 2))(tgtx1 1 2))
 ((and (= ddtype 1)(= aa 3))(tgtx1 1 3))
 ((and (= ddtype 1)(= aa 4))(tgtx1 1 4))
 ((and (= ddtype 2)(= aa 0))(tgtx1 2 0))
 ((and (= ddtype 2)(= aa 1))(tgtx1 2 1))
 ((and (= ddtype 2)(= aa 2))(tgtx1 2 2))
 ((and (= ddtype 2)(= aa 3))(tgtx1 2 3))
 ((and (= ddtype 2)(= aa 4))(tgtx1 2 4))
 )

  )


(defun tgtx1 (flag1 flage2)
  (command "color" "bylayer")
  (command "erase" "c" '(0 0) '(1200 1200) "")
  )


 

(defun data1a()                           ;数据库1
  (setq data1 '((d11 d12 D D21 D22 D1 H)
         ((3(+0.010 0 6 -0.010 -0.022 10 4))
   (4(+0.012 0 7 -0.013 -0.028 11 4))
   (5(+0.012 0 8 -0.013 -0.028 13 4))
   (6(+0.012 0 10 -0.013 -0.028 15 6))
   (8(+0.015 0 12 -0.016 -0.034 17 6))
   (10(+0.015 0 14 -0.016 -0.034 19 6))
   (12(+0.018 0 17 -0.016 -0.034 22 6))
    )))
  )


(defun data2a()                                ;数据库2
  (setq data2 '((d11 d12 D D21 D22 D1 D2 D3 H L1)
 ((3(+0.010 0 6 -0.010 -0.022 12 7 17 6 3))
  (4(+0.012 0 7 -0.013 -0.028 14 9 19 6 4))
  (5(+0.012 0 8 -0.013 -0.028 14 9 19 6 4))
  (6(+0.012 0 10 -0.013 -0.028 14 9 19 6 4))
  (8(+0.015 0 12 -0.016 -0.034 18 13 23 8 6))
  (10(+0.015 0 14 -0.016 -0.034 20 15 25 8 6))
  (12(+0.018 0 17 -0.016 -0.034 22 17 27 8 8))
     )))
  )


(defun fget1 (fa lname / lh lst j nn)                  ;数据库检索函数
  (setq lh(car(eval(read lname)))
 lst(cadr(eval(read lname)))
 j -1)
  (setq lst (cadr (assoc fa lst)))
  (repeat(length lh)
    (setq j (1+ j) nn (nth j lh))
    (set nn (nth j lst))
    lst)
  )
 
 

发表于 2008-5-24 20:23 | 显示全部楼层

简单看了看。未见对话框。

accept要放到start_dialog前面

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

本版积分规则

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

GMT+8, 2024-5-2 11:45 , Processed in 0.575091 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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