cgchbsz 发表于 2007-11-13 15:10:00

怎样取得一个封闭图形端点的坐标

<p>图形是多边形</p><p>要取各个顶点的坐标.</p><p>谢谢</p>

王咣生 发表于 2007-11-16 21:46:00

<p>Polyline和LWPolyline有Coordinates属性,可以参看VBA例子:</p><pre class="Code">Sub Example_Coordinates()
    ' This example creates a polyline. It then uses the Coordinates
    ' property to return all the coordinatesin the polyline. It then
    ' resets one of the vertices using the Coordinates property.
   
    Dim plineObj As AcadPolyline

    ' Create Polyline
    Dim points(5) As Double
    points(0) = 3: points(1) = 7: points(2) = 0
    points(3) = 9: points(4) = 2: points(5) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    ThisDrawing.Regen True

    ' Return all the coordinates of the polyline
    Dim retCoord As Variant
    retCoord = plineObj.Coordinates

    ' Display current coordinates for the first vertex
    MsgBox "The current coordinates of the second vertex are: " &amp; points(3) &amp; ", " &amp; points(4) &amp; ", " &amp; points(5), vbInformation, "Coordinates Example"

    ' Modify the coordinate of the second vertex to (5,5,0). Note that in
    ' case of a lightweight Polyline, indices will be different because the points are 2D only.
    points(3) = 5
    points(4) = 5
    points(5) = 0
    plineObj.Coordinates = points

    ' Update display
    ThisDrawing.Regen True

    MsgBox "The new coordinates have been set to " &amp; points(3) &amp; ", " &amp; points(4) &amp; ", " &amp; points(5), vbInformation, "Coordinates Example"
End Sub</pre>

兰州人 发表于 2007-11-16 23:17:00

以上例子是经典例子。

cgchbsz 发表于 2007-11-22 09:45:00

<p>谢谢</p><p>不过</p><p>我的问题是</p><p>对已经画好的图形(边数不定,画法不定,是闭和的)</p><p>取出各个顶点坐标</p><p>目前用的</p><p>ThisDrawing.SendCommand "-Boundary" &amp; vbCr &amp; ptcao &amp; "," &amp; a(2) &amp; vbCr &amp; vbCr</p><p>其中"ptcao"和"a(2)"是其这个闭和区域中的一个坐标</p><p>但是无法创建</p><p>比较费解</p>
页: [1]
查看完整版本: 怎样取得一个封闭图形端点的坐标