本帖最后由 作者 于 2006-7-19 9:25:03 编辑
Private Sub CommandButton1_Click() On Error Resume Next Dim txtObJ As AcadText Dim txtInsPos(0 To 2) As Double Dim Sum As Double Dim txtHeight As Double Dim SsetObj As AcadSelectionSet Dim Entry As AcadEntity Set SsetObj = ThisDrawing.SelectionSets("Sset1") If Err Then Set SsetObj = ThisDrawing.SelectionSets.Add("Sset1") SsetObj.Clear Me.Hide SsetObj.SelectOnScreen Sum = 0 txtHeight = 0 For Each Entry In SsetObj If TypeName(Entry) Like "IAcad*Text*" Then Sum = Sum + Entry.TextString Next Entry txtInsPos(0) = 0 txtInsPos(1) = 0 txtInsPos(2) = 0 txtHeight = 10 Set txtObJ = ThisDrawing.ModelSpace.AddText(Str(Sum), txtInsPos, txtHeight) SsetObj.Clear MsgBox "计算结果显示在在(0,0,0)处" End Sub
|