- namespace CsCad.IsoObjects
- {
- public static class IsoObject
- {
- public static void Hide(ICollection<ObjectId> ids)
- {
- foreach (ObjectId id in ids)
- {
- Entity entity = (Entity)id.GetObject(OpenMode.ForWrite, false, true);
- entity.Visible = false;
- }
- }
- public static void Isolate(BlockTableRecord btr, ICollection<ObjectId> isoids)
- {
- var ids = btr.Cast<ObjectId>().ToHashSet().Except(isoids);
- foreach (ObjectId id in ids)
- {
- Entity entity = (Entity)id.GetObject(OpenMode.ForWrite,false,true);
- entity.Visible = false;
- }
- }
- public static void UnIsolate(BlockTableRecord btr)
- {
- var ids = btr.Cast<ObjectId>().ToHashSet();
- foreach (ObjectId id in ids)
- {
- Entity entity = (Entity)id.GetObject(OpenMode.ForWrite, false, true);
- if (entity.Visible == false)
- {
- entity.Visible = true;
- }
- }
- }
- [CommandMethod("QE", CommandFlags.UsePickSet)]
- public static void Isolate()
- {
- using var tr = new DbTrans();
- var btr = tr.OpenCurrspace();
- var res = SSGet();
- if (!res.Ok) return;
- var ids = res.ObjectIds;
- Isolate(btr, ids);
- }
- [CommandMethod("QW", CommandFlags.UsePickSet)]
- public static void Hide()
- {
- using var tr = new DbTrans();
- var res = SSGet();
- if (!res.Ok) return;
- var ids = res.ObjectIds;
- Hide(ids);
- }
- [CommandMethod("QR", CommandFlags.UsePickSet)]
- public static void UnHide()
- {
- using var tr = new DbTrans();
- var btr = tr.OpenCurrspace();
- UnIsolate(btr);
- }
- }
- }
|