明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3421|回复: 10

[建筑] 求个选择文字基点,连续复制编辑的梁山泊

  [复制链接]
发表于 2014-7-30 11:59 | 显示全部楼层 |阅读模式
经常要原位标注钢筋,,求个选择文字基点连续复制编辑的 lsp。
具体功能:选择文字及其基点后,连续复制并自动进入编辑,当文字输入后鼠标点击另一基点即完成文字输入,并进入另一个文字编辑输入(文字内容为上次输入的文字)。
发表于 2014-7-30 14:34 | 显示全部楼层
基本上按照你的意思来的

注意在选复制目标点时
鼠标不要去做一些高难度的动作
比如快速移动且双击啥的


(defun c:tt()
        (if (setq a (ssget ":e:s" '((0 . "text"))))
                (progn
                        (setq a (ssname a 0))
                        (setq po (cdr (assoc 10 (entget a))))
                        (setq tt (cdr (assoc 1 (entget a))))
                       
                        (setq pt Nil)
                        (while (not (equal po pt 1e-4))
                                (setq pt po)
                                (vl-cmdf "copy" a "" "non" pt pause)
                                (setq po (getvar "lastpoint"))
                                (setq ppp (cadr (grread T)))
                                (if (equal po ppp 1)
                                        (vl-cmdf "ddedit" (setq a (entlast)) "")
                                        (vl-cmdf "erase" (entlast) "")
                                )
                        )
                )
        )
(princ)
)
发表于 2014-7-30 15:06 | 显示全部楼层
上面一个不支持正交模式
小改了一下

(defun c:tt()
        (if (setq a (ssget ":e:s" '((0 . "text"))))
                (progn
                        (setq a (ssname a 0))
                        (setq po (cdr (assoc 10 (entget a))))
                        (setq tt (cdr (assoc 1 (entget a))))
                       
                        (setq pt Nil)
                        (while (not (equal po pt 1e-4))
                                (setq pt po)
                                (if (vl-cmdf "copy" a "" "non" pt pause)
                                        (progn
                                                (setq po (getvar "lastpoint"))
                                                (setq ppp (cadr (grread T)))
                                                (if (or
                                                                (equal (car  po) (car  ppp) 1)
                                                                (equal (cadr po) (cadr ppp) 1)
                                                        )
                                                        (vl-cmdf "ddedit" (setq a (entlast)) "")
                                                        (vl-cmdf "erase" (entlast) "")
                                                )
                                        )
                                )
                        )
                )
        )
(princ)
)
 楼主| 发表于 2014-7-30 15:32 | 显示全部楼层
masterlong 发表于 2014-7-30 15:06
上面一个不支持正交模式
小改了一下

好像没办法选择基点哦。只能用文字的好像插入点捕捉
发表于 2014-7-30 17:22 | 显示全部楼层

(setq po (cdr (assoc 10 (entget a))))
换成
(setq po (getpoint "\n指定基点: "))

点评

请问 如何把文字由插入点改为对正点  发表于 2014-8-3 08:15
发表于 2014-7-30 20:37 | 显示全部楼层
masterlong 发表于 2014-7-30 14:34
基本上按照你的意思来的

注意在选复制目标点时

程序不错,有创意,有使用价值
发表于 2014-7-30 21:43 | 显示全部楼层
本帖最后由 xyp1964 于 2014-7-30 22:17 编辑
  1. ;; 连续动态复制
  2. (defun c:tt ()
  3.   (if (setq s1 (car (entsel "\n选择文本: ")))
  4.     (progn
  5.       (setq mode t)
  6.       (while mode
  7.         (setq s1 (xyp-copy s1)
  8.               a (xyp-GrreadMove s1 (xyp-DXF 10 s1))
  9.         )
  10.         (if (= a 3)
  11.           (vl-cmdf "ddedit" s1 "")
  12.           (progn (entdel (entlast)) (setq mode nil))
  13.         )
  14.       )
  15.     )
  16.   )
  17.   (princ)
  18. )

本帖子中包含更多资源

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

x
发表于 2014-7-31 09:04 | 显示全部楼层
好程序,挺实用的,赞一个~
 楼主| 发表于 2014-7-31 11:07 | 显示全部楼层
xyp1964 发表于 2014-7-30 21:43

不知道为什么,容易出错。
 楼主| 发表于 2014-7-31 11:07 | 显示全部楼层
masterlong 发表于 2014-7-30 17:22

(setq po (cdr (assoc 10 (entget a))))
换成

嗯,可以啦
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-20 04:02 , Processed in 0.222105 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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