明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1024|回复: 1

帮我审一下程序

[复制链接]
发表于 2007-7-3 14:58 | 显示全部楼层 |阅读模式

       平时用对话框用得很少,想编对程序,用对话框的方式输入图元的属性,同时也能修改.程序如下:

(defun c:addd( )
  (setq oldos (getvar "osmode"))
  (setq oldortho (getvar "orthomode"))
  (setq hh(car (entsel "\nSelect an object:"))
 vh (vlax-ename->vla-object hh)
 )
  (setq ma (vlax-ldata-get vh "machining")
 depth (vlax-ldata-get vh "depth")
 chk 0.0
 )
  (if (= ma nil) (setq ma "0"))
  (if (= depth nil) (setq depth "0.0"))
 
  (setq dcl_id (load_dialog "e:/z/dcl/attribute.dcl")
 chk 0)
  (new_dialog "attribute" dcl_id)
  (add-addphrase)
  (set_tile "ma"  ma)
  (set_tile "depth"  depth )

    
 
  ;(action_tile "use_up " "(setq up (atoi (get_tile \"use_up\")))(use-setc up)")
  ;(action_tile "ma" "(setq ma (get_tile \"ma\"))")
  (action_tile "accept" "(setq chk 1) (setq ma (get_tile \"ma\"))
  (setq depth (get_tile \"depth\"))(done_dialog)")
  (start_dialog)
  (unload_dialog dcl_id)
 
  (if (= chk 1)
    (progn
    (vlax-ldata-put vh "machining" ma)
    (vlax-ldata-put vh "depth" depth)
    (setq man (cond ((= ma 1) "MILL")
      ((= ma 2) "EDM")
      ((= ma 3) "BORE")
      ((= ma 4) "REAM")
      ((= ma 5) "PG")
      ((= ma 6) "CB")
      ((= ma 0) "")
      )
   )
  
    (setq end (strcat man  depth))
    (command "leader" (setq pt1 (getpoint "\nSelect source point:")) (getpoint pt1 "\nSelect text local point:")
      "" "" "" end "")
    )
    )
 
  (setvar "osmode" oldos)
  (setvar "orthomode" oldortho)
  (KKEE 3.0)
  (princ)
  (command "undo" "e" )
  )

(defun add-addphrase()
  (setq sup nil)
  (setq f_id (open "e:/z/format/add.txt" "r"))
  (setq sup(read-line f_id)
 upgroup(list)
 )
  (while (/= sup nil)
    (setq upgroup (cons sup upgroup))
    (setq sup (read-line f_id))
    )
  (close f_id)
  (start_list "ma" 3 0)
  (setq upgroup (reverse upgroup))
  (mapcar 'add_list upgroup)
  (end_list)
  )

DCL对话框如下:

attribute: dialog{
 label="Rectangle";
        :popup_list {
        label="Machining";
        key= "ma";
       
        height=10;
        }
 
    :edit_box {label= "Machining depth:";
    key = "depth";
    width= 25;
    height =1;
    fixed_width=true;
    fixed_height=true;
    }

ok_cancel;}

哪位高手有空帮我看一下程序错在哪里.POPUP_LIST的VALUE是1 还是"1".

发表于 2007-7-4 09:35 | 显示全部楼层
popup_list的值是数字的字符串:"0","1",...,"n"
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-18 19:30 , Processed in 0.243148 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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