本帖最后由 wx302008008 于 2021-11-21 16:57 编辑
- <div class="blockcode"><blockquote>(defun c:ttt ( / a ss n i qz hz qz0 hz0)
- (setq a (getint "[1:标注添加前后缀 2:标注去除前缀 3:标注去除后缀]:" ))
- (princ)
- (cond
- ((= a 1)
- (princ "选择需要添加前后缀的线性标注:")
- (princ)
- (setq ss (ssget '((0 . "DIMENSION")))
- n (sslength ss)
- i 0
- )
- (setq qz (getstring "输入要添加的前缀:"))
- (if
- (= qz nil)
- (setq qz "")
- )
- (setq hz (getstring "输入要添加的后缀:"))
- (if
- (= hz nil)
- (setq hz "")
- )
- (while (< i n)
- (setq qz0 (Vlax-Get (Vlax-Ename->Vla-Object (ssname ss i)) 'TextPrefix )
- hz0 (Vlax-Get (Vlax-Ename->Vla-Object (ssname ss i)) 'TextSuffix )
- )
- (Vlax-Put-Property (Vlax-Ename->Vla-Object (ssname ss i)) 'TextPrefix (if (= qz0 "") qz (strcat qz qz0)))
- (Vlax-Put-Property (Vlax-Ename->Vla-Object (ssname ss i)) 'TextSuffix (if (= hz0 "") hz (strcat hz0 hz)))
- (setq i (+ i 1))
- )
- )
- ((= a 2)
- (princ "选择需要删除前缀的线性标注:")
- (princ)
- (setq ss (ssget '((0 . "DIMENSION")))
- n (sslength ss)
- i 0
- )
- (while (< i n)
- (Vlax-Put-Property (Vlax-Ename->Vla-Object (ssname ss i)) 'TextPrefix "")
- (setq i (+ i 1))
- )
- )
- ((= a 3)
- (princ "选择需要删除后缀的线性标注:")
- (princ)
- (setq ss (ssget '((0 . "DIMENSION")))
- n (sslength ss)
- i 0
- )
- (while (< i n)
- (Vlax-Put-Property (Vlax-Ename->Vla-Object (ssname ss i)) 'TextSuffix "")
- (setq i (+ i 1))
- )
- )
- )
- )
|