本帖最后由 作者 于 2008-7-10 10:17:35 编辑
- (defun c:test( / SSET INDEX ENT ACADDOC ANG LEFTDOWNPOINT OFFSETLEFTDOWNPOINT USEROS)
-
- ;加载vlisp函数
- (vl-load-com)
-
- ;选择处理对象
- (if (setq sset (ssget '((0 . "TEXT"))))
-
- (progn
- (setq
- ;保存捕捉
- useros (getvar "OSMODE")
- ;索引序号
- index 0
- )
- ;关闭捕捉
- (setvar "OSMODE" useros)
- ;通过循环遍历选集
- (repeat (sslength sset)
- (setq
- ;文字
- ent (ssname sset index)
- ;转成VLA对象
- obj (vlax-ename->vla-object ent)
- ;NEXT
- index (1+ index)
- )
- ;文字对象外框
- (vla-getboundingbox obj 'leftdownpoint 'rightuppoint)\
- ;设置颠倒:否
- (vla-put-upsidedown obj :vlax-false)
- ;设置反向:否
- (vla-put-backward obj :vlax-false)
- ;文字角度
- (setq ang (vla-get-rotation obj))
- ;调整角度
- (if (and (> ang (* pi 0.5)) (<= ang (* pi 1.5)))
- (vla-put-rotation obj (+ ang pi))
- )
- ;修改后的文字外框
- (vla-getboundingbox obj 'offsetleftdownpoint 'offsetrightuppoint)
- ;文字归位
- (vla-move obj offsetleftdownpoint leftdownpoint)
- )
- ;恢复捕捉
- (setvar "OSMODE" useros)
- )
- )
- ;静默退出
- (princ)
-
- )
|