[已解决]vba如何实现相对一点的角度和长度绘制线?
本帖最后由 作者 于 2008-7-16 15:44:25 编辑如下命令如何使用vba的代码实现?命令: line
指定第一点: 100,100
指定下一点或 [放弃(U)]: @150<90
<p class="Heading-1">使用PolarPoint 方法</p><p class="1-liner">获取与给定点指定角度和距离的点。</p><p class="h1-access"><a href="mk:@MSITStore:D:\acadauto(明经通道翻译的autocad%20vba帮助).chm::/polarpoint_see_also.htm">参阅</a> | <a href="mk:@MSITStore:D:\acadauto(明经通道翻译的autocad%20vba帮助).chm::/ex_polarpoint.htm">示例</a></p><p class="Heading-2">语法 </p><p class="syntax">RetVal = PolarPoint(Point, Angle, Distance) </p><p class="element">Object</p><p class="element-desc"><a href="mk:@MSITStore:D:\acadauto(明经通道翻译的autocad%20vba帮助).chm::/idh_utility_object.htm">Utility</a><br/>使用该方法的对象。 </p><p class="element">Point</p><p class="element-desc">Variant[变体] (三元素双精度数组); 仅用于输入<br/>指定起点的三维WCS坐标。 </p><p class="element">Angle</p><p class="element-desc">Double[双精度]; 仅用于输入<br/>以弧度为单位的角度值。 </p><p class="element">Distance </p><p class="element-desc">Double[双精度]; 仅用于输入<br/>以当前单位为单位的距离值。 </p><p class="element">RetVal</p><p class="element-desc">Variant[变体] (三元素双精度数组)<br/>该三维WCS的坐标是根据相对给出点的距离和角度得到的坐标。</p><pre class="Code">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</pre> 谢谢了!
页:
[1]