- UID
- 58512
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-6-15
- 最后登录
- 1970-1-1
|
发表于 2003-6-16 12:28:18
|
显示全部楼层
translatecoordinates的用法
translatecoordinates将点从一个坐标系统转换为另外一个坐标系统
语法
RetVal = object.TranslateCoordinates(OriginalPoint, From, To, Disp[, OCSNormal])
Object:使用该方法的对象。
OriginalPoint:Variant[变体] (三元素双精度数组); 仅用于输入
From:AcCoordinateSystem 常数; 仅用于输入(acWorld acUCS acOCS acDisplayDCS acPaperSpaceDCS )
To:AcCoordinateSystem 常数; 仅用于输入(acWorld acUCS acOCS acDisplayDCS acPaperSpaceDCS )
Disp:Integer[整数]; 仅用于输入
FALSE: OriginalPoint is treated as a point.
OCSNormal:Variant[变体] (三元素双精度数组); 仅用于输入;可选项
RetVal:Variant[变体] (三元素双精度数组)
Sub Example_TranslateCoordinates()
' This example creates a UCS with an origin at 2, 2, 2.
' Next, a point is entered by the user. The WCS and UCS
' coordinates of that point are output in a Msgbox.
' Create a UCS named "New_UCS" in current drawing
Dim ucsObj As AcadUCS
Dim origin(0 To 2) As Double
Dim xAxisPnt(0 To 2) As Double
Dim yAxisPnt(0 To 2) As Double
' Define the UCS
origin(0) = 2#: origin(1) = 2#: origin(2) = 2#
xAxisPnt(0) = 5#: xAxisPnt(1) = 2#: xAxisPnt(2) = 2#
yAxisPnt(0) = 2#: yAxisPnt(1) = 6#: yAxisPnt(2) = 2#
' Add the UCS to the UserCoordinatesSystems collection
Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPnt, yAxisPnt, "New_UCS")
ThisDrawing.ActiveUCS = ucsObj
' Get the active viewport and make sure the UCS icon is on
Dim viewportObj As AcadViewport
Set viewportObj = ThisDrawing.ActiveViewport
viewportObj.UCSIconOn = True
viewportObj.UCSIconAtOrigin = True
ThisDrawing.ActiveViewport = viewportObj
' Have the user enter a point
Dim pointWCS As Variant
pointWCS = ThisDrawing.Utility.GetPoint(, "Enter a point to translate:")
' Translate the point into UCS coordinates
Dim pointUCS As Variant
pointUCS = ThisDrawing.Utility.TranslateCoordinates(pointWCS, acWorld, acUCS, False)
' Display the coordinates of the point
MsgBox "The point has the following coordinates:" & vbCrLf & _
"WCS: " & pointWCS(0) & ", " & pointWCS(1) & ", " & pointWCS(2) & vbCrLf & _
"UCS: " & pointUCS(0) & ", " & pointUCS(1) & ", " & pointUCS(2), , "TranslateCoordinates Example"
End Sub |
|