ghost_lang 发表于 2010-5-9 15:47:00

[求助]求源代码

<p>&nbsp;&nbsp;&nbsp; </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size="5"><strong>求VBA环境下编辑的<font size="6">要求查询坐标,方位角,距离和面积的源代码</font></strong></font></p>

pmq 发表于 2010-5-10 12:22:00

<p>Point= ThisDrawing.Utility.GetPoint(, vbCrLf &amp; "选择点")<br/>ThisDrawing.Utility.Prompt "X坐标= " &amp; Point(1) &amp; "&nbsp;&nbsp; Y坐标= " &amp; Point(0) &amp; "&nbsp;&nbsp; H高程 =" &amp; Point(2) &amp; Chr(13) &amp; vbCrLf</p><p>Point1 = ThisDrawing.Utility.GetPoint(, vbCrLf &amp; "选择第一点")<br/>Point2= ThisDrawing.Utility.GetPoint(Point1, "选择第二点")<br/>D = Sqr(Point2(1)-Point1(1)* Point2(1)-Point1(1) +Point2(0)-Point1(0) * Point2(0)-Point1(0))</p><p>FWJ=Fwjjs(Point1,Point2)</p><p>Public Function Fwjjs(PointA As Variant, PointB As Variant)&nbsp; '方位角<br/>&nbsp;&nbsp;&nbsp; Dim dx As Double<br/>&nbsp;&nbsp;&nbsp; Dim dy As Double<br/>&nbsp;&nbsp;&nbsp; Dim TR As Double<br/>&nbsp;&nbsp;&nbsp; dx = PointB(1) - PointA(1)<br/>&nbsp;&nbsp;&nbsp; dy = PointB(0) - PointA(0)<br/>&nbsp;&nbsp;&nbsp; If dx = 0 Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TR = Sgn(dy) * PI / 2<br/>&nbsp;&nbsp;&nbsp; Else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TR = Atn(dy / dx)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If dx &lt; 0 Then TR = TR + PI<br/>&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; If dx &gt;= 0 And dy &lt; 0 Then TR = TR + 2 * PI<br/>&nbsp;&nbsp;&nbsp; Fwjjs = TR<br/>End Function</p><p>Dim objDest As AcadEntity<br/>Dim ptBase As Variant<br/>ThisDrawing.Utility.GetEntity objDest, ptBase, " 选择对象&gt;&gt;"<br/>S = objDest.area<br/></p><p></p>

ghost_lang 发表于 2010-5-12 11:12:00

谢谢啊

ghost_lang 发表于 2010-5-14 21:04:00

<p>&nbsp;&nbsp;&nbsp; 好像只有求坐标的没出问题,其他的都有问题呀。。</p>
页: [1]
查看完整版本: [求助]求源代码