[求助]完善数字按x、y方向分层源码
数字按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
)
)
这是无所不及的部分源码,还差函数变量没有定义,请求高手完善。
怎么没人支持哦? 是哈,求完善 是哈,求完善 本帖最后由 gzcsun 于 2024-6-14 21:32 编辑
(defun c:tt()
(setq ss (ssget (list (cons 0 "TEXT"))))
(setq sslist (wjm_ss2lst ss))
(foreach en sslist
(setq en (entget en) ang (cdr(assoc 50 en)))
(if (> ang pi) (setq ang (- ang pi)))
(if (> (* pi 0.75) ang (* pi 0.25))
(entmod (subst (cons 8 "y")(assoc 8 en) en))
(entmod (subst (cons 8 "x")(assoc 8 en) en))
)
)
)
(defun wjm_ss2lst (ss / i e lst)
(setq i -1)
(while (setq e (ssname ss (setq i (1+ i))))
(setq lst (cons e lst)))
lst
)
页:
[1]