数字按x、y方向分层,lsp编程申请:将文字旋转角度d(45≤d<135)的文字放到新建的颜色为5的图层“角度一”中,
其余角度的文字放到新建的颜色为6的图层“角度二”中。-
- (defun c:tt()
- (setq ss (ssget (list (cons 0 "TEXT"))))
- (setq sslist (wjm_ss2lst ss))
- (foreach en sslist
- (setq ang (dxf 50 en))
- (if (> ang pi) (setq ang (- ang pi)))
- (if (and (> ang (* pi 0.25))(< ang (* pi 0.75)))
- (entmod (ch-en (cons 8 "y") en))
- (entmod (ch-en (cons 8 "x") en))
- )
- )
- )
- (defun wjm_ss2lst (ss / i e lst)
- (if (= (type ss) \'PICKSET)
- (progn
- (setq i -1)
- (while (setq e (ssname ss (setq i (1+ i))))
- (if (= (type e) \'ENAME) (setq lst (cons e lst)) nil)
- )
- lst
- )
- nil
- )
- )
这是无所不及的部分源码,还差函数变量没有定义,请求高手完善。
|