|
发表于 2008-2-19 20:25:00
|
显示全部楼层
给你一段VBA代码,自己改到VB中
Public Sub FB_Area()
Dim cecho As Variant
cecho = ThisDrawing.GetVariable("cmdecho")
ThisDrawing.SetVariable "cmdecho", 0
Dim pt As Variant
pt = ThisDrawing.Utility.GetPoint(, "点击封闭区域内部...")
Dim spt As String
spt = pt(0) & "," & pt(1)
ThisDrawing.SendCommand Chr(3) & Chr(3) & "-boundary " & spt & " " & " "
ThisDrawing.SendCommand "draworder last f "
ThisDrawing.SendCommand "_.area o last "
ThisDrawing.SendCommand Chr(3) & Chr(3)
MsgBox vbCrLf & "封闭区域面积为:" & CStr(ThisDrawing.GetVariable("AREA"))
ThisDrawing.SetVariable "CMDECHO", cecho
End Sub
|
|