dahaiabc 发表于 2004-5-28 21:14:00

请问这段程序

程序是实现行差标注操作的


但红色部分的绘图程序有些问题               


请问问题出现在哪?


(defun dial1()                                       ;主对话框驱动程序<BR>       (if(not(new_dialog "dimention" dcld))(exit))<BR>                       (start_image "dimg")<BR>                       (slide_image 0 0 (dimx_tile "dimg")(dimy_tile "dimg") "smain")<BR>                       (end_image)<BR>                       (set_tile "heigth" (rtos h 2 2))<BR>                       (set_tile "name" dimname)<BR>                       (set_tile "dvalue" dimv)<BR>                       (action_tile "pheight" "(done_dialog 3)")<BR>                       (action_tile "pickp" "(getmain)(dial2)")<BR>                       (action_tile "accept" "(getmain)(done_dialog 1)")<BR>                       (action_tile "cancel" "(done_dialog -1)")<BR>       )<BR>(defun dial2()                                                       ;选项对话框驱动程序<BR>       (if(not(new_dialog "dpoint" dcld))(exit))<BR>                       (start_image "pimg")<BR>                       (slide_image 0 0 (dimx_tile "pimg")(dimy_tile "pimg") "spoint")<BR>                       (end_image)<BR>                       (set_tile "p1x" (rtos x1 2 2))<BR>                       (set_tile "p1y" (rtos y1 2 2))<BR>                       (set_tile "p2x" (rtos x2 2 2))<BR>                       (set_tile "p2y" (rtos y2 2 2))<BR>                       (action_tile "pickp1" "(done_dialog 6)")<BR>                       (action_tile "dimsnap" "(setq osmode(atoi $ value))")<BR>                       (action_tile "pickp2" "(done_dialog 7)")<BR>                       (action_tile "accept" "(getpon)(done_dialog 4 )")<BR>                       (action_tile "cancel" "(done_dialog 5)")<BR>                       (setq retv (start_dialog))<BR>                       (if(= retv 6)(done_dialog 6))<BR>                                                                       (if(= retv 7)(done_dialog 7))<BR>                       )<BR>(defun getmain()                                               ;获取对话框控件属性值<BR>                       (setq dimname(get_tile "name"))<BR>                       (setq dimv(get_tile "dvalue"))<BR>                       (setq h (atof (get_tile "height")))<BR>                       )<BR>(defun getpon()                                                               ;获取编辑中点的坐标值<BR>                       (setq x1 (atof (get_tile "p1x")))<BR>                       (setq y1 (atof (get_tile "p1y")))<BR>                       (setq x2 (atof (get_tile "p2x")))<BR>                       (setq y2 (atof (get_tile "p2y")))<BR>                       (setq p1 (list x1 y1 0) p2(list x2 y2 0))<BR>                       )<BR><FONT color=#ee0000 face=黑体>(defun mvdraw()                       ;绘图程序<BR>                       (setq xm x1)<BR>                       (setq ym y2)<BR>                       (setq m (list xm ym))<BR>                       (setq la (strlen dimv))<BR>                       (setq lb (strlen dimname))<BR>                       (setq 1 (+ 1 la lb))<BR>                       (setq 1 (* h 1))<BR>                       (setvar "SNAPMODE" osmode)<BR>                       (if(&lt; = x1 x2 )(setq xa x2)(setq xa (+ x2 1)))<BR>                                               (setq ya (+ y2 (* 0.8 h )))<BR>                       (setq xc (- xa 1))<BR>                       (setq yc (- y2 (* 0.8 h)))<BR>                       (setq a (list xa ya ))<BR>                       (setq c (list xc yc))<BR>                       (setq arh (* 0.5 h))<BR>                       (setq ymp (* 1 h))<BR>                       (if(&lt; y2 y1)(setq ymp (- 0 ymp)))<BR>                       (setq ymp (+ ymp y1))<BR>                       (setq mp (list x1 ymp))<BR>                       (setq j (list(+ xc (* 1 h)) yc))<BR>                       (setq k (list(- xa (* (strlen dimname) h)) ya))<BR>                       (command "pline" p1 "w" 0 arh mp "")<BR>                       (command "line" mp m p2 "")<BR>                       (command "rectang" a c)<BR>                       (command "text" (list (+ (car c) 2)(+ (cadr c) 2)) h 0 " % % c")<BR>                       (command "rectang" j (list (- (car k) 2) ya))<BR>                       (command "text" (list (+ (car j) 4)(+ yc 2)) h 0 dimv)<BR>                       (command "text" (list (car k)(+ yc 2)) h 0 dimname)<BR>                       )<BR>        (defun c:mydim()                                       ;主程序,添加绘图命令<BR>                       (setq dcld (load_dialog "hc2.dcl"))<BR>                       (if(&lt; dcld 0)(exit))<BR>                       (setq x1 45 y1 45 x2 90 y2 90 retv 3 h 12)<BR>                       (setq dimname "M" dimv "009")<BR>                       (setq p1(list x1 y1 0) p2(list x2 y2 0))<BR>                       (while(&gt; retv 1)<BR>                       (dial1)<BR>                       (if(or(= retv 6)(= retv 7))(dial2))<BR>                                       (if(and(and(/= retv 1)(/= retv -1))(/= retv 6)(/= retv 7))<BR>        (setq retv(start_dialog))<BR>                                       )<BR>                                       (if(= retv 3)(setq h (getdist "Charactor Height \n")))<BR>                                       (if(= retv 6)<BR>                       (setq p1 (getpoint "Point P1: \n") x1 (car p1) y1(cadr p1))<BR>        )<BR>                                       (if(= retv 7)<BR>                       (setq p2 (getpoint "Point P2:\n") x2 (car p2) y2 (cadr p2))<BR>        )<BR>                                       )<BR>                       (unload_dialog dcld)<BR>                       (if(= retv 1) (mvdraw))<BR>                       (princ)<BR>                       )</FONT>

meflying 发表于 2004-5-28 21:44:00

对话框呢?你说有问题,又是什么问题呢?为什么不描述一下问题???

SWAYWOOD 发表于 2004-5-28 21:45:00

where is your dcl file?

dahaiabc 发表于 2004-5-30 10:31:00

对不起,没有把问题说清楚。


问题:对话框里的标注图出不来


dcl文件为:


dimention :dialog{<BR>       label="行差标注";<BR>       :row{<BR>                       width=42;<BR>               :image{<BR>                       width=30;<BR>                       height=8;<BR>                       key="dimg";<BR>                       color=-2;<BR>                       }<BR>               :boxed_column{<BR>                                       label="数据项";<BR>                                       width=12;<BR>                               :row{<BR>                                               :edit_box{<BR>                                                               label="字体高度&amp;H";<BR>                                                               key="height";<BR>                                                               width=4;<BR>                                                               value="12";<BR>                                                               }<BR>                                               :button{<BR>                                                               label="光标指定(&amp;D)&lt;";<BR>                                                               width=4;<BR>                                                               key="pheight";<BR>                                                               }<BR>                                               }<BR>                               :edit_box{<BR>                                                       label="标注名称&amp;N";<BR>                                                       key="name";<BR>                                                       width=8;<BR>                                                       value="A";<BR>                                                       }<BR>                               :edit_box{<BR>                                                       label="标注行差&amp;V";<BR>                                                       key="dvalue";<BR>                                                       width=8;<BR>                                                       value="002";<BR>                                                       }<BR>                               :button{<BR>                                                                       label="选取点项(&amp;P)...";<BR>                                                                       key="pickp";<BR>                                                       mnemonic="J";<BR>                                                                       }<BR>                                                               }<BR>                                       }<BR>                               ok_cancel;<BR>                       }<BR>        dpoint:dialog{<BR>                                               label="标注对象";<BR>                               :row{<BR>                                               :image{<BR>                                                                                                       width=30;<BR>                                                                                                       key="pimg";<BR>                                                                                                       height=8;<BR>                                                                                                       color=0;<BR>                                                                                                       }<BR>                                                       :column{<BR>                                                               :toggle{<BR>                                                                                                               label="捕捉";<BR>                                                                                                               key="dimsnap";<BR>                                                                                                               value="1";<BR>                                                                                                                               }<BR>                                                               :row{<BR>                                                                                               :column{<BR>                                                                                                       :edit_box{<BR>                                                                                                                                                       label="P1(&amp;X)";<BR>                                                                                                                                                       key="p1x";<BR>                                                                                                                                                       value="45";<BR>                                                                                                                                                       }<BR>                                                                                                       :edit_box{<BR>                                                                                                                                                       label="P1(&amp;Y)";<BR>                                                                                                                                                       key="p1y";<BR>                                                                                                                                                       value="45";<BR>                                                                                                                                                       }<BR>                                                                                               :button{<BR>                                                                                                                                                       label="拾起P1点(&amp;F)&lt;";<BR>                                                                                                                                                       key="pickp1";<BR>                                                                                                                                                       }<BR>                                                                                                                               }<BR>                                                                                               :column{<BR>                                                                                                       :edit_box{<BR>                                                                                                                                                       label="P2(&amp;X)";<BR>                                                                                                                                                       key="p2x";<BR>                                                                                                                                                       value="90";<BR>                                                                                                                                                       }<BR>                                                                                                       :edit_box{<BR>                                                                                                                                                       label="P2(&amp;Y)";<BR>                                                                                                                                                       key="p2y";<BR>                                                                                                                                                       value="90";<BR>                                                                                                                                                       }<BR>                                                                                                       :button{<BR>                                                                                                                                                       label="拾起P2点(&amp;S)&lt;";<BR>                                                                                                                                                       key="pickp2";<BR>                                                                                                                                                       }<BR>                                                                                                                                                       }<BR>                                                                                                                               }<BR>                                                                                       }<BR>                                                               }<BR>                                                               ok_cancel;<BR>                                       }<BR>

meflying 发表于 2004-5-30 10:53:00

这里是怎么回事?


(setq 1 (+ 1 la lb))<BR>       (setq 1 (* h 1))
页: [1]
查看完整版本: 请问这段程序