我通过SelectAtPoint选择对象,可为什么选不到块.
Sub test() Dim sset1 As AcadSelectionSet Dim sset2 As AcadSelectionSet Dim i As Integer Dim lineObj As AcadLine Dim point As Variant Dim sPoint As Variant Dim ePoint As Variant
For i = 0 To ThisDrawing.SelectionSets.Count - 1 If ThisDrawing.SelectionSets(i).Name = "SS1" Or ThisDrawing.SelectionSets(i).Name = "SS2" Then ThisDrawing.SelectionSets(i).Delete End If Next i point = ThisDrawing.Utility.GetPoint(, "请选择") Set sset1 = ThisDrawing.SelectionSets.Add("SS1") sset1.SelectAtPoint point
Dim entry As AcadEntity For Each entry In sset1 If entry.ObjectName = "AcDbLine" Then Set lineObj = entry sPoint = lineObj.StartPoint ePoint = lineObj.EndPoint End If Next entry
Set sset2 = ThisDrawing.SelectionSets.Add("SS2") sset2.SelectAtPoint sPoint For Each entry In sset2 MsgBox entry.ObjectName Next entry End Sub
我是想选择通过一点的线,然后通过线的起点选择通过起点的块,可是确选不到块,谁能告诉我为什么?
调试图和程序都在附件里.