Dim SsetObj As AcadSelectionSet Dim SsetName As String Dim objsel As AcadEntity Dim y(1 To 3) As Double Dim y_st(1 To 3) As String Dim offline As AcadLine SsetName = "au100" On Error Resume Next For i = 0 To ThisDrawing.SelectionSets.Count - 1 Set SsetObj = ThisDrawing.SelectionSets.Item(i) If SsetObj.Name = "au100" Then SsetObj.Delete Next i Set SsetObj = ThisDrawing.SelectionSets.Add(SsetName) '让用户在屏幕上选择要加入选择集的图元 SsetObj.SelectOnScreen '遍历选择集合 i = 1 For Each objsel In SsetObj Set offline = objsel.Offset(10) offline.Layer = "0" next end sub |