Sub SetBlockEmpty(ByRef Doc As AutoCAD.AcadDocument, ByVal strBlockName As String) Dim objBlock As AutoCAD.AcadBlock Dim n As Integer Dim i As Integer
Set objBlock = Doc.Blocks(strBlockName)
If Err Then Err.Clear Exit Sub End If
n = objBlock.Count
'问题在这里,循环运行了若干次以后提示"无效的过程或调用参数"后终止. Regen后块引用中实体有所减少但未清空 For i = 0 To n - 1 objBlock.Item(i).Delete Next '-----------
Set objBlock = Nothing End Sub
看来是遍历有问题,请问现在想把块定义中的所有实体清空应该如何修改?谢谢.