rico2005 发表于 2009-3-1 14:22:00

[求助]求助关于方框的坐标的获取问题

请问使用什么函数可以实现在双击方框的时候获取方框的坐标,我想使用坐标遍历方框内的对象,进行某种输出操作,谢谢。

rico2005 发表于 2009-3-1 14:25:00

补充一下,是任意画出来的方框,方框的大小和位置都是不确定的,望不吝赐教~~

fjfhgdwfn 发表于 2009-3-1 19:00:00

<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 second 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><p class="body">&nbsp; </p>
页: [1]
查看完整版本: [求助]求助关于方框的坐标的获取问题