- 积分
- 5816
- 明经币
- 个
- 注册时间
- 2016-10-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2022-4-13 16:43:29
|
显示全部楼层
psr.Value.GetEntities<Entity>().ForEach(x => x.ForWrite(e =>
{
if (e is BlockReference brf)
{
using var tr = new DBTrans();
var btr = tr.BlockTable.GetRecord(brf.BlockTableRecord, OpenMode.ForRead);
foreach (ObjectId id in btr)
{
var e1 = tr.GetObject<Entity>(id, OpenMode.ForWrite);
if (e1 is BlockReference brf1)
{
var btr1 = tr.BlockTable.GetRecord(brf1.BlockTableRecord, OpenMode.ForRead);
foreach (ObjectId id1 in btr1)
{
var ent1 = tr.GetObject<Entity>(id1, OpenMode.ForWrite);
ent1.ColorIndex = colorI;
}
}
else
{
e1.ColorIndex = colorI;
}
}
}
if (e is Entity ent)
{
ent.ColorIndex = colorI;
}
})); |
|