Coordinate出错
下面这段,在最后一句 Po = acc.Coordinate(0),总是出错 跳出运行错误‘424’:要求对象 ,调试了一下只要把Po = acc.Coordinate(0)这句注释掉就没有问题,确认了myset里有3个polyline,不知道为什么会出错。
Sub kk()
Dim beginpoint(2) As Double
Dim endpoint(2) As Double
Dim aac As AcadEntity
Dim Po As Variant
Dim flag As Boolean
Dim myset As AcadSelectionSet
Dim filtertype(0) As Integer
Dim filterdata(0) As Variant
beginpoint(0) = 0: beginpoint(1) = 0
endpoint(0) = 0: endpoint(1) = 100.1
flag = flase
For Each myset In ThisDrawing.SelectionSets
If myset.Name = "drawletter" Then
flag = True
Exit For
End If
Next
If flag = True Then
myset.Delete
End If
Set myset = ThisDrawing.SelectionSets.Add("drawletter")
filtertype(0) = 0
filterdata(0) = "*POLYLINE"
myset.Select acSelectionSetAll, , , filtertype, filterdata
Set aac = myset.Item(1)
Po = acc.Coordinate(0)
End Sub
Po = acc.Coordinate(0)(0)
Po = acc.Coordinates(0)
页:
[1]