明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1795|回复: 6

[讨论][求助]哪位高手帮忙升级一下这个定位文本的程序.

[复制链接]
发表于 2007-4-11 09:33:00 | 显示全部楼层 |阅读模式

原程序:

(defun C:zhl_TP (/ p l n e os as ns st s nsl osl sl si chf chm chm2 olderr)
;   (princ "\n本程序快捷键为 tp !\n")
   (setq olderr  *error*             ; Initialize variables
  *error* tperr
  chm     0
  chm2   0)
   (setq p (ssget '((0 . "*TEXT"))))                 ; Select objects
   (if p (progn                      ; If any objects selected
      (while (= 0 (setq osl (strlen (setq os (getstring t "\n请输入要查找的文字:")))))
     (princ "输入错误,请重新输入!")
      );while
      (setq nsl (strlen (setq ns os)))
      (setq l 0 n (sslength p))
      (while (< l n)                 ; For each selected object...
  (if (= "TEXT" (cdr (assoc 0 (setq e (entget (ssname p l))))))
     (progn
        (setq chf nil si 1)
        (setq s (cdr (setq as (assoc 1 e))))
        (while (= osl (setq sl (strlen (setq st (substr s si osl)))))
    (if (= st os)
        (progn
   (setq s (strcat (substr s 1 (1- si)) ns
     (substr s (+ si osl))))
   (setq chf t) ; Found old string
   (setq si (+ si nsl))
        )
        (setq si (1+ si))
    )
        );while
        (if chf (progn        ; Fixed at the text and zoom to it
    (setq pc (list (nth 1 (assoc 10 e)) (nth 2 (assoc 10 e)) 0) )
    (setq th (* 30 (cdr (assoc 40 e)) ) )
    (command "zoom" "c" pc th)
    (initget "Next Xit")
    (setq key (getkword "\n选择显示下一个或退出,N下一个/X退出/ <N下一个>:"))
    (if (not key) (setq key "NEXT"))
    (if (= (strcase key) "XIT") (setq l n chm (1+ chm) ) )
    (if (= (strcase key) "NEXT")
    (setq chm (1+ chm))
    );if
        );progn
        );if

     );progn
  );if
  (setq l (1+ l))
      );while
  (setq l 0 chm2 0)
  (while (< l n)                 ; For each selected object...
  (if (= "TEXT" (cdr (assoc 0 (setq e (entget (ssname p l))))))
     (progn
        (setq chf nil si 1)
        (setq s (cdr (setq as (assoc 1 e))))
        (while (= osl (setq sl (strlen (setq st (substr s si osl)))))
    (if (= st os)
        (progn
   (setq s (strcat (substr s 1 (1- si)) ns
     (substr s (+ si osl))))
   (setq chf t) ; Found old string
   (setq si (+ si nsl))
        )
        (setq si (1+ si))
    )
        );while
        (if chf
    (setq chm2 (1+ chm2))
        );if

     );progn
  );if
  (setq l (1+ l))
      );while
     
   ));ifprogn
   (princ "\n共有 ")
   (princ chm2)
   (princ " 个定位点,目前定位在第 ")                ; Print total points fixed
   (princ chm)
   (princ " 个定位点,定位完成!")  
;   (terpri)
   (setq *error* olderr)             ; Restore old *error* handler
   (princ)
)

想做成这样的对话框:

 

 对话框:

 

 

本帖子中包含更多资源

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

x
"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2007-4-12 12:16:00 | 显示全部楼层
哪位高手能帮忙升级一下?
 楼主| 发表于 2007-4-22 10:07:00 | 显示全部楼层

难道大家对这种功能不感兴趣?

发表于 2012-6-8 12:00:34 | 显示全部楼层
哇,终于找到了,帮顶。我也很需要文本定位,不然在一个大图里面找一个文本太难了
发表于 2012-6-8 12:19:19 来自手机 | 显示全部楼层
去卜哥买个超好就三十………
发表于 2012-6-8 12:50:07 | 显示全部楼层
螺丝就特别多感兴趣啦,你有呒?我想找都找不着更好的!
发表于 2012-6-8 12:52:00 | 显示全部楼层
顶!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-9-25 12:23 , Processed in 0.176184 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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