1. This is normal. Thawing a layer requires a regen. The layer command does
a regen (although an optimized one that only affects the objects on the
layers that are being thawed)
2.The following works fine for me:
LayerStateManager lsm =
Application.DocumentManager.MdiActiveDocument.Database.LayerStateManager;
//restore the On/Off state and Color
lsm.RestoreLayerState("test",ObjectId.Null,0,LayerStateMasks.On |
LayerStateMasks.Color);
wrote in message news:4856968@discussion.autodesk.com...
question 1:
I want turn on ,unlock,unfrozen all layer,the following is my code,but
question is when run the code , the entity are all despeared, i have to
regen the drawing and the entity could visible.
Database curdb;
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm;
Transaction myT
curdb = Application.DocumentManager.MdiActiveDocument.Database;
tm = curdb.TransactionManager;
using (myT = tm.StartTransaction())
{
LayerTable lt = (LayerTable)tm.GetObject(curdb.LayerTableId,
OpenMode.ForRead);
foreach (ObjectId objId in lt)
{
LayerTableRecord ltr =
(LayerTableRecord)tm.GetObject(objId, OpenMode.ForWrite);
if (ltr.IsLocked) { ltr.IsLocked = false; }
if (ltr.IsFrozen) { ltr.IsFrozen = false; }
if (ltr.IsOff) { ltr.IsOff = false; }
}
myT.Commit();
}
question 2:
I can save layerstate,but I can't restore it, I wonder my problem is i don't
know the use of parmeter: undefinedlayerstatepolicy. could anyone show me
some code of how to use RestoreLayerState method in c#