例如,以下是实现目标的两种方法:
使用AutoLISP:(可以在此处找到参考)。
- (defun c:Text2Right_1 (/ i ss ent eLst)
- (if (setq i -1 ss (ssget "_:L" '((0 . "TEXT"))))
- (while (setq ent (ssname ss (setq i (1+ i))))
- (setq eLst (entget ent)
- eLst (subst (cons 11 (cdr (assoc 10 eLst)))
- (assoc 11 eLst) eLst))
- (entmod (subst (cons 72 2) (assoc 72 eLst) eLst))))
- (princ))
使用Visual LISP:
- (defun c:Text2Right_2 (/ ss)
- (vl-load-com)
- (if (ssget "_:L" '((0 . "TEXT")))
- (progn
- (vlax-for obj (setq ss (vla-get-ActiveSelectionSet
- (vla-get-ActiveDocument
- (vlax-get-acad-object))))
- (setq tmp (vla-get-InsertionPoint obj))
- (vla-put-Alignment obj acAlignmentRight)
- (vla-put-TextAlignmentPoint obj tmp))
- (vla-delete ss)))
- (princ))
下面是另一个示例,演示了实现相同结果的各种方法。
http://www.cadtutor.net/forum/showpost.php?p=296877&postcount=4
希望这有帮助,
李 |