求助坐标输出程序
我想请教各位大哥,从CAD里把坐标输到WD或电子表格的程序 说的不够详细,是什么坐标?是点位坐标还是......其实,将坐标写到Excel里去不是很难的! 最好发一幅样图! 可以发一份给我吗,liuliqun@163.com 简单! <P>编程思路: </P><P>excel和CAD连接</P>
<P>将要转出来的点用一根Pline连起来,屏幕选择它,坐标按顺序写入EXcel</P> 以前我给传过了 <PRE style="WIDTH: 100%; WHITE-SPACE: normal; WORD-WRAP: break-word"><P> </P><P>这是一个在CAD平台输出一个表格式的坐标册,同时也在d:\\lsp\\liang输出一个文本的坐标但你必须先建好d:\\lsp\\liang目录。激活是在命令行输入lxw</P><P> </P><P>(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))
(setqxy (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))</P><P> )</P><P> </P><P>这是一个在CAD平以输出一个表格式的坐标册,同时也在d:\\lsp\\liang输出一个文本的坐标。激活是在命令行输入lxw</P></PRE><!-- CoreMail Version 2.5 Copyright (c) 2002-2005 www.mailtech.cn -->
页:
[1]