yandib0880 发表于 2003-2-6 20:08:00

是个问题[求助]

对我来说是个问题
指定要打开文件的路径语法是什么?如果不在cad的配置路径里面怎么用?
另:想在一个文件里存取两类信息比如名称、编号,然后分别填充在a,b两个列表框里,我现在是打开两个文件存取(怎么优化一下)
(defun c:re_ydth (/      dcl_id   all_lisp_list
all_blk_list current_line re_ydth indx_2
indx_3       load_lib   jdcad_lib jdcad_blk
lib_lisp   lib_str   name list_str
ai_str       ai_lisp   I:Path
)
(setq dcl_id (load_dialog "list_path.dcl"))
(if (not (new_dialog "list_path" dcl_id))
    (exit)
)
(setq I:Path "E:/AutoCAD R14/libs")
(if (not (setq filename (findfile "jdcad.lib")))
    (setq filename "jdcad.lib")
)
(if (setq jdcad_lib (open filename "r"))
    (progn
      (setq current_line (read-line jdcad_lib))
      (while (and (/= "" current_line)
(/= nil current_line)
(/= ":" (substr current_line 1 1))
   )
(setq current_line (read-line jdcad_lib))
(while current_line
(setq name (substr current_line 10))
(setq all_lisp_list (cons name all_lisp_list))
(setq all_lib_list (cons name all_lib_list))
(setq current_line (read-line jdcad_lib))
(while (/= ":" (substr current_line 1 1))
    (setq lib_lisp (cons (read current_line) lib_lisp))
    (setq current_line (read-line jdcad_lib))
)
(set (read (strcat "ai_lisp|" name)) (reverse lib_lisp))
(setq lib_lisp '())
(setq current_line (read-line jdcad_lib))
(while
    (and current_line (/= ":" (substr current_line 1 1)))
   (setq current_line (read-line jdcad_lib))
   (< (length all_lisp_list) (getvar "maxsort"))
)
(setq all_lisp_list (acad_strlsort all_lisp_list))
)
(start_list "indx_2")
(mapcar 'add_list all_lisp_list)
(end_list)
(set_tile "indx_2" "0")
(close jdcad_lib)
      )
    )
)
(if (not (setq filename (findfile "jdcad.blk")))
    (setq filename "jdcad.blk")
)
(if (setq jdcad_blk (open filename "r"))
    (progn
      (setq current_line (read-line jdcad_blk))
      (while (and (/= "" current_line)
(/= nil current_line)
(/= ":" (substr current_line 1 1))
   )
(setq current_line (read-line jdcad_blk))
(while current_line
(setq name (substr current_line 10))
(setq all_blk_list (cons name all_blk_list))
(setq current_line (read-line jdcad_blk))
(while (/= ":" (substr current_line 1 1))
    (setq blk_lisp (cons (read current_line) blk_lisp))
    (setq current_line (read-line jdcad_blk))
)
(set (read (strcat "ai_lisp|" name)) (reverse blk_lisp))
(setq blk_lisp '())
(setq current_line (read-line jdcad_blk))
(while
    (and current_line (/= ":" (substr current_line 1 1)))
   (setq current_line (read-line jdcad_blk))
   (< (length all_blk_list) (getvar "maxsort"))
)
(setq all_blk_list (acad_strlsort all_blk_list))
)
(start_list "indx_3")
(mapcar 'add_list all_blk_list)
(end_list)
(set_tile "indx_3" "0")
(close jdcad_blk)
      )
      (action_tile "up" "(up_down)")
      (mode_tile "up" 3)
      (mode_tile "re_lib" 2)
      (mode_tile "down" 3)
      (start_dialog)
      (unload_dialog dcl_id)
    )
)
)

cy956 发表于 2003-2-6 23:26:00

你好像在xd那边也提了问题。

你可以用doslib的函数,几句话就解决问题。用lisp写也可以,但麻烦多了,
而且一样要用到doslib或vlisp或其他dos工具的函数。

thcad 发表于 2003-2-7 21:02:00

全路径

如果不在搜索路径内,就要全路径了.
用一个文件比较好一些,文件用表的格式存:
(1张三)
(2李四)
....
页: [1]
查看完整版本: 是个问题[求助]