[LISP]求助提取坐标并自动生成表格的高难程序!!!!
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">编程的高手们:由于本人工作的需要,常常要对图形中的<FONT face="Times New Roman">pline</FONT>线坐标进行提取,并一个一个地粘贴到电子表格当中,工作起来相当麻烦。所以急切地恳请编程高手们帮我编写一个能够自动提取<FONT face="Times New Roman">pline</FONT>线坐标,并在<FONT face="Times New Roman">cad</FONT>中自动生成表格。(表格样式见最后)</P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">要求:</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">1.<SPAN style="FONT: 7pt 'Times New Roman'"> </FONT></SPAN></SPAN>提取图形中<FONT face="Times New Roman">pline</FONT>线的<FONT face="Times New Roman">y</FONT>坐标放在表格中纵坐标<FONT face="Times New Roman">(X)</FONT>列<FONT face="Times New Roman">,</FONT>该列间距至少可以放开<FONT face="Times New Roman">10</FONT>位数字<FONT face="Times New Roman">,</FONT>其中整数<FONT face="Times New Roman">7</FONT>位<FONT face="Times New Roman">,</FONT>小数保留<FONT face="Times New Roman">3</FONT>位<FONT face="Times New Roman">; </FONT>提取图形中<FONT face="Times New Roman">pline</FONT>线的<FONT face="Times New Roman">x</FONT>坐标放在表格中横坐标<FONT face="Times New Roman">(Y)</FONT>列<FONT face="Times New Roman">, </FONT>该列间距至少可以放开<FONT face="Times New Roman">9</FONT>位数字<FONT face="Times New Roman">, </FONT>其中整数<FONT face="Times New Roman">6</FONT>位<FONT face="Times New Roman">,</FONT>小数保留<FONT face="Times New Roman">3</FONT>位<FONT face="Times New Roman">;</FONT>相邻坐标点的间距则放在表格中的距离列<FONT face="Times New Roman">,</FONT>小数要保留<FONT face="Times New Roman">2</FONT>位<FONT face="Times New Roman">.</FONT>其中<FONT face="Times New Roman">,</FONT>所选择的<FONT face="Times New Roman">pline</FONT>线的第一个坐标点和第二个坐标点的距离应从距离列的第三行开始<FONT face="Times New Roman">,</FONT>依次写入<FONT face="Times New Roman">.(</FONT>样式见最后表格一<FONT face="Times New Roman">)</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">2.<SPAN style="FONT: 7pt 'Times New Roman'"> </FONT></SPAN></SPAN>每份表格只能写入<FONT face="Times New Roman">27</FONT>个点的坐标。如果<FONT face="Times New Roman">pline</FONT>线坐标点多余<FONT face="Times New Roman">27</FONT>个,则再次生成表格并顺序地写入。此时两点间地距离应从边距列地第二行开始了,第一行是字样“距离”,第二行写入的距离是该表第一个点与上一个表的最后一个点的距离。(样式见最后表格二)</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">恳请诸位编程的高手们慷慨解囊相助,小弟不胜感激。</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">谢谢大家了!!!</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">谢谢!!!!!!</P> <P>表格样式:</P> <P>表格调整就不做了</P>
<P>(defun c:Getpt( / ss i ents f filename str)<BR> (defun getnum(i)<BR> (if (< 10)<BR> (setq val (strcat "J0" (rtos i)))<BR> (setq val (strcat "J" (rtos i)))<BR> )<BR> val)<BR> <BR> (setq ss (ssget '((0 . "LWPOLYLINE"))))<BR> (setq filename (getfiled "打开存放数据的Excel电子表格文档" "e:\\wjh\\study\\autolisp\\zhongguola\\" "XLS" 1))<BR> (setq f (open filename "w"))<BR> (setq i 0)<BR> (repeat (sslength ss)<BR> (setq ents (entget (ssname ss i)))<BR> (setq ents (mapcar 'cdr (vl-remove-if-not '(lambda(e) (= (car e) 10)) ents)))<BR> (setq i (1+ i))<BR> )<BR> (princ)<BR> (setq i 0)<BR> (repeat (length ents)<BR> (setq item (nth i ents))<BR> (if (> i 0)<BR> (setq str (strcat (getnum i)"\t"(rtos (distance item (nth (1- i) ents)) 2 2) "\t"(rtos (cadr item) 2 3)"\t"(rtos (car item) 2 3)"\t""水泥"))<BR> (setq str (strcat (getnum i)"\t""\t"(rtos (cadr item) 2 3) "\t"(rtos (car item) 2 3)))<BR> )<BR> (if (= (rem i 27) 0)<BR> (write-line (strcat "\n点号""\t""距离""\t""纵坐标(X)""\t""横坐标(Y)""\t""界桩材料""\t""备注") f)<BR> )<BR> ;(princ "\n")<BR> (write-line str f)<BR> (setq i (1+ i))<BR> )<BR> (close f)<BR> (princ)<BR>)</P> <P>谢谢您,<A name=71260><FONT color=#990000><B>meflying</B></FONT></A>!!!谢谢您对我人支持与帮助。</P>
<P>真不好意思,我还得麻烦您和众多编程的高手们帮我调整一下表格吧。</P>
<P>因为工作的需要,上报表格的格式必须统一</P>
<P>所以还要麻烦您和大家了!!!!</P>
<P>谢谢了!!!!!!</P> <P>急切地恳请诸位帮个忙吧!</P>
<P>真的很急!!!!!</P> <P>还有哪位好心人肯帮助我呀?</P>
<P>呜~呜~呜</P> <P>求助大家了,帮个忙吧!!!!谢谢了!!!!!!</P> 类似,再改改,命令:jdbz(交点标注)。 <P>谢谢了!!!</P>
<P>我需要的是要把坐标放到二楼的表格样式当中!!!</P>
<P>谢您了!!!!</P> 请问有高人会吗?