将多重引线文本对齐到ar
我有点头痛。我想要一个lisp,当运行时,我将能够选择整个图形,所有多重引线将自动对齐到引线和箭头所在的一侧。有时,我们的领导人会有所行动,单独改变他们是很耗时的。任何帮助都将不胜感激。 干得好。。不检查锁定层。(defun c:foo (/ pts s)
(if (setq s (ssget "_X" '((0 . "multileader"))))
(foreach ml (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex s)))
(setq pts (vlax-invoke ml 'getleaderlinevertices 0))
(cond ((equal (car pts) (cadddr pts) 1e- (print "Vertical leader.."))
((< (car pts) (cadddr pts)) (vla-put-textjustify ml 1))
((vla-put-textjustify ml 3))
)
)
)
(princ)
)
(vl-load-com) 非常感谢你。我必须学习visual lisp函数以及如何使用它们,因为这比我试图通过更改DXF代码所做的要简单得多。 起步不错,罗恩!
我刚刚决定试验一下你的代码到底是怎么回事,然后玩了这个:
(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”方法的第一个点是指引线的第一个点(距离文本内容最近的顶点),而最后一个点代表箭头点-对吗?
很乐意帮忙。DXF代码很好,但MLEADER通过vla-*函数更容易操作。
根据我的测试,第一个点最接近箭头。
短测试证实了这一点:
(and
(setq p ((lambda (L) (list (car L) (cadr L) (caddr L))) (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'GetLeaderLineVertices 0)))
(entmakex (list (cons 0 "POINT") (cons 62 1) (cons 10 p)))
)
谢谢
页:
[1]