乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: mossieramm

[编程交流] 用excel在AutoCad中绘图

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:18:59 | 显示全部楼层
不确定这样做是否有效:
 
  1. (defun c:txt2blk (/ file nl lst)
  2. (vl-load-com)
  3. (if (and (or (tblsearch "BLOCK" "arrow")
  4.               (findfile "arrow.dwg"))
  5.           (setq file
  6.             (getfiled "Select Text File"
  7.               (if *load *load "") "txt" ))
  8.    (progn
  9.      (setq *load file file (open file "r"))
  10.      (while (setq nl (read-line file))
  11.        (setq lst (cons (StrBrk nl 9) lst)))
  12.      (close file)
  13.      (foreach x lst
  14.        (command "_.-insert" "arrow" "_non"
  15.          (mapcar 'distof (list (car x) (cadr x)))
  16.            "1" "1" (distof (last x))))))
  17. (princ))     
  18. (defun StrBrk (str chrc / pos lst)
  19. (while (setq pos (vl-string-position chrc str))
  20.    (setq lst (cons (substr str 1 pos) lst)
  21.          str (substr str (+ pos 2))))
  22. (reverse (cons str lst)))

 
我只考虑了x,y和角度,因为我不考虑箭头的原始长度,所以我知道按多大比例缩放它。
 
这假设一个文本文件的数据选项卡是分隔的。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-5 03:21 , Processed in 0.923590 second(s), 52 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表