Hi,
By my side, using A2011 Vanilla, A2012 MEP or A2013 Vanilla, the ISOLATEOBJECTS and/or HIDEOBJECTS create a AEC_ISOLATED_OBJECTS dictionary containing a AEC_ISOLATED_OBJECTS_XRECORD xrecord.
If they're some hidden objects the xrecord contains these objects ObjectId (a (70, -1) TypedValue otherwise).
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using AcAp = Autodesk.AutoCAD.ApplicationServices.Application;
namespace IsolatedObjectDictionary
{
public class Commands
{
[CommandMethod("Test")]
public void Test()
{
Document doc = AcAp.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
ObjectIdCollection hidden = GetHiddenObjects(db);
if (hidden.Count == 0)
{
ed.WriteMessage("\nNone hidden object found");
}
else
{
foreach (ObjectId id in hidden)
{
ed.WriteMessage("\nHidden entity: {0}", id.ObjectClass.Name);
}
}
}
public ObjectIdCollection GetHiddenObjects(Database db)
{
ObjectIdCollection result
= new ObjectIdCollection
(); using (Transaction tr = db.TransactionManager.StartTransaction())
{
DBDictionary NOD = (DBDictionary)tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead);
if (!NOD.Contains("AEC_ISOLATED_OBJECTS"))
{
return result;
}
DBDictionary dict = (DBDictionary)tr.GetObject((ObjectId)NOD["AEC_ISOLATED_OBJECTS"], OpenMode.ForRead);
Xrecord xrec = (Xrecord)tr.GetObject((ObjectId)dict["AEC_ISOLATED_OBJECTS_XRECORD"], OpenMode.ForRead);
foreach (TypedValue tv in xrec.Data)
{
if (tv.TypeCode == 340)
{
result.Add((ObjectId)tv.Value);
}
}
return result;
}
}
}
}