马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
 - [FONT=courier new](load "xyp_lib")
- ;|加载通用函数(可在签名栏直接下载)
- 如果已经下载xyp_lib并放到搜索路径下可以不再下载!
- 利用以下任何一种方式即可加载和运行通用函数内的所有子程序:
- 1.在acad.lsp中增加(load"xyp_lib")
- 2.在每个程序内增加(load"xyp_lib")
- 3.在command下,输入(load"xyp_lib")
- 4.在菜单.mnl中增加(load"xyp_lib")
- 5.将xyp_lib.vlx文件直接拽到cad屏幕
- [COLOR=red] ★通用函数下载地址:[/COLOR]
- [url]http://www.xdcad.net/forum/attachment.php?s=&postid=1606661[/url]
- [url]http://www.mjtd.com/bbs/dispbbs.asp?boardID=3&ID=37554&page=1[/url]|;
- ;;;功能:删除文本的前缀或后缀
- ;;;删除前后缀
- (defun c:scqhz () ;erase-pre-suf
- (CMDLA0)
- (if (null mode)
- (setq mode "1")
- )
- (setq mode (UKWORD 7 "1 2" "\n文本删除 : 1-前缀/2-后缀" mode)
- ss (ssget '((0 . "TEXT")))
- i -1
- )
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (setq ent (entget s1)
- tx (dxf 1 ent)
- len (strlen tx)
- )
- (cond ((= mode "1") (main1))
- ((= mode "2") (main2))
- )
- )
- (CMDLA1)
- )
- (defun main1 ()
- (if (= len 2)
- (progn
- (setq tx1 (substr tx 1 1))
- (if (<= (ASCII tx1) 160)
- (progn
- (setq tx1 (substr tx 2))
- (sub_upd s1 1 tx1)
- )
- )
- )
- )
- (if (> len 2)
- (progn
- (setq tx1 (substr tx 1 1))
- (if (<= (ASCII tx1) 160)
- (setq tx1 (substr tx 2))
- (setq tx1 (substr tx 3))
- )
- (sub_upd s1 1 tx1)
- )
- )
- )
- (defun main2 ()
- (if (= len 2)
- (progn
- (setq tx1 (substr tx len 1))
- (if (<= (ASCII tx1) 160)
- (progn
- (setq tx1 (substr tx 1 (- len 1)))
- (sub_upd s1 1 tx1)
- )
- )
- )
- )
- (if (> len 2)
- (progn
- (setq tx1 (substr tx len 1))
- (if (<= (ASCII tx1) 160)
- (setq tx1 (substr tx 1 (- len 1)))
- (setq tx1 (substr tx 1 (- len 2)))
- )
- (sub_upd s1 1 tx1)
- )
- )
- )
- (pxyp "scqhz (删除前后缀)")
- (princ)[/FONT]
|