[328302216]小莫 10:49:56
;;By 龙龙仔(LUCAS),Modified by meflying
;;在TEXT和MTEXT实体的几何中心点画点
;;参数:sname - 文字对象名 (vl-load-com)
(defun TT (sname / CENTPT N)
(defun AX:GETBOUNDINGBOX (ENT / LL UR ents ents2)
(setq ents (entget ent))
(if (= (cdr (assoc 0 ents)) "MTEXT")
(progn
(setq ents2 ents)
(setq ents2 (subst (cons 41 0) (assoc 41 ents2) ents2))
(entmod ents2)
)
)
(vla-getboundingbox (vlax-ename->vla-object ENT) 'LL 'UR)
(entmod ents)
(MIDPOINT (vlax-safearray->list LL)
(vlax-safearray->list UR)
)
)
(defun MIDPOINT (PT1  T2)
(mapcar
'(lambda (X Y)
(* 0.5 (+ X Y))
)
PT1  T2
)
)
(setq CENTPT (AX:GETBOUNDINGBOX sname))
(command "_.point" centpt)
(princ)
) |