ztfree 发表于 2008-7-16 10:12:00

[已解决]vba如何实现相对一点的角度和长度绘制线?

如下命令如何使用vba的代码实现?复制代码

wylong 发表于 2008-7-16 11:48:00

使用PolarPoint 方法
获取与给定点指定角度和距离的点。
|
语法
RetVal = PolarPoint(Point, Angle, Distance)
Object
使用该方法的对象。
Point
Variant[变体] (三元素双精度数组); 仅用于输入
指定起点的三维WCS坐标。
Angle
Double[双精度]; 仅用于输入
以弧度为单位的角度值。
Distance
Double[双精度]; 仅用于输入
以当前单位为单位的距离值。
RetVal
Variant[变体] (三元素双精度数组)
该三维WCS的坐标是根据相对给出点的距离和角度得到的坐标。
Sub Example_PolarPoint()
    ' This example finds the coordinate of a point that is a given
    ' distance and angle from a base point.
   
    Dim polarPnt As Variant
    Dim basePnt(0 To 2) As Double
    Dim angle As Double
    Dim distance As Double
   
    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
    angle = 0.1744444   ' 45 degrees
    distance = 5
    polarPnt = ThisDrawing.Utility.PolarPoint(basePnt, angle, distance)
   
    ' Create a line from the base point to the polar point
    Dim lineObj As AcadLine
    Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, polarPnt)
    ZoomAll
   
End Sub

ztfree 发表于 2008-7-16 15:43:00

谢谢了!
页: [1]
查看完整版本: [已解决]vba如何实现相对一点的角度和长度绘制线?