找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 876|回复: 3

[已解决] 字符串处理——已解决

[复制链接]

已领礼包: 2个

财富等级: 恭喜发财

发表于 2019-6-26 11:35:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
本帖最后由 yinchuan99001 于 2019-7-3 13:52 编辑

;;;;;;;;;;;;;;;;;;;;;
字符串
20.00Tx516.0Wx200.0H
怎样用lisp语言得到
20x516x200
;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:ttt(/ text nam tsel)
(setq text (entget(car(entsel))))
(setq nam (assoc 1 text))
(setq tsel (cdr nam))
后面怎样处理,请教各位老师。

相关帖子

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 511个

财富等级: 财运亨通

发表于 2019-6-26 17:50:37 | 显示全部楼层
(setq tsel (cdr nam) gs nil st "1")
(while (setq wd (vl-string-search  "." tsel) wx (vl-string-search  "x" tsel))
   (setq gs (cons (substr tsel 1 wd) gs) tsel (substr tsel (+ 2 wx)))   )
(foreach x (reverse gs) (setq st (strcat st x "x")))
(setq tsel (substr (strcat st (substr tsel 1 (vl-string-search  "." tsel))) 2))
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 1 反对 0

使用道具 举报

已领礼包: 2个

财富等级: 恭喜发财

 楼主| 发表于 2019-6-27 10:03:28 | 显示全部楼层
pxr201419 发表于 2019-6-26 17:50
(setq tsel (cdr nam) gs nil st "1")
(while (setq wd (vl-string-search  "." tsel) wx (vl-string-sear ...

万分感谢您的解答,谢谢您!
(defun C:ttt ()                               
  (setq text (entget (car (entsel))))
  (setq nam (assoc 1 text))
  (setq tsel (cdr nam)        gs nil        st "1"  )
  (while (setq wd (vl-string-search "." tsel)
               wx (vl-string-search "x" tsel)
         )
    (setq gs (cons (substr tsel 1 wd) gs)
          tsel (substr tsel (+ 2 wx))
    )
  )
  (foreach x (reverse gs)
    (setq st (strcat st x "x"))
  )
  (setq tsel (substr (strcat st (substr tsel 1 (vl-string-search "." tsel)))
                     2
             )
  )
)
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 2个

财富等级: 恭喜发财

 楼主| 发表于 2019-7-9 14:25:52 | 显示全部楼层
本帖最后由 yinchuan99001 于 2019-7-9 14:29 编辑

(defun c:tttt ()
  (setq character (entget (car (entsel))))
  (setq character_en (assoc 1 character))
  (setq  string   (cdr character_en)  str_dat nil  st "1" )
  (setq num (vl-string-search "." string))
  (if (> num 0)
    (progn
      (while
        (setq num (vl-string-search "." string) tex (vl-string-search "x" string))
        (setq str_dat (cons (substr string 1 num) str_dat) string (substr string (+ 2 tex)))
      ) ; while end
      (foreach x (reverse str_dat)(setq st (strcat st x "x")))
      (setq string (substr (strcat st (substr string 1 (vl-string-search "." string))) 2))
      (setq character_en_n (cons 1 string))
      (setq character (subst character_en_n character_en character))
      (entmod character)
    );progn end
    (progn
      (while
      (setq num (vl-string-search "." string) tex (vl-string-search "x" string))
      (setq str_dat (cons (substr string 1 num) str_dat))
      (setq string (substr string (+ 2 tex) num))); while end
      (foreach x (reverse gs)(setq st (strcat st x "x")))
      (setq tsel (substr (strcat st (substr tsel 1 (vl-string-search "." tsel))) 2))
      (setq character_en_n (cons 1 string))
      (setq character (subst character_en_n character_en character))
      (entmod character)
    );progn end
  )
)
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-23 12:28 , Processed in 0.274106 second(s), 39 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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