本帖最后由 作者 于 2008-5-21 22:31:18 编辑
闲着无聊,也玩玩 ;;;|求物体中心 (defun pt1-pt2-mid (e / minpoint maxpoint) (vla-getboundingbox e 'minpoint 'maxpoint) (setq pt(mapcar '* '(0.5 0.5) (mapcar '+ (vlax-safearray->list minpoint)(vlax-safearray->list maxpoint)) )) ) ;;;|文字居中程序,SNSJ (defun c:cs (/ mid obj mid1 dob) (vl-cmdf "undo" "BE") (if(ssget '((0 . "TEXT"))) (progn (vlax-for obj(vla-get-activeselectionset(vla-get-activedocument (vlax-get-acad-object))) (if(/=(setq ob(bpoly(setq mid(pt1-pt2-mid obj))))nil) (progn (setq mid1(pt1-pt2-mid(setq dob(vlax-ename->vla-object ob)))) (vla-delete dob) (vla-move obj(vlax-3D-point mid)(vlax-3D-point mid1)) ))) )(princ "\n&&&&&&&&&&|请选择单行文本|&&&&&&&&&&&&&&") ) (vl-cmdf "undo" "E")(princ) ) |