EaBIM

标题: [数据库操作] 图层清理 [打印本页]

作者: 萧闫子    时间: 2014-1-8 14:06
标题: [数据库操作] 图层清理
  1. public string[] PurgeLayers()
  2. {
  3. List<string> Lays = new List<string>();
  4. using (Transaction Trans = DB.TransactionManager.StartTransaction)
  5. {  
  6. LayerTable LayTab = Trans.GetObject(DB.LayerTableId, OpenMode.ForWrite);  
  7. DB.Clayer = LayTab("0");  
  8. ObjectIdCollection IDs = new ObjectIdCollection();  
  9. foreach (ObjectId ID in LayTab)
  10. {   
  11. IDs.Add(ID);  
  12. }  
  13. DB.Purge(IDs);  
  14. LayerTableRecord LayTabRec = null;  
  15. foreach (ObjectId ID in IDs)
  16. {   
  17. LayTabRec = Trans.GetObject(ID, OpenMode.ForWrite);   
  18. Lays.Add(LayTabRec.Name.ToUpper);   
  19. LayTabRec.Erase(true);  
  20. }  
  21. Trans.Commit();
  22. }
  23. return Lays.ToArray();
  24. }
复制代码





欢迎光临 EaBIM (https://eabim.net/) Powered by Discuz! X3.2