提取点号生成坐标文件T1234T
本帖最后由 树櫴希德 于 2024-9-5 10:07 编辑;(jiaodujuli (getpoint) (getpoint))
;(myassoc (car(entsel)) 10) jiaodujuli
(defun jiaodujuli (pt1 pt2 / jiaodujuli )
(setq pt1 (vl-remove (last pt1)pt1))
(setq pt2 (vl-remove (last pt2)pt2))
(setq jiaodu (angle pt1 pt2))
(setq juli (distance pt1 pt2))
(list jiaodujuli )
)
(defun 10zu (e /)
(cdr(assoc 10 (entget e)))
)
(defun 1zu (e /)
(cdr(assoc 1 (entget e)))
)
(defun 0zu (e /)
(cdr(assoc 0 (entget e)))
)
(defun SstoEs(ss / a en lst)
(if ss(progn(setq a -1)
(while(setq en(ssname ss(setq a(1+ a))))
(setq lst(cons en lst)))))
lst)
(defun myassoc(e code / a b)
(setq e(entget e))
(while(setq a(assoc code e))
(setq b(cons a b)e(vl-remove a e)))
(mapcar'cdr(reverse b))
)
(defun c:tt(/ fp s m p h a)
(setq fp(getfiled "打开数据文件" "C:\\" "dat" 36)
fp(if fp(open fp"a")))
(setq s(sstoes(ssget"X"'((0 . "LWPOLYLINE")(8 . "0"))))m 0 a "")
(repeat (length s)
(setq p(myassoc(nth m s)10)m(1+ m)
p(list(/(+(caar p)(caadr p))2)(/(+(cadar p)(cadadr p))2)))
(setq h(vl-sort(sstoes(ssget"CP"(list(setq p1(polar p 3.14 3.5))(setq p2(polar p1 1.57 2))(polar p2 0 5.5)(polar p 0 2))'((0 . "TEXT")(8 . "桩号"))))
(function(lambda(e1 e2)(<(cadr(assoc 10(entget e1)))(cadr(assoc 10(entget e2)))))))
h(mapcar'(lambda(x)(cdr(assoc 1(entget x))))h)
h(if(=(length h)2)(strcat(car h)"."(cadr h))(car h)))
(setq a(strcat a(itoa m)",,"(rtos (car p)2 3)","(rtos (cadr p)2 3)","h"\n")))
(write-line a fp)
(close fp))
;; 创建直线图元
(defun NewLine:pt1-pt2 (pt1 pt2)
(entmake (list '(0 . "LINE")
(cons 10 pt1)
(cons 11 pt2)
(cons 62 3)
)
)
)
;(nentselp (getpoint))
;(1zu (car(entsel )))
;(0zu (car(entsel )))
(defun c:t1234t ( / fp s m p hhh apt1 pt2 jiaodujuli kk x);
(setq fp(getfiled "打开数据文件" "C:\\" "dat" 36)
fp(if fp(open fp"a")))
(setq pt1 (getpoint "\n 请指定圆心点:"))
(setq pt2 (getpoint "\n 请指定文字中间点:"))
(setq jiaodu (car (jiaodujuli pt1 pt2)))
(setq juli (cadr (jiaodujuli pt1 pt2)))
(setq s(sstoes(ssget'((0 . "circle")(8 . "00 路基段工艺"))))
m 0
a "")
(repeat (length s)
(setq p(10zu (nth m s)));(10zu (nth 0 s))
(setq kk (list (car (polar p jiaodu juli) ) (cadr (polar p jiaodu juli) ) ) )
(setq hhh(vl-remove nil (mapcar'(lambda (x) (if (equal (0zu x) "TEXT" )(1zu x) )) (sstoes(ssget "F" (list(list (car p) (cadr p))kk (polar p (angle kk p) juli) )) ) )));(polar p (angle kk p) juli)这句可以删除好点
;( NewLine:pt1-pt2(list (car p) (cadr p))kk)
;(setqh(1zu(car(nentselp "" kk ))) )
(setq m(1+ m) )
(setq a(strcat (car hhh) ",," (rtos (car p)2 3) "," (rtos (cadr p)2 3) "," (rtos (caddr p)2 3) ))
(write-line a fp)
(setq p nil) (setq kk nil) (setq h nil)
)
(close fp)
(princ)
)
很好→很棒!很好~很棒!!很好……很棒!!!
页:
[1]