明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1684|回复: 8

求煮,为什么不能调用我的取值程序阿!

[复制链接]
发表于 2003-12-30 11:48:00 | 显示全部楼层 |阅读模式
为什么不运行我的取值程序?
(defun getdata()
(setq a $key1)
....
)
(defun dialogs ()
(setq dcl_id (load_dialog "lispPs.dcl"))
(if (not (new_dialog "dcl_show" dcl_id))
(exit)
)

(setq x (dimx_tile "image")
y (dimy_tile "image")
)
(start_image "image")
(slide_image 0 0 x y "lispPs")
(end_image)

(action_tile "accept" " (getdata)(done_dialog 1) ")
(setq ret (start_dialog))
(unload_dialog dcl_id)
)

怎么就是不运行我的getdata呢?




dcl_show : dialog{
  label = "dialog";
  :row{
  :boxed_row {
    :image{
     key = "image";
     width= 35;
     aspect_ratio = 1.5;
     //fixed_height = false;
     //fixed_width = false;
     color = -2;
    }
  }
  
  :boxed_row{
    :column{//第一列
     :edit_box{
     key = "r1";
     label = "r1:";
     }
     :edit_box{
     key = "r2";
     label = "r2:";
     }
     :edit_box{
     key = "r3";
     label = "r3:";
     }
     :edit_box{
     key = "r4";
     label = "r4:";
     }
     :edit_box{
     key = "r5";
     label = "r5:";
     }
     :edit_box{
     key = "r6";
     label = "r6:";
     }
     :edit_box{
     key = "d1";
     label = "d1:";
     }
     
     :edit_box{
     key = "h1";
     label = "h1:";
     }
     :edit_box{
     key = "h2";
     label = "h2:";
     }
     :edit_box{
     key = "h3";
     label = "h3:";
     }

    }
    : column {// 第二列
      :edit_box{
     key = "h4";
     label = "h4:";
     }
     :edit_box{
     key = "h5";
     label = "h5:";
     }
     :edit_box{
     key = "h6";
     label = "h6:";
     }
     :edit_box{
     key = "b1";
     label = "b1:";
     }
     :edit_box{
     key = "b2";
     label = "b2:";
     }
     :edit_box{
     key = "b3";
     label = "b3:";
     }
     :edit_box{
     key = "b4";
     label = "b4:";
     }
     //:boxed{
      //:button{
      //key = "basep";
      //label = "select point";
      //}
     :edit_box{
     key = "p0_x";
     label = "p0_X:";
     }
     :edit_box{
     key = "p0_y";
     label = "p0_Y:";
     }
     //}
    }
  }
  }
  ok_cancel;
}
发表于 2003-12-30 11:51:00 | 显示全部楼层
给出DCL文件内容看看先。。。
 楼主| 发表于 2003-12-30 11:52:00 | 显示全部楼层
lisp。lsp
;;;;;;;;;;;;;
(defun c:aa1()
  ;(setq p0 (getpoint "\n please select a base point:"))
;;;  (setq r1 (getreal "\n input r1:"))
;;;  (setq r2 (getreal "\n input r2:"))
;;;  (setq r3 (getreal "\n input r3:"))
;;;  (setq r4 (getreal "\n input M:"))
;;;  (setq r5 (getreal "\n input r5:"))
;;;  (setq r6 (getreal "\n input r6:"))
;;;  (setq d1 (getreal "\n input d1:"))
;;;  (setq h1 (getreal "\n input h1:"))
;;;  (setq h2 (getreal "\n input h2:"))
;;;  (setq h3 (getreal "\n input h3:"))
;;;  (setq h4 (getreal "\n input h4:"))
;;;  (setq h5 (getreal "\n input h5:"))
;;;  (setq h6 (getreal "\n input h6:"))
;;;  (setq b1 (getreal "\n input b1:"))
;;;  (setq b2 (getreal "\n input b2:"))
;;;  (setq b3 (getreal "\n input b3:"))
;;;  (setq b4 (getreal "\n input b4:"))

  
  (defun getdata ()
;;;      (setq r1 (atof (get_tile "r1"))
;;;            r2 (atof (get_tile "r2"))
;;;            r3 (atof (get_tile "r3"))
;;;            r4 (atof (get_tile "r4"))
;;;            r5 (atof (get_tile "r5"))
;;;            r6 (atof (get_tile "r6"))
;;;            d1 (atof (get_tile "d1"))
;;;            h1 (atof (get_tile "h1"))
;;;            h2 (atof (get_tile "h2"))
;;;            h3 (atof (get_tile "h3"))
;;;            h4 (atof (get_tile "h4"))
;;;            h5 (atof (get_tile "h5"))
;;;            h6 (atof (get_tile "h6"))
;;;            b1 (atof (get_tile "b1"))
;;;            b2 (atof (get_tile "b2"))
;;;            b3 (atof (get_tile "b3"))
;;;            b4 (atof (get_tile "b4"))
;;;      )
         (setq r1 (atof  $r1)
            r2 (atof r2$)
            r3 (atof (get_tile "r3"))
            r4 (atof (get_tile "r4"))
            r5 (atof (get_tile "r5"))
            r6 (atof (get_tile "r6"))
            d1 (atof (get_tile "d1"))
            h1 (atof (get_tile "h1"))
            h2 (atof (get_tile "h2"))
            h3 (atof (get_tile "h3"))
            h4 (atof (get_tile "h4"))
            h5 (atof (get_tile "h5"))
            h6 (atof (get_tile "h6"))
            b1 (atof (get_tile "b1"))
            b2 (atof (get_tile "b2"))
            b3 (atof (get_tile "b3"))
            b4 (atof (get_tile "b4"))
      )
  )

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (defun draw()
  (setq p0 (getpoint "\n please select a base point:"))

  (setq        r1 14
        r2 19
        r3 23
        r4 3
        r5 28
        r6 5
        d1 6
        h1 10
        h2 30
        h3 65
        h4 3
        h5 2
        h6 6
        b1 32
        b2 40
        b3 52
        b4 62
  )
  (command "-layer" "n" "cen,1,2,3" "c" "1" "cen" "c" "3" "1" "L" "center" "cen" "s" "0" "")
  (setq p1 (polar p0 (/ pi 2.0) r2))
  (setq p2 (polar p1 (* pi (/ -80.0 180.0)) r4))
  (command "circle" p0 r1)
  (command "-layer" "s" "cen" "")
  (command "circle" p0 r2)
  (command "layer" "s" "0" "")
  (command "circle" p0 r3)
  (setq ent0 (entlast))
  (command "zoom" "e")
  (setq tempr (* 0.8 r4))
  (command "circle" p1 tempr)
  (setq ent1 (entlast))
  (command "arc" "c" p1 p2 "Angle" "270")
  (setq ent2 (entlast))
                                        ;(command "array" ent1 ent2 "" "p" p0 "3" "360" "y")
  (command "zoom" "p")
  (setq p6 (polar p0 (/ pi -2.0) r5))
  (command "arc" "c" p0 p6 "a" "90")
  (setq entarc (entlast))
  (setq p4 (polar p0 0 (/ b2 2.0)))
  (setq p5 (polar p4 (/ pi -2.0) (- h3 h1)))
  (command "line" p4 p5 "")
  (setq ent3 (entlast))
  (command "trim" ent0 "" p4 "")
  (setq ent3 (entlast))
  (setq pb (polar p0 (/ pi -2.0) h3))
  (command "_mirror" ent3 "" p0 pb "n")
  (setq p7 (polar p0 0 (/ b1 2.0)))
  (setq p8 (polar pb 0 (/ b1 2.0)))
  (command "line" p7 p8 "")
  (setq ent4 (entlast))
  (setq p9 (polar pb 0 (/ b4 2.0)))
  (setq p10 (polar p9 (/ pi 2.0) h1))
  (setq p11 (polar p10 pi (/ (- b4 b1) 2.0)))
  (setq x (car pb))
  (setq x (+ x (/ b3 2.0)))
  (setq y (cadr pb))
  (setq y (- y 5.0))
  (setq p13 (list x y 0))
  (setq p12 (polar p13 (/ pi 2.0) (+ h1 10)))
  (setq p14 (polar p8 (/ pi 2.0) h2))
  (setq p15 (polar p14 0 (/ (- b2 b1) 2.0)))
  (command "line" p8 p9 p10 p11 "")
  (command "line" p12 p13 "")
  (setq entcen (entlast))
  (command "line" p14 p15 "")
;;;  (setq ptemp1 (polar p0 0 r5))
;;;  (command "circle" "T" "tan" p6 "tan" p14 r6)
;;;  (setq ent5 (entlast))
;;;  (setq ent_data (entget ent5))
;;;  (setq ce_ent5 (cdr (assoc 10 ent_data)))
;;;  (setq ptemp2 (polar ce_ent5 (/ pi -2.0) r6))
;;;  (command "zoom" "e")
;;;  (command "trim" ent5 "" p7 ptemp1 "")
;;;  (command "trim" entarc ent4 "" ptemp2 "")
  (command "_fillet" "r" r6 "fillet" p6 p14)
;;;(command "_fillet" "r" r6 p6 p14)
  (command "zoom" "e")
  (command "_mirror" "w" p0 p9 entcen "" p0 pb "n")
  (command "array" ent1 ent2 "" "p" p0 "3" "360" "y")
  (setq x (car p12))
  (setq x (- x (/ d1 2.0)))
  (setq y (cadr p10))
  (setq p16 (list x y))
  (setq p17 (polar p16 (/ pi -2.0) h1))
  (command "line" p16 p17 "")
  (setq ent6 (entlast))
  (command "mirror" ent6 "" p12 p13 "n")
  (setq x1 (car p11))
  (setq x2 (car p16))
  (setq x (/ (+ x1 (/ (- b2 b1) 2.0) x2) 2.0))
  (setq y (cadr p16))
  (setq p18 (list x y))
  (setq x (car p5))
  (setq y (cadr p8))
  (setq y (+ y (/ h1 2.0)))
  (setq p19 (list x y))
  (setq p20 (polar p18 (/ pi -2.0) h1))
  (command "line" p18 p19 p20 "")
  (bpoly (inters p16 p20 p18 p13))
  (setq ent7 (entlast))
  (setq ptemp1 (polar p16 0 d1))
  (setq ptemp2 (polar p17 0 d1))
  (bpoly (inters p10 ptemp2 p9 ptemp1))
  (setq ent8 (entlast))
  (command "zoom" "w" pb p10)
  (command "hatch" "ansi31" 1 0 ent7 ent8 "")
  (command "zoom" "p")
  (setq x (car pb))
  (setq x (- x (/ b1 2.0)))
  (setq y (cadr pb))
  (setq y (+ y h4))
  (setq ps3 (list x y))
  (setq pe3 (polar ps3 0 b1))
  (setq ps2 (polar ps3 (/ pi 2.0) h5))
  (setq pe2 (polar ps2 0 b1))
  (setq ps1 (polar ps2 (/ pi 2.0) h6))
  (setq pe1 (polar ps1 0 b1))
  (command "line" ps1 pe1 "")
  (command "line" ps2 pe2 "")
  (command "line" ps3 pe3 "")
  (setq ps (polar p0 pi (+ 3 r3)))
  (setq pe (polar p0 0 (+ 3 r3)))
  (command "line" ps pe "")
  (setq ps (polar p0 (/ pi 2.0) (+ 3 r3)))
  (setq pe (polar p0 (/ pi -2.0) (+ 3 h3)))
  (command "line" ps pe "")
)


  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun dialogs ()
  (setq dcl_id (load_dialog "lispPs.dcl"))
  (if (not (new_dialog "dcl_show" dcl_id))
    (exit)
  )

  (setq        x (dimx_tile "image")
        y (dimy_tile "image")
  )
  (start_image "image")
  (slide_image 0 0 x y "lispPs")
  (end_image)

  (action_tile "accept" " (getdat)(done_dialog 1) ")
  (setq ret (start_dialog))
  (unload_dialog dcl_id)
)

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
  (dialogs)
  (if (= ret 1)
    (draw)  
    )
  )
发表于 2003-12-30 12:01:00 | 显示全部楼层
就是" (getdat) (done_dialog 1) "前面的空格作怪,为什么这里要写空格?而且后面也写?
 楼主| 发表于 2003-12-30 12:25:00 | 显示全部楼层
这个是照着例子来的,很奇怪的,有时候你必须要加上空格

现在函数到时可以走到了。得到编辑框的值还是个问题
发表于 2003-12-30 13:52:00 | 显示全部楼层
这里是不用空格的。
空格是函数和参数之间才用。

得到编辑框值这样就可以了
(get_tile "edit1")
edit1是编辑框的key
 楼主| 发表于 2003-12-30 13:53:00 | 显示全部楼层
好了,是这样的

还有一个问题就是slide显示的图像特别小,该怎么拉伸到整个image控件阿?
发表于 2003-12-30 14:12:00 | 显示全部楼层
那是你幻灯片做小了吧。
你可以这样,slide_image就是填充幻灯片的,4个位置参数可以调一下(可以为负数的),使其只显示中间部分,不过这样分辨率就小了
发表于 2003-12-31 13:00:00 | 显示全部楼层
;;(action_tile "accept" " (getdat)(done_dialog 1) ")

(getdat)→(getdata)

;;(setq r1 (atof  $r1)
;;        r2 (atof r2$)

   (setq r1 (atof (get_tile "r1"))
           r2 (atof (get_tile "r2"))
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 12:58 , Processed in 0.187501 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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