I want to switch off the "Map Base" Layer using Map 3D API.
Here is the C# code snippet to switch off the "Map Base" Layer using Map 3D managed API :
using (Transaction trans = transManager.StartTransaction())
{
ObjectId managerId = DisplayManager.Create(proj).MapManagerId(proj, true);
MapManager manager = trans.GetObject(managerId, OpenMode.ForRead) as MapManager;
if (manager != null)
{
currentmapId = manager.CurrentMapId;
Map currentMap = trans.GetObject(currentmapId, OpenMode.ForWrite) as Map;
IEnumerator iterator = currentMap.NewIterator(true, true);
Type groupType = typeof(Autodesk.Gis.Map.DisplayManagement.Group);
while (iterator.MoveNext())
{
ObjectId objId = (ObjectId)iterator.Current;
Object obj = trans.GetObject(objId, OpenMode.ForWrite);
if (obj.GetType().ToString() == "Autodesk.Gis.Map.DisplayManagement.BaseElement")
{
Autodesk.Gis.Map.DisplayManagement.BaseElement baseElement = obj as Autodesk.Gis.Map.DisplayManagement.BaseElement;
baseElement.SetVisible(0, false);
}
}
}
trans.Commit();
}