Xóa một thực thể

Cách xóa một thực thể

Vấn đề: Cách xóa một thực thể (CADNET-3).

Mẹo: Để xóa một thực thể, hãy chọn thực thể cần thiết và sử dụng phương thức RemoveEntityAt trong bản vẽ.

Ví dụ:

for (int i = 0; i < cadImage.Entities.Length; i++)
{
CadBaseEntity baseEntity = cadImage.Entities[i];
if (baseEntity.GetType() == typeof(CadArc))
{
CadArc arc = (CadArc)baseEntity;
if (arc.CenterPoint.X > 1e10)
{
cadImage.RemoveEntityAt(i);
// OR cadImage.RemoveEntity(baseEntity);
i--;
}
}
}
cadImage.UpdateSize();