求助高手指点关于标注反向修改LISP程式,有的时候可以用,有的时又不能用的问题
;====坐标标注反向====;(defun c:qr(/ en en_data name assoc10_old assoc11_old assoc13_old assoc14_old assoc42 pt10_old pt11_old pt13_old pt14_old
dimsize ptx pty pt11_new pt14_new assoc11_new assoc14_new)
(OSMODE 0) ;====捕捉控制0 16383的程式====;
(setq en(entsel"\n->选取标注对象"));====选取标注对象====;
(setq en_data(entget(car en))) ;====取得列表属性====;
(setq name(cdr(assoc 0 en_data)));====取得图元类型名称====;
(if(= name "DIMENSION")
(progn(setq assoc10_old (assoc 10 en_data))
(setq assoc11_old (assoc 11 en_data));====取得文字位置点属性列表====;
(setq assoc13_old (assoc 13 en_data));====取得标注点属性列表====;
(setq assoc14_old (assoc 14 en_data));====取得标注点属性列表====;
(setq assoc42 (assoc 42 en_data)) ;====取得标注实测属性列表====;
(setq pt10_old(cdr assoc10_old) pt11_old(cdr assoc11_old)
pt13_old(cdr assoc13_old) pt14_old(cdr assoc14_old));====取得定义点的坐标值====;
(setq dimsize(cdr assoc42))
(setq ptx (-(car pt13_old)(car pt10_old)) pty (-(cadr pt13_old)(cadr pt10_old)))
(cond((and(= dimsize ptx)(>(cadr pt14_old)(cadr pt13_old)));====条件标注为X坐标且坐标为向上标注====;
(progn(setq pt11_new (polar pt11_old (* pi 1.5)(*(-(cadr pt11_old)(cadr pt13_old))2))
pt14_new (polar pt14_old (* pi 1.5)(*(-(cadr pt14_old)(cadr pt13_old))2)))
(setq assoc11_new (cons 11 pt11_new)assoc14_new (cons 14 pt14_new))
(setq en_data(subst assoc11_new assoc11_old en_data))
(setq en_data(subst assoc14_new assoc14_old en_data))
(entmod en_data) ) )
((and(= dimsize ptx)(<(cadr pt14_old)(cadr pt13_old)));====条件标注为X坐标且坐标为向下标注====;
(progn(setq pt11_new (polar pt11_old (* pi 0.5)(*(-(cadr pt13_old)(cadr pt11_old))2))
pt14_new (polar pt14_old (* pi 0.5)(*(-(cadr pt13_old)(cadr pt14_old))2)))
(setq assoc11_new (cons 11 pt11_new)assoc14_new (cons 14 pt14_new))
(setq en_data(subst assoc11_new assoc11_old en_data))
(setq en_data(subst assoc14_new assoc14_old en_data))
(entmod en_data) ) )
((and(= dimsize pty)(>(car pt14_old)(car pt13_old)));====条件标注为Y坐标且坐标为向右标注====;
(progn(setq pt11_new (polar pt11_old pi(*(-(cadr pt11_old)(cadr pt13_old))2))
pt14_new (polar pt14_old pi(*(-(cadr pt14_old)(cadr pt13_old))2)))
(setq assoc11_new (cons 11 pt11_new)assoc14_new (cons 14 pt14_new))
(setq en_data(subst assoc11_new assoc11_old en_data))
(setq en_data(subst assoc14_new assoc14_old en_data))
(entmod en_data) ) )
((and(= dimsize pty)(<(car pt14_old)(car pt13_old)));====条件标注为Y坐标且坐标为向左标注====;
(progn(setq pt11_new (polar pt11_old 0(*(-(cadr pt13_old)(cadr pt11_old))2))
pt14_new (polar pt14_old 0(*(-(cadr pt13_old)(cadr pt14_old))2)))
(setq assoc11_new (cons 11 pt11_new)assoc14_new (cons 14 pt14_new))
(setq en_data(subst assoc11_new assoc11_old en_data))
(setq en_data(subst assoc14_new assoc14_old en_data))
(entmod en_data) ) ) )
)(alert"选择的不是标注对象"))
(OSMODE 16383)(princ)) 顶一下,遇到同样的问题!
页:
[1]