求一个cad的lisp程序
程序功能很简单,就是在cad里输入命令em,然后选择一些文字,回车后让这些文字自动删除“,”(逗号)之后的任何文字和数字,包括“,”(逗号)本身。谢谢!...
程序功能很简单,就是在cad里输入命令em,然后选择一些文字,回车后让这些文字自动删除“,”(逗号)之后的任何文字和数字,包括“,”(逗号)本身。谢谢!
展开
2个回答
展开全部
;请试用以下程序
;by DnBc
(defun c:scdh()
(setq cm (getvar "cmdecho")) (setvar "cmdecho" 0)
(command "_undo" "be")
(while (setq ssa (ssget '((0 . "text"))))
(setq i 0 n (sslength ssa))
(repeat n
(setq dxf (entget (ssname ssa i))
zfc (cdr (assoc 1 dxf))
i (1+ i)
)
(if (or (> (setq n (vl-string-search "," zfc)) 0)
(> (setq n (vl-string-search "," zfc)) 0)
)
(progn
(setq zfc (substr zfc 1 n)
dxf (subst (cons 1 zfc) (assoc 1 dxf) dxf)
)
(entmod dxf)
)
)
)
)
(command "_undo" "e")
(setvar "cmdecho" cm)
(princ)
)
;by DnBc
(defun c:scdh()
(setq cm (getvar "cmdecho")) (setvar "cmdecho" 0)
(command "_undo" "be")
(while (setq ssa (ssget '((0 . "text"))))
(setq i 0 n (sslength ssa))
(repeat n
(setq dxf (entget (ssname ssa i))
zfc (cdr (assoc 1 dxf))
i (1+ i)
)
(if (or (> (setq n (vl-string-search "," zfc)) 0)
(> (setq n (vl-string-search "," zfc)) 0)
)
(progn
(setq zfc (substr zfc 1 n)
dxf (subst (cons 1 zfc) (assoc 1 dxf) dxf)
)
(entmod dxf)
)
)
)
)
(command "_undo" "e")
(setvar "cmdecho" cm)
(princ)
)
展开全部
;请试用以下程序
;by DnBc
(defun c:jctc()
(vl-load-com)
(if (and (setq tcm (getstring "\n图层名:"))
(/= tcm "")
)
(if (= (tblsearch "layer" tcm) nil)
(command "_layer" "n" tcm "")
(progn
(setq obj (vlax-ename->vla-object (tblobjname "layer" tcm)))
(vlax-put obj "layeron" (* -1 (1+ (vlax-get obj "layeron"))))
)
)
)
(princ)
)
;by DnBc
(defun c:jctc()
(vl-load-com)
(if (and (setq tcm (getstring "\n图层名:"))
(/= tcm "")
)
(if (= (tblsearch "layer" tcm) nil)
(command "_layer" "n" tcm "")
(progn
(setq obj (vlax-ename->vla-object (tblobjname "layer" tcm)))
(vlax-put obj "layeron" (* -1 (1+ (vlax-get obj "layeron"))))
)
)
)
(princ)
)
追问
你这个不对吧,看上去像是图层类的程序代码,刚才试用了下也没有我想要的功能啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |