起步不错,罗恩!
我刚刚决定试验一下你的代码到底是怎么回事,然后玩了这个:
- (defun C:test ( / SS i )
- (and
- (setq SS (ssget "_:L" '((0 . "MULTILEADER"))))
- (repeat (setq i (sslength SS))
- (foo (ssname SS (setq i (1- i))))
- )
- )
- (princ)
- )
- (setq foo
- (lambda ( e / e o L pts )
-
- (defun GroupByN ( n L / r )
- (repeat n (and L (setq r (cons (car L) r))) (setq L (cdr L)) r)
- (if L (cons (reverse r) (GroupByN n L)) (list (reverse r)))
- ); defun GroupByN
-
- (cond
- (
- (and
- ; (setq e (car (entsel "\nPick mleader: ")))
- (setq o (vlax-ename->vla-object e))
- (setq L (GroupByN 3 (vlax-invoke o 'GetLeaderLineVertices 0)))
- (setq pts (list (car L)(last L)))
- )
- (vl-some
- (function
- (lambda ( x / xf yf al )
- (mapcar 'set '(xf yf al) x)
- (and
- (apply xf (append (mapcar 'car pts) (if (eq eq xf) (list 1e-1))))
- (apply yf (append (mapcar 'cadr pts) (if (eq eq yf) (list 1e-1))))
- (progn
- (vla-put-TextJustify o (eval al))
- ; (alert (vl-symbol-name al))
- T
- )
- )
- ); lambda
- ); function
- '(
- (eq > acAttachmentPointBottomCenter) ; OK
- (eq < acAttachmentPointTopCenter) ; OK
- (< eq acAttachmentPointMiddleLeft) ; NOT
- (> eq acAttachmentPointMiddleRight) ; NOT
- (< < acAttachmentPointBottomLeft) ; OK
- (> < acAttachmentPointBottomRight) ; OK
- (< > acAttachmentPointTopLeft) ; OK
- (> > acAttachmentPointTopRight) ; OK
- ); list
- ); vl-some
- )
- ); cond
- (princ)
- ); lambda
- ); setq foo
我假设“GetLeaderLineVertices”方法的第一个点是指引线的第一个点(距离文本内容最近的顶点),而最后一个点代表箭头点-对吗? |