明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2031|回复: 2

是个问题[求助]

[复制链接]
发表于 2003-2-6 20:08 | 显示全部楼层 |阅读模式
对我来说是个问题
指定要打开文件的路径语法是什么?如果不在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)
    )
  )
)
发表于 2003-2-6 23:26 | 显示全部楼层

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

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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2003-2-7 21:02 | 显示全部楼层

全路径

如果不在搜索路径内,就要全路径了.
用一个文件比较好一些,文件用表的格式存:
(1  张三)
(2  李四)
....
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-3-29 06:16 , Processed in 0.246904 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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