Hello sir
what I want to do is to check if an entity is in a layer which is set to off, I want to leave it as it is, otherwise, I want to set its layer to lets say "0".
the first thing I did was get the layer table record, and:
string hiddenlayers;
if(layer.isoff)
{
trans.getobject(layertabID , openmode.forwrite);
hiddenlayers +=layer.name + ","
}
blocktalbe bt = tr.getobject(db.BlockTable, openmode.forread) as BlockTable;
foreach (objectID btid in bt)
{
BlockTableRecord btr = tr.GetObject(btid, openmode.forread) as BlockTableRecord;
foreach( ObjectID id in btr)
{
entity ent= tr.GetObject(id, openmode.forwrite) as entity;
if(hiddenlayers.contains(entity.layer + ",") continue;
entity.layer="0";
entity.color=256;
}
}
but when i run the program, even entities in layers which are set to off, are set to layer "0" and are visible.
I cant figure out how to fix it.