明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1326|回复: 3

[资源] CAD逐条添加文本

[复制链接]
发表于 2018-4-3 16:23 | 显示全部楼层 |阅读模式
运用小程序需要安装Microsoft .NET Framework4.0

本帖子中包含更多资源

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

x
发表于 2019-6-2 18:22 | 显示全部楼层
正好用的到,不过要是lsp就好了
发表于 2019-6-3 00:14 | 显示全部楼层
  1. (vl-load-com)
  2. (defun C:T0603( / FilePath FFile FLine TextList  MS Index InsertPt)   
  3.   (setq FilePath (getfiled "选择待标注的文件" "" "" 8))  
  4.   (if (null FilePath)
  5.     (exit)
  6.     )
  7.   (setq FFile (open FilePath "r") TextList '())
  8.   (setq FLine (read-line FFile))
  9.   (while FLine
  10.     (setq TextList (cons FLine TextList))
  11.     (setq FLine (read-line FFile))
  12.     )
  13.   (close FFile)
  14.   (setq TextList (reverse TextList));反向
  15.   (setq MS (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
  16.   (setq Index 0)
  17.   (repeat (length TextList)
  18.     (setq FLine (nth Index TextList) Index (1+ Index))
  19.     (setq InsertPt (getpoint "\n拾取插入点"))
  20.     (if InsertPt
  21.       (vla-addtext MS FLine (vlax-3d-point InsertPt) 2)
  22.       )
  23.     )
  24.   (prin1)
  25.   )


好久没有写LISP了
发表于 2019-6-3 14:42 | 显示全部楼层
guohq 发表于 2019-6-3 00:14
好久没有写LISP了


给你点个赞!超级快速反应啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-20 20:19 , Processed in 0.286200 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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