Loading a *.layer file using API

By Partha Sarkar

In AutoCAD Map 3D you can use the 'Load Layer…' UI tool to load a *.layer file and create data layer with specific FDO data source.

Img1

If you have many such *.layer files and you want them to load programmatically, you can use Autodesk.Gis.Map.Platform.AcMapMap  LoadLayer(string layerFile) API for the same. 

Here is a C# code snippet :

    try

    {

        // Get the Map Object

        AcMapMap currentMap = AcMapMap.GetCurrentMap();

        currentMap.LoadLayer(@"C:\Data_set\Layer_Files\Parcels.layer");               

    }

 

    catch (MgException ex)

    {

        ed.WriteMessage(ex.Message.ToString());

    }


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading