明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1479|回复: 2

请教高手:如何能得到想要读取的文件名?谢谢!

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

请教高手:如何能得到想要读取的文件名,变量fi中存入?谢谢!


(defun c:z1(  )

    (vl-load-com)
    (setvar "osmode" 0)
     (setq dcl_id (load_dialog "ys.dcl"))
     (if (not (new_dialog "ys" dcl_id))  (exit))

     (action_tile "filein" "(getf)")

     (setq fi (get_tile "fi"))
    ; (done_dialog)

     (start_dialog )
     (unload_dialog dcl_id)

     (setq fi (open fi "r")) (setq rl (read-line fi))

    ys.dcl

ys:dialog{
   label = "孔 压 试 验 图 绘 制";
:row {
  :edit_box{
       label = "数据文件名:";
       mneonic = "F";
       key = "fi";
       edit_width =30;
   }
  :button{
       label = "浏览";
       key = "filein";
       width = 1;
       height = 1;
       mnemonic= "B";
   }
}

   spacer_1;
   ok_cancel_help;
}

发表于 2006-3-7 22:27 | 显示全部楼层
  1.   (defun c:z1 ()
  2. (setvar "osmode" 0)
  3. (if (setq dcl_id (load_dialog "ys.dcl")) (progn
  4.   (if (new_dialog "ys" dcl_id) (progn
  5.    (action_tile "fi" "(setq fi value$)")
  6.    (action_tile "filein" "(getf)")
  7.    (action_tile "accept" "(readdata) (done_dialog 1)")
  8.    (action_tile "cancel" "(done_dialog 0)")
  9.    (setq re (start_dialog))
  10.   )
  11.    (princ "\nCon't display dialog!")
  12.   )
  13.   (unload_dialog dcl_id)
  14. )
  15.   (princ "\nUnable to load dialog box!")
  16. )
  17. (if (= re 1) (progn
  18.   (if (setq f (open fi "r")) (progn
  19.    (setq rl (read-line fi))
  20.    (close f)
  21.   ))
  22. ))
  23. )
  24. (defun readdata () (setq fi (get_tile "fi")))
  25. (defun getf ()
  26. (set_tile "fi" (if (setq fi (getfiled "\nSelect filename" "" "*" 4)) fi nil))
  27. )
 楼主| 发表于 2006-3-8 08:03 | 显示全部楼层

多谢指点!

关键是最下面的一句。

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

本版积分规则

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

GMT+8, 2024-5-17 18:41 , Processed in 0.195620 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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