明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 850|回复: 2

删除文字字母前后缀?

[复制链接]
发表于 2021-6-8 10:24 | 显示全部楼层 |阅读模式
  1. (vl-list->string(vl-remove-if-not '(LAMBDA (x) (and(<= x 57) (>= x 45)) )  
  2. (vl-string->list "a-12345.635asx"))  )
  3. "-12345.635"

 楼主| 发表于 2021-6-8 17:50 | 显示全部楼层
本帖最后由 树櫴希德 于 2023-8-6 11:08 编辑

关于选择含数字文字


  1. (ssget '((0 . "text,mtext") (1 . "*[0-9]*")   )   ) ;选择字母数字结合文字和数字


  2. (ssget '((0 . "text,mtext") (1 . "~[0-9]*")   )   ) ;选择非纯数字文字和字母数字结合文字


  3. (ssget '((0 . "text,mtext") (1 . "~*[0-9]*")   )   ) ;选择纯非数字文字

  4. (ssget '((0 . "text,mtext") (1 . "~*[~--9]*")   )   )  ;选择纯数字文字=====这个才是 用于求和
  5. (ssget '((0 . "text,mtext") (1 . "[-1-9]*")   )   )  ;选择纯数字文字(含负数)
  6. ;;功能:带提示、关键字、过滤表、选择错误时的提示并且会亮显所选对像的entsel
  7. ;;用法:( clh-entsel  提示信息  关键字  过滤表  选择错误时提示)
  8. ;;举例:(clh-entsel  "\n请选择一个圆:"  "A B C"   '((0 . "circle"))  "\n所选对像不符合要求!请重新选择:")

  9. ;(clh-entsel  "\n请选择一个数字:"  "A B C"   '((0 . "TEXT")(1 . "~*[~-1-9]*"))  "\n所选对像不符合要求!请重新选择:")

  10. ;;说明:过滤表与ssget的过滤表相同;函数由CLH521,2009.6.7参考了一些网上资料整理编写
  11. (defun clh-entsel (msg key fil ermsg / el ss)
  12.   (while (and (setvar "errno" 0)
  13.                   (not (and (setq el (apply '(lambda (msg key) (initget key) (entsel msg)) (list msg key)))
  14.                                         (if (= (type el) 'str)
  15.                                             el
  16.                                                (if (setq ss (ssget (cadr el) fil))
  17.                                                   ss
  18.                                                       (progn (princ ermsg) (setq ss nil))
  19.                                                );if
  20.                                             );if
  21.                                         );and
  22.                           );not
  23.                           (/= (getvar "errno") 52)
  24.                  );and
  25.   );while
  26.   (if (= (type el) 'list) (redraw (car el) 3));亮显选中的对像
  27.   el
  28. )
  29. ;clh-entsel函数完毕========================================================





发表于 2023-8-5 19:13 | 显示全部楼层
这个函数很有作用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-5 09:42 , Processed in 0.549878 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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