Lee Mac 发表于 2022-7-6 15:18:59

不确定这样做是否有效:
 

(defun c:txt2blk (/ file nl lst)
(vl-load-com)
(if (and (or (tblsearch "BLOCK" "arrow")
            (findfile "arrow.dwg"))
          (setq file
            (getfiled "Select Text File"
            (if *load *load "") "txt" ))
   (progn
   (setq *load file file (open file "r"))
   (while (setq nl (read-line file))
       (setq lst (cons (StrBrk nl 9) lst)))
   (close file)
   (foreach x lst
       (command "_.-insert" "arrow" "_non"
         (mapcar 'distof (list (car x) (cadr x)))
         "1" "1" (distof (last x))))))
(princ))   

(defun StrBrk (str chrc / pos lst)
(while (setq pos (vl-string-position chrc str))
   (setq lst (cons (substr str 1 pos) lst)
         str (substr str (+ pos 2))))
(reverse (cons str lst)))

 
我只考虑了x,y和角度,因为我不考虑箭头的原始长度,所以我知道按多大比例缩放它。
 
这假设一个文本文件的数据选项卡是分隔的。
页: 1 [2]
查看完整版本: 用excel在AutoCad中绘图