[求助]怎么提取多段线的顶点坐标值?
<p>请问各位大侠,能否把当前选择的多段线的顶点坐标值提取出来,并保存在记事本里</p><p></p> 本帖最后由 作者 于 2008-4-20 19:47:49 编辑 <br /><br /> <pre class="Code">Sub Example_Coordinate()<br/> ' This example creates a polyline in model space and<br/> ' queries and changes the coordinate in the first index position.<br/> <br/> Dim plineObj As AcadPolyline<br/> Dim points(0 To 14) As Double<br/> <br/> ' Define the 2D polyline points<br/> points(0) = 1: points(1) = 1: points(2) = 0<br/> points(3) = 1: points(4) = 2: points(5) = 0<br/> points(6) = 2: points(7) = 2: points(8) = 0<br/> points(9) = 3: points(10) = 2: points(11) = 0<br/> points(12) = 4: points(13) = 4: points(14) = 0<br/> <br/> ' Create a lightweight Polyline object in model space<br/> Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)<br/> ZoomAll<br/> <br/> ' Find the coordinate in the first index position<br/> Dim coord As Variant<br/> coord = plineObj.Coordinate(0)<br/> MsgBox "The coordinate in the first index position of the polyline is: " & coord(0) & ", " _<br/> & coord(1) & ", " & coord(2)<br/> <br/> ' Change the coordinate<br/> coord(0) = coord(0) + 1<br/> plineObj.Coordinate(0) = coord<br/> plineObj.Update<br/> <br/> ' Query the new coordinate<br/> coord = plineObj.Coordinate(0)<br/> MsgBox "The coordinate in the first index position of the polyline is now: " & coord(0) & ", " _<br/> & coord(1) & ", " & coord(2)'<font color="#f73809">这里就是你要的点坐标<br/></font> <br/>End Sub</pre><pre class="Code"><p class="body"></p><p class="body">Open "c:\点坐标.txt" For Output As #1</p><p class="body">Print #1, "你好"</p><p class="body">Print #1, "hello"</p><p class="body">Close #1输出"你好"到txt第一行输出"hello"到txt第二行</p></pre> 太感谢了!!
页:
[1]