明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1546|回复: 3

[求助]求源代码

[复制链接]
发表于 2010-5-9 15:47:00 | 显示全部楼层 |阅读模式

   

        求VBA环境下编辑的要求查询坐标,方位角,距离和面积的源代码

发表于 2010-5-10 12:22:00 | 显示全部楼层

Point= ThisDrawing.Utility.GetPoint(, vbCrLf & "选择点")
ThisDrawing.Utility.Prompt "X坐标= " & Point(1) & "   Y坐标= " & Point(0) & "   H高程 =" & Point(2) & Chr(13) & vbCrLf

Point1 = ThisDrawing.Utility.GetPoint(, vbCrLf & "选择第一点")
Point2= ThisDrawing.Utility.GetPoint(Point1, "选择第二点")
D = Sqr(Point2(1)-Point1(1)* Point2(1)-Point1(1) +Point2(0)-Point1(0) * Point2(0)-Point1(0))

FWJ=Fwjjs(Point1,Point2)

Public Function Fwjjs(PointA As Variant, PointB As Variant)  '方位角
    Dim dx As Double
    Dim dy As Double
    Dim TR As Double
    dx = PointB(1) - PointA(1)
    dy = PointB(0) - PointA(0)
    If dx = 0 Then
        TR = Sgn(dy) * PI / 2
    Else
        TR = Atn(dy / dx)
        If dx < 0 Then TR = TR + PI
    End If
    If dx >= 0 And dy < 0 Then TR = TR + 2 * PI
    Fwjjs = TR
End Function

Dim objDest As AcadEntity
Dim ptBase As Variant
ThisDrawing.Utility.GetEntity objDest, ptBase, " 选择对象>>"
S = objDest.area

 楼主| 发表于 2010-5-12 11:12:00 | 显示全部楼层
谢谢啊
 楼主| 发表于 2010-5-14 21:04:00 | 显示全部楼层

    好像只有求坐标的没出问题,其他的都有问题呀。。

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 22:59 , Processed in 0.173949 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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