'标注面域面积*******************************************************
'
Sub DimArea()
'On Error Resume Next
Dim A As Double
Dim xHeight As Integer
Dim Temp As AcadEntity
Dim Pmin As Variant
Dim Pmax As Variant
Dim Pc As Variant
Dim T As AcadText
n:
'先选择一个标注对象
ThisDrawing.Utility.GetEntity Temp, Pmin, "请选择一个标注对像"
Prompt Temp.ObjectName
If Temp.ObjectName = "AcDbRegion" Then
A = Temp.Area
A = A / 10 ^ 6
A = Format(A, "0.0000")
'MsgBox A
Temp.GetBoundingBox Pmin, Pmax
Pc = centerPoint(Pmin, Pmax)
'ThisDrawing.ModelSpace.AddPoint Pmin
'ThisDrawing.ModelSpace.AddPoint pamx
xHeight = P2PDistance(Pmin, Pmax) / 5
If xHeight > 2000 Then xHeight = 2000
Set T = ThisDrawing.ModelSpace.AddText(A, Point3D(0, 0, 0), xHeight)
T.Alignment = acAlignmentCenter
T.Move T.TextAlignmentPoint, Pc
Else
GoTo n:
End If
End Sub
'***************************************************************************
'
Sub DimArea()
'On Error Resume Next
Dim A As Double
Dim xHeight As Integer
Dim Temp As AcadEntity
Dim Pmin As Variant
Dim Pmax As Variant
Dim Pc As Variant
Dim T As AcadText
n:
'先选择一个标注对象
ThisDrawing.Utility.GetEntity Temp, Pmin, "请选择一个标注对像"
Prompt Temp.ObjectName
If Temp.ObjectName = "AcDbRegion" Then
A = Temp.Area
A = A / 10 ^ 6
A = Format(A, "0.0000")
'MsgBox A
Temp.GetBoundingBox Pmin, Pmax
Pc = centerPoint(Pmin, Pmax)
'ThisDrawing.ModelSpace.AddPoint Pmin
'ThisDrawing.ModelSpace.AddPoint pamx
xHeight = P2PDistance(Pmin, Pmax) / 5
If xHeight > 2000 Then xHeight = 2000
Set T = ThisDrawing.ModelSpace.AddText(A, Point3D(0, 0, 0), xHeight)
T.Alignment = acAlignmentCenter
T.Move T.TextAlignmentPoint, Pc
Else
GoTo n:
End If
End Sub
'***************************************************************************
阅读全文……