bluefires 发表于 2006-6-23 23:28:00

关于块的坐标的问题

<P>在一张图上,有若干块,如何获得这些块中心点所在的坐标?不能用鼠标选取的方式,只能直接用程序得到某个块的坐标??</P>

wyj7485 发表于 2006-6-24 08:22:00

用鼠标只能获得块插入点,属性点的坐标,要获得中心点的坐标只能用程序处理了,除非把插入点定为中心点就不用了

68651521 发表于 2006-6-24 08:37:00

GetBoundingBox

bluefires 发表于 2006-6-24 17:37:00

<P>那如何获得块大致在什么地方呢?大致坐标就可以了</P>

bluefires 发表于 2006-6-25 15:49:00

我想能不能在块中设置一个点,然后在外面通过程序获得这个点的坐标,那大致也是这个块的坐标了,可我怎么搞坐标都是0,0,大家帮我想想怎么处理这个问题。有没有其他什么好办法。

68651521 发表于 2006-6-26 01:14:00

<PRE class=Code>Sub Example_GetBoundingBox()
    ' This example creates a line in model space. It then finds the
    ' bounding box for the line and displays the corners of the box.
   
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    Dim lineObj As AcadLine

    ' Create the Line object in model space
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll
   
    Dim minExt As Variant
    Dim maxExt As Variant
   
    ' Return the bounding box for the line and return the minimum
    ' and maximum extents of the box in the minExt and maxExt variables.
    lineObj.GetBoundingBox minExt, maxExt
   
    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the line are:" &amp; vbCrLf _
         &amp; "Min Extent: " &amp; minExt(0) &amp; "," &amp; minExt(1) &amp; "," &amp; minExt(2) _
         &amp; vbCrLf &amp; "Max Extent: " &amp; maxExt(0) &amp; "," &amp; maxExt(1) &amp; "," &amp; maxExt(2), vbInformation, "GetBoundingBox Example"
         
End Sub</PRE>

bluefires 发表于 2006-6-26 21:22:00

<P>我用insertpoint方法搞定了,谢谢了</P>
页: [1]
查看完整版本: 关于块的坐标的问题