找了半天也没找出来,有人指教一下不?- ;;By 龙龙仔(LUCAS),Modified by meflying
- ;;在TEXT和MTEXT实体的几何中心点画点
- ;;参数:sname - 文字对象名
- (vl-load-com)
- (defun c: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 PT2)
- (mapcar
- '(lambda (X Y)
- (* 0.5 (+ X Y))
- )
- PT1 PT2
- )
- )
- (setq CENTPT (AX:GETBOUNDINGBOX sname))
- (command "_.point" centpt) ; 生成点
- ;(entmakex (list '(0 . "CIRCLE") (cons 10 centpt) (cons 40 1) )) ; 生成圆
- (princ)
- )
|