'删除图层上所有对象 Function DelAllInLayer(ByVal LName As String) 'On Error Resume Next Dim SSet As AcadSelectionSet Set SSet = CreateSelectionSet("XXX") Dim Ft(0) As Integer, Fd(0) Ft(0) = 8: Fd(0) = LName SSet.Select acSelectionSetAll, , , Ft, Fd Dim E As AcadEntity 'MsgBox SSet.Count For Each E In SSet E.Delete Next End Function Function CreateSelectionSet(Optional SSetName As String = "mjtd") As AcadSelectionSet On Error Resume Next ThisDrawing.SelectionSets(SSetName).Delete Set CreateSelectionSet = ThisDrawing.SelectionSets.Add(SSetName) End Function 大侠看看,测试通过了 Ft(0) = 8 是何意? |