664571221 发表于 2016-3-25 14:03:16

悬赏30币,求一个如下的功能

梁集中标注,输入命令JZBZ   后选择集中标注后, 标注变为如下状态,三个文字是独立的

Gu_xl 发表于 2016-3-25 14:03:17

664571221 发表于 2016-3-26 12:06 static/image/common/back.gif
G版你好,能不能改成可以批量框选的

(defun c:jzbz (/ e el n n1 str1 str2)
(if (setq ss (ssget '((0 . "text"))))
    (repeat (setq k (sslength ss))
      (setq e (ssname ss (setq k (1- k))))
      (setq txt (cdr (assoc 1 (setq el (entget e)))))
      (if (and
          (setq n (VL-STRING-SEARCH ")" txt 0))
          (or
              (setq n1 (VL-STRING-SEARCH "x" txt 0))
              (setq n1 (VL-STRING-SEARCH "X" txt 0))
          )
          )
        (progn
          (setq        str1
               (rtos (* 0.001 (atof (substr txt (+ 2 n) (- n1 n 1))))
                     2
                     2
               )
          )
          (setq str2 (rtos (* 0.001 (atof (substr txt (+ 2 n1)))) 2 2))
          (command "_copy" e "" "0,0,0" "5000,0,0")
          (entmod (subst (cons 1 str1)
                       (assoc 1 (Setq el (entget (entlast))))
                       el
                  )
          )
          (command "_copy" (entlast) "" "0,0,0" "2000,0,0")
          (entmod (subst (cons 1 str2)
                       (assoc 1 (Setq el (entget (entlast))))
                       el
                  )
          )
        )
      )
    )
)
(princ)
)

被承包的东子 发表于 2016-3-25 23:38:44

没懂什么意思,可以表达的更详细一点

664571221 发表于 2016-3-26 10:42:30

被承包的东子 发表于 2016-3-25 23:38 static/image/common/back.gif
没懂什么意思,可以表达的更详细一点

老师就是开始的文字是第一张图片WKL17(1) 240*450
执行命令后变成WKL17(1) 240*450       0.24    0.45,其中下面那个是文字的距离,三个文字是独立的,不过在同一水平

Gu_xl 发表于 2016-3-26 11:37:31

(defun c:jzbz (/ e el n n1 str1 str2)
(while (and (setq e (car (entsel "\n选择标注文字:")))
              (= "TEXT" (cdr (assoc 0 (setq el (entget e)))))
       )
    (setq txt (cdr (assoc 1 el)))
    (if (and
          (setq n (VL-STRING-SEARCH ")" txt 0))
          (or
          (setq n1 (VL-STRING-SEARCH "x" txt 0))
          (setq n1 (VL-STRING-SEARCH "X" txt 0))
          )
          )
      (progn
        (setq str1 (rtos (* 0.001 (atof (substr txt (+ 2 n) (- n1 n 1 )))) 2 2))
        (setq str2 (rtos (* 0.001 (atof (substr txt (+ 2 n1)))) 2 2))
        (command "_copy" e "" "0,0,0" "5000,0,0")
        (entmod (subst (cons 1 str1) (assoc 1 (Setq el (entget (entlast)))) el))
        (command "_copy" (entlast) "" "0,0,0" "2000,0,0")
        (entmod (subst (cons 1 str2) (assoc 1 (Setq el (entget (entlast)))) el))
        )
      )
)
(princ)
)

664571221 发表于 2016-3-26 12:06:46

Gu_xl 发表于 2016-3-26 11:37 static/image/common/back.gif


G版你好,能不能改成可以批量框选的
页: [1]
查看完整版本: 悬赏30币,求一个如下的功能