好的,我发现这个lisp例程能够在现有文本的前缀或后缀处添加文本。它还在新文本和旧文本之间添加了一个空格。
(旧文本3“GW的示例-此lisp(E)3”GW中的新文本)
有没有办法删除它正在添加的空间?
- (defun c:PST (/ PreSuf Str ent Cstr)
- (vl-load-com)
- (initget "PS")
- (setq PreSuf (getkword "\nChoose [Prefix/Suffix] <Prefix>: "))
- (if (not PreSuf)
- (setq PreSuf "S")
- )
- (while (not str)
- (setq str (getstring T "\nEnter String: "))
- (cond ((and (eq str "")
- (princ "Null Input Try again")
- (setq str nil)
- )
- )
- )
- )
- (while (and (setq ent (car (nentsel "\nSelect Text/Attribute: ")))
- (member (cdr (assoc 0 (entget ent)))
- '("TEXT" "MTEXT" "ATTRIB")
- )
- )
- (setq ent (vlax-ename->vla-object ent)
- Cstr (vla-get-textstring ent)
- )
- (vla-put-textstring
- ent
- (if (eq PreSuf "S")
- (strcat Cstr " " str)
- (strcat str " " Cstr)
- )
- )
- )(princ)
- )
|