282765582
发表于 2008-6-27 11:48:00
怎么把图上n个点的坐标读取并输出到Txt或者excel?
<p>请教各位大虾</p><p>怎么把图上n个点的坐标读取并输出到Txt或者excel?</p>
www2002
发表于 2008-7-2 12:42:00
偶也想知道
yxp
发表于 2008-7-3 13:48:00
<p>这些点的坐标有什么特征?</p><p>是坐标值,还是一些直线或者点?</p>
yeqb4749659
发表于 2008-7-8 10:26:00
用getpoint循环读出点坐标
rark123
发表于 2008-7-8 20:57:00
<p>(defun c:dd (/ ss m n file file_obj VERTEX) ;将POLYLINE的点写入文件writefile<br/> (setvar "cmdecho" 0)<br/> (if (and (setq ss (ssget '((0 . "polyline"))))<br/> (setq file (getfiled "写polyline的点表" "" "txt" 1))<br/> )<br/> (progn<br/> (command "undo" "g")<br/> (setq file_obj (open file "w")<br/> m (sslength ss)<br/> n 0<br/> )<br/> (repeat m<br/> (setq VERTEX (entnext (ssname ss n))<br/> n (1+ n)<br/> )<br/> (while (/= (cdr (assoc 0 (entget VERTEX))) "SEQEND")<br/> (setq point (assoc 10 (entget VERTEX))<br/> VERTEX (entnext VERTEX)<br/> )<br/> (write-line (strcat (rtos (nth 1 point) 2 2) "," (rtos (nth 2 point) 2 2)) file_obj)<br/> )<br/> )<br/> (close file_obj)<br/> (command "undo" "e")<br/> (prin1)<br/> )<br/> )<br/>)</p><p></p><p>其他对象类似 </p>
ty0030801
发表于 2008-8-11 23:36:00
<p>我有这程序</p><p>代码如下:</p><p>Sub xyz()<br/>Dim x As Double<br/>Dim y As Double<br/>Dim i<br/>Set fs = CreateObject("Scripting.FileSystemObject")<br/> Set a = fs.CreateTextFile("d:\查询结果.txt", True)<br/> i = 1<br/>On Error Resume Next<br/>Dim keywordlist As String<br/>keywordlist = "o"<br/>nextreturnpnt:<br/>ThisDrawing.Utility.InitializeUserInput 128, keywordlist<br/>Dim returnpnt As Variant<br/>returnpnt = ThisDrawing.Utility.GetPoint(, "输入一个点[完成/(o)]:")<br/>If Err Then<br/>If StrComp(Err.Description, "用户输入的是关键字", 1) = 0 Then<br/>Dim inputstring As String<br/>Err.Clear<br/>inputstring = ThisDrawing.Utility.GetInput<br/>a.Close<br/>Exit Sub<br/>Else<br/>MsgBox "选择点时发生错误:" & Err.Description<br/>Err.Clear<br/>End If<br/>Else<br/>x = Format(Round(returnpnt(1), 4), "0.000")<br/>y = Format(Round(returnpnt(0), 4), "0.000")<br/>a.WriteLine (i & ",," & x & "," & y)<br/>i = i + 1<br/>End If<br/>GoTo nextreturnpnt<br/>End Sub<br/>在cad中运行上程序,结果保存在d:\查询结果.txt文件中,格式为:点号,X坐标,Y坐标</p>
www2002
发表于 2008-8-27 09:27:00
支持一下!!
guigang1974
发表于 2008-9-8 22:11:00
6楼的。。说清楚那代码咋用啊。。。。。先谢过。。。
jingqin0472
发表于 2009-9-10 12:39:00
<p>这个功能不难!想要联系我,VBA代码。252950152</p>
lxn1991
发表于 2009-10-8 18:19:00
加载lisp程序即可,