明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1211|回复: 8

[提问] 求助"文字位置互换"

[复制链接]
发表于 2014-12-21 08:46 | 显示全部楼层 |阅读模式
求助大神,本人在文字录入的时候,将文字的位置录入反了,现在换过来,因为工作量太大,请求帮助。"2.05/2.0"变成“2.0/2.05"
发表于 2014-12-21 09:32 | 显示全部楼层
不能查找替换吗
发表于 2014-12-21 09:42 | 显示全部楼层
请上传该文件且附三例解说...
 楼主| 发表于 2014-12-21 15:33 | 显示全部楼层
这个是正确的"2.0/2.05"
这个是错误的"2.05/2.0"。就是想把2.0和2.05的位置换一下,中间是用“/"隔开的
发表于 2014-12-21 16:04 | 显示全部楼层
Command: (setq str2 (parse str "/"))
("2.0" "2.05")

Command: (strcat (last str2) "/" (car Str2))
"2.05/2.0"
发表于 2014-12-21 17:35 | 显示全部楼层
  1. ;; 需要e派工具箱(XCAD)的支持:http://yunpan.cn/Qh7rDf4Y2xwYN(提取码:06ee)
  2. (defun c:tt ()
  3.   (xyp-Start)
  4.   (setq i -1)
  5.   (if (setq ss (ssget '((0 . "text") (1 . "*/*"))))
  6.     (while (setq s1 (ssname ss (setq i (1+ i))))
  7.       (setq lst        (xyp-Str2LstSpr (xyp-DXF 1 s1) "/")
  8.             tx        (strcat (cadr lst) "/" (car lst))
  9.             s1        (xyp-SubUpd s1 1 tx)
  10.       )
  11.     )
  12.   )
  13.   (xyp-End)
  14. )
发表于 2014-12-22 18:25 | 显示全部楼层
按/隔开 .重新构造字符就OK了
发表于 2014-12-24 21:24 | 显示全部楼层
直接用FIND命令。。。

本帖子中包含更多资源

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

x
发表于 2014-12-25 11:10 | 显示全部楼层
  1. (defun c:tt ()
  2. (while (and (setq s1 (entsel "\n选择文字: "))
  3.              (setq ent (entget(car s1)))
  4.              (= (cdr(assoc 0 ent)) "TEXT"))
  5.   (setq txt (cdr(assoc 1 ent)))
  6.   (if (wcmatch txt "*/*") (progn
  7.    (setq n (vl-string-position (ascii "/") txt))
  8.    (setq txt (strcat (substr txt (+ n 2)) "/" (substr txt 1 n)))
  9.    (entmod (subst (cons 1 txt) (assoc 1 ent) ent))
  10.   ))
  11. )
  12. (princ)
  13. )
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-20 08:19 , Processed in 2.499652 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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