- (defun C:GGDZFZ (/ en pt1 ptnext eny ss ssx eno)
- (princ "\n选择要复制的文字")
- (setq ss (ssget '((0 . "*TEXT"))))
- (setq pt1 (getpoint "\n指定复制角点"))
- (setq ptnext (getpoint pt1 "\n指定插入点"))
- (while ptnext
- (setq eno (entlast) ssx (ssadd))
- (command ".copy" ss "" "m" pt1 ptnext "")
- (while (setq en (entnext eno)) (setq ssx (ssadd en ssx) eno en))
- (setq n 0)
- (repeat (sslength ssx)
- (setq en (ssname ssx n))
- (setq eny (ttg (vla-get-textstring (Vlax-Ename->Vla-Object en))))
- (Vlax-Put-Property (Vlax-Ename->Vla-Object en) 'TextString eny)
- (setq n (1+ n))
- );end repeat
- (setq ss ssx)
- (setq pt1 ptnext)
- (setq ptnext (getpoint pt1 "\n指定插入点"))
- )
- (princ "\n**********完成操作************")
- (prin1)
- );end
- (prin1)
-
-
-
- (defun ttg (txd / tth tthh )
- (setq tth (ttm txd) tthh (rtos (1+ tth) 2 0))
- (setq regex (vlax-create-object "Vbscript.RegExp")) ;引用正则表达式控件
- (vlax-put-property regex "IgnoreCase" 0) ;不忽略大小写
- (vlax-put-property regex "Global" 1) ;匹配方式,全文字匹配
- (vlax-put-property regex "Multiline" 1) ;多行模式
- txd
- (vlax-put-property regex "Pattern" "[0-9]+(?=[^0-9]*$)")
- (setq enX (vlax-invoke-method regex "Replace" txd tthh))
- (vlax-release-object regex)
- enx
- )
- (prin1)
- ;取得文字
- (defun ttq (x / )
- (setq xs (vla-get-TextString (vlax-ename->vla-object x)))
- )
- (prin1)
- ;提取出字符串中的数字,是直接从字串里面得到数值
- (defun ttm (en / regex S tmp str1)
- (setq regex (vlax-create-object "Vbscript.RegExp")) ;引用正则表达式控件
- (vlax-put-property regex "IgnoreCase" 0) ;不忽略大小写
- (vlax-put-property regex "Global" 1) ;匹配方式,全文字匹配
- (vlax-put-property regex "Multiline" 1) ;多行模式
- (vlax-put-property regex "Pattern" "[0-9]+(?=[^0-9]*$)")
- (setq s (vlax-invoke-method regex "Execute" en))
- ;;将规则运用到STR字符,得到提取出的文字内容
- (setq ent (VLAX-FOR tmp s (vlax-get-property tmp "value")))
- (vlax-release-object regex)
- (setq ent (atoi ent))
- ent
- )
- (prin1)
愿意赞助一下的话就用币买
没有币的就直接复制吧
|