这无疑是以前做过的,但我找不到一个简单的(?)lisp将文字对象移动到拾取的x或y值(见图)。
有李Mac的动态文本对齐,但我更喜欢非动态。
还有CAB的alignall,但我有一些问题。
我得到的代码是:
- (defun c:mtx ( / ap ent obj point1 point2 ss )
- (vl-load-com)
- (setq ap (getpoint "select alignment point"))
- (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT"))))
- (setq ent (ssname ss 0))
- (setq obj (vlax-ename->vla-object ent))
- (if obj
- (progn
- ;;obj is a vla-object
- ;;point1 is the lower left point of the bounding box around the object
- ;;point2 is the upper right point of the bounding box around the object
- (vla-getboundingbox obj 'point1 'point2)
- ;;point1 and point2 are returned as a safearray and need to be converted to a list
- (setq point1 (vlax-safearray->list point1))
- (setq point2 (vlax-safearray->list point2))
- (command "_.move" ent "" point1 "_none" (list (car ap) (cadr point1) 0.0))
- );; progn
- );; if
- (princ)
- )
它在移动命令时崩溃
我只添加了ent,因为我认为MOVE命令可能无法在vla对象上工作(?)
|