这是一个在CAD平台输出一个表格式的坐标册,同时也在d:\\lsp\\liang输出一个文本的坐标但你必须先建好d:\\lsp\\liang目录。激活是在命令行输入lxw (defun c:lxw ()
(command "_OSNAP" "non")
(setq f( open "d:\\lsp\\liang\\liang.txt" "a"))
(setq ss(ssget'((100 . "AcDbPolyline"))))
(setq pu(getpoint"\n坐标册放在:"))
(setq xu(car pu))
(setq x4(- xu 12))
(setq yu(cadr pu))
(setq x4yu(list x4 yu))
(setq pt(list xu yu))
(command "text" x4yu 4 0 "点号 X坐标 Y坐标")
(setq ss1(ssname ss 0))
(setq ent(entget ss1))
(setq i 0) (setq j 0)
(setq ken 10) (setq aa nil bb nil)
(repeat(length ent)
(setq yy (nth i ent))
(if (eq (car yy ) ken )
(progn
(setq j(+ 1 j))
(setq xy (cdr yy))
(setq x(car xy))
(setq y(cadr xy))
(setq jj(rtos j))
(setq jj(strcat "j" jj ))
(setq jj(substr jj 1 (- (strlen jj ) 5 )))
(setq nn(strcat jj " " (rtos x) " " (rtos y)))
(write-line nn f)
(command "text" xy 3 0 jj)
(setq xx(car pt))
(setq yy( - (cadr pt) 10))
(setq pt(list xx yy ))
(love xy pt jj )
)
)
(setq i(1+ i))
)
(write-line "********************************" f)
(close f)
)
(defun love( k pe r )
(setq x(car k))
(setq y(cadr k))
(setq f( open "d:\\lsp\\liang\\liang.txt" "a"))
(setq x1(car pe))
(setq y1(cadr pe))
(setq x1(+ 30 x1))
(setq pe1(list x1 y1))
(setq xj( - (car pe) 10))
(setq pe2(list xj y1))
(setq xb(- xj 5))
(setq yb(+ y1 6))
(setq xb1(+ xb 74))
(setq ptb(list xb yb))
(setq ptb1(list xb1 yb))
(setq xb2(+ xb 13))
(setq ptb2(list xb2 yb))
(setq xb3(+ xb 44))
(setq ptb3(list xb3 yb))
(command "LINE" ptb ptb1 "")
(if aa
(progn
(command "LINE" aa ptb "")
(command "LINE" bb ptb1 "")
(command "LINE" cc ptb2 "")
(command "LINE" dd ptb3 "")
))
(setq aa ptb bb ptb1 cc ptb2 dd ptb3)
(command "text" pe2 3 0 r)
(command "text" pe 3 0 (rtos x))
(command "text" pe1 3 0 (rtos y)) ) 这是一个在CAD平以输出一个表格式的坐标册,同时也在d:\\lsp\\liang输出一个文本的坐标。激活是在命令行输入lxw
|