不用遍历得到btr中同一类型的实体 CAD2009 vs2008及以上
from ObjectId id in btr
group id by id.ObjectClass.DxfName;
foreach (var ids in dict)
{
switch (ids.Key)
{
case "LINE":
foreach (var id in ids)
{
Entity ent = id.GetObject(OpenMode.ForWrite) as Entity;
ent.ColorIndex = 1;
}
break;
case "CIRCLE":
foreach (var id in ids)
{
Entity ent = id.GetObject(OpenMode.ForWrite) as Entity;
ent.ColorIndex = 3;
}
break;
}
}
tr.Commit