The MapLayer.Remove method removes the specified map or imagery layer referenced by its map index number. Use the MapLayer.Names method to get a dictionary of map layers and their mapLayerId values.
Declaration
public bool Esri.ArcGISForAutoCAD.MapLayer.Remove(Document doc, int mapLayerId)
Parameters
| Type | Name | Description | Required |
|---|---|---|---|
Document | doc | The AutoCAD document to act on. | required |
int | mapLayerId | The index integer number associated with the layer that can be obtained using MapLayer.Names. | required |
Returns
| Type | Description |
|---|---|
bool | true if the map layer was removed successfully |
Remarks on error conditions
This method may throw an exception or return false or null if a parameter is invalid.
Example
Print the success of removing the map reference in the drawing for the index number 1 map layer.// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
// Remove the map layer
var success = Esri.ArcGISForAutoCAD.MapLayer.Remove(doc, 1);
// Print the success
doc.Editor.WriteMessage(success.ToString());
/* Example output
True
*/
See also
MapLayer.Names—A .NET method that returns an indexed dictionary of map and imagery layer names included in the current drawing.
esri_maplayer_remove—An AutoLISP function that removes the specified map or imagery layer referenced by its map index number.