问题就出在第三步,请专家在我的程序基础上补充获取直线端点坐标的程序。补充出来我就能做下来的了。
Dim linn%, cirn%, arcn%, recn%
Private Sub CommandButton1_Click()
Dim sset As AcadSelectionSet '定义选择集对象
Set sset = ThisDrawing.SelectionSets.Add("ss1") '新建一个选择集
Me.hide
sset.SelectOnScreen '提示用户选择
Call Enttest(sset)
MsgBox "直线有" & linn
MsgBox "圆有" & cirn
MsgBox "圆弧有" & arcn
MsgBox "多段线有" & recn
sset.Delete '删除选择集
End Sub
Sub Enttest(x As AcadSelectionSet) '功能:统计选择集中各种对象的数量
Dim ent As AcadEntity
linn = 0: arcn = 0: cirn = 0: recn = 0 '为直线、圆弧、圆、多段线的数量变量
For Each ent In x
If TypeOf ent Is AcadLine Then
linn = linn + 1
'请在这补充获取直线端点坐标的程序
ElseIf TypeOf ent Is AcadCircle Then
cirn = cirn + 1
ElseIf TypeOf ent Is AcadArc Then
arcn = arcn + 1
ElseIf TypeOf ent Is AcadLWPolyline Then
recn = recn + 1
End If
Next ent