明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1095|回复: 1

如何获得块参照的坐标

[复制链接]
发表于 2008-5-27 08:23:00 | 显示全部楼层 |阅读模式
如何获得块参照的坐标?请兄弟指教
发表于 2008-6-2 11:09:00 | 显示全部楼层
<pre class="Code">Sub Example_Origin()
    ' This example creates a UCS and returns its origin.

    Dim viewportObj As AcadViewport
   
    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport
   
    ' Create a new UCS with origin 2, 2, 0
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPoint(0 To 2) As Double
    Dim yAxisPoint(0 To 2) As Double
   
    origin(0) = 2: origin(1) = 2: origin(2) = 0
    xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
    yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0
   
    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
    ThisDrawing.ActiveUCS = ucsObj
    viewportObj.UCSIconOn = True
    viewportObj.UCSIconAtOrigin = True
    ThisDrawing.ActiveViewport = viewportObj
   
    ' Display the current origin for the new UCS
    MsgBox "The origin of the UCS is: " &amp; ucsObj.origin(0) &amp; ", " &amp; ucsObj.origin(1) &amp; ", " &amp; ucsObj.origin(2), , "Origin 示例"

    ' Change the origin of the UCS
    origin(0) = 4: origin(1) = 4: origin(2) = 0
    ucsObj.origin = origin
   
    ' Reset the active UCS and viewport to see the change
    ThisDrawing.ActiveUCS = ucsObj
    ThisDrawing.ActiveViewport = viewportObj
   
    MsgBox "The origin of the UCS is now: " &amp; ucsObj.origin(0) &amp; ", " &amp; ucsObj.origin(1) &amp; ", " &amp; ucsObj.origin(2), , "Origin 示例"
   
End Sub</pre>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 09:55 , Processed in 0.161139 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表