明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 862|回复: 5

[已解答] 悬赏30币,求一个如下的功能

[复制链接]
发表于 2016-3-25 14:03 | 显示全部楼层 |阅读模式
30明经币
梁集中标注,输入命令  JZBZ   后选择集中标注后, 标注变为如下状态,三个文字是独立的
附件: 您需要 登录 才可以下载或查看,没有账号?注册

最佳答案

发表于 2016-3-25 14:03 | 显示全部楼层
664571221 发表于 2016-3-26 12:06
G版你好,能不能改成可以批量框选的

  1. (defun c:jzbz (/ e el n n1 str1 str2)
  2.   (if (setq ss (ssget '((0 . "text"))))
  3.     (repeat (setq k (sslength ss))
  4.       (setq e (ssname ss (setq k (1- k))))
  5.       (setq txt (cdr (assoc 1 (setq el (entget e)))))
  6.       (if (and
  7.             (setq n (VL-STRING-SEARCH ")" txt 0))
  8.             (or
  9.               (setq n1 (VL-STRING-SEARCH "x" txt 0))
  10.               (setq n1 (VL-STRING-SEARCH "X" txt 0))
  11.             )
  12.           )
  13.         (progn
  14.           (setq        str1
  15.                  (rtos (* 0.001 (atof (substr txt (+ 2 n) (- n1 n 1))))
  16.                        2
  17.                        2
  18.                  )
  19.           )
  20.           (setq str2 (rtos (* 0.001 (atof (substr txt (+ 2 n1)))) 2 2))
  21.           (command "_copy" e "" "0,0,0" "5000,0,0")
  22.           (entmod (subst (cons 1 str1)
  23.                          (assoc 1 (Setq el (entget (entlast))))
  24.                          el
  25.                   )
  26.           )
  27.           (command "_copy" (entlast) "" "0,0,0" "2000,0,0")
  28.           (entmod (subst (cons 1 str2)
  29.                          (assoc 1 (Setq el (entget (entlast))))
  30.                          el
  31.                   )
  32.           )
  33.         )
  34.       )
  35.     )
  36.   )
  37.   (princ)
  38. )
回复

使用道具 举报

发表于 2016-3-25 23:38 | 显示全部楼层
没懂什么意思,可以表达的更详细一点
回复

使用道具 举报

 楼主| 发表于 2016-3-26 10:42 | 显示全部楼层
被承包的东子 发表于 2016-3-25 23:38
没懂什么意思,可以表达的更详细一点

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

使用道具 举报

发表于 2016-3-26 11:37 | 显示全部楼层
  1. (defun c:jzbz (/ e el n n1 str1 str2)
  2.   (while (and (setq e (car (entsel "\n选择标注文字:")))
  3.               (= "TEXT" (cdr (assoc 0 (setq el (entget e)))))
  4.          )
  5.     (setq txt (cdr (assoc 1 el)))
  6.     (if (and
  7.           (setq n (VL-STRING-SEARCH ")" txt 0))
  8.           (or
  9.             (setq n1 (VL-STRING-SEARCH "x" txt 0))
  10.             (setq n1 (VL-STRING-SEARCH "X" txt 0))
  11.             )
  12.           )
  13.       (progn
  14.         (setq str1 (rtos (* 0.001 (atof (substr txt (+ 2 n) (- n1 n 1 )))) 2 2))
  15.         (setq str2 (rtos (* 0.001 (atof (substr txt (+ 2 n1)))) 2 2))
  16.         (command "_copy" e "" "0,0,0" "5000,0,0")
  17.         (entmod (subst (cons 1 str1) (assoc 1 (Setq el (entget (entlast)))) el))
  18.         (command "_copy" (entlast) "" "0,0,0" "2000,0,0")
  19.         (entmod (subst (cons 1 str2) (assoc 1 (Setq el (entget (entlast)))) el))
  20.         )
  21.       )
  22.   )
  23.   (princ)
  24. )
回复

使用道具 举报

 楼主| 发表于 2016-3-26 12:06 | 显示全部楼层
Gu_xl 发表于 2016-3-26 11:37

G版你好,能不能改成可以批量框选的
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 06:12 , Processed in 0.183319 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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