根据kaixinmao的思路,结合BDYCAD 的程序,编了一个,能解决独立的文字实体旋转后保持角度不变,但对块中的文字需用其他办法。- (defun zd (jidian zdian jiaodu / dx mbzd) ;求文字旋转后的基点
- (command "line" jidian zdian "")
- (setq dx (entlast))
- (command "_rotate" dx "" jidian jiaodu)
- (setq end (entget dx))
- (setq mbzd (cdr (assoc '11 end)))
- (command "_erase" dx "")
- (setq mbzd mbzd)
- ) ;求文字旋转后的基点
- (defun c:test (/ ss pt rang textss n sslen wt text lentextss jd mbd)
- (setq ss (ssget))
- (setq pt (getpoint "\n选择基点:"))
- (setq rang (getreal "\n输入旋转角度:"))
- (setq textss (ssadd)) ;构造文字文字集合以及非文字实体集合
- (setq n 0)
- (if ss
- (progn
- (setq sslen (sslength ss))
- (while (< n sslen)
- (setq wt (ssname ss n))
- (setq text (cdr (assoc 0 (entget wt))))
- (if (or (= text "TEXT")
- (= text "MTEXT")
- )
- (progn
- (ssadd wt textss)
- (ssdel wt ss)
- (setq sslen (- sslen 1))
- )
- (setq n (1+ n))
- )
- ) ;构造文字文字集合以及非文字实体集合
- (command "rotate" ss "" pt rang) ;旋转非文字实体
- (setq n 0);旋转文字实体
- (setq lentextss (sslength textss))
- (while (< n lentextss)
- (setq wt (ssname textss n))
- (setq jd (cdr (assoc 10 (entget wt))))
- (setq mbd (zd pt jd rang))
- (command "move" wt "" jd mbd)
- (setq n (1+ n))
- );旋转文字实体
- )
- )
- )
|