删除图中的匿名组
代码:Using Trans AsTransaction = DB.TransactionManager.StartTransaction
Dim groupDict AsDBDictionary = Trans.GetObject(DB.GroupDictionaryId,OpenMode.ForWrite)
For Each Ent AsDBDictionaryEntry In groupDict
If Ent.Key.Substring(0, 1) = "*" Then
Dim grpObj As Group = Trans.GetObject(groupDict.GetAt(ent.Key),OpenMode.ForWrite)
grpObj.Erase()
End If
Next
Trans.Commit()
End Using
上面的代码可以正常运行,不过有点遗憾的是,速度比较慢,删除下面测试文件中的匿名组约需30分钟这样,如果用lisp方法删除,只要5分钟左右。各位高手能否支个招,看怎样删除能提高其速度??
测试文件
Dim grpObj As Group = Trans.GetObject(ent.Value,OpenMode.ForWrite)
谢谢,可能是因为CAD的原因吧,我在Autocad Map 3d 2011 -64 上测试一下,删除全部匿名组还是花了近25分钟。在CAD08里删除快多了。 本帖最后由 雪山飞狐_lzh 于 2012-6-22 10:56 编辑
if Ent.Key(0) = '*'then 试试
页:
[1]