<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Import ShapeFile into Autocad Map in AutoCAD Map 3D Developer Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/import-shapefile-into-autocad-map/m-p/9550297#M354</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am struggling to import Shp file into Autocad Map, but I do not succeed.&lt;/P&gt;&lt;P&gt;I join hereafter net code, which refers mainly to the following link :&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/autocad-map-3d-developer/shp-import-locking-shp-file/m-p/9016773#M5700" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used both Autocad Map 2017 &amp;amp; 2020. I think I am missing something.&lt;/P&gt;&lt;P&gt;Any help is welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;namespace ImportShp
{
    public class ImportShpUtils
    {
        [CommandMethod ("ISHP")]
        public void ImportLayer()
        {
            ImportShpForm layerForm = new ImportShpForm();
            layerForm.Show();
        }
        public void ImportShpProcess(FileInfo shpfileInfo)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            MapApplication mapApp = HostMapApplicationServices.Application;
            using (Importer importer = mapApp.Importer)
            {
                importer.Init("SHP", shpfileInfo.FullName);

                string fileName = Path.GetFileNameWithoutExtension(shpfileInfo.FullName).Replace(" ", "");
                foreach (InputLayer inLayer in importer)
                {
                    inLayer.SetLayerName(LayerNameType.LayerNameDirect, fileName);
                    inLayer.SetDataMapping(ImportDataMapping.NewObjectDataOnly, fileName);
                    inLayer.Dispose();
                }
                importer.ImportPolygonsAsClosedPolylines = true;
                ImportResults result = importer.Import(true);
                sw.Stop();
                importer.Dispose();
            }
            shpfileInfo.Delete();
        }
    }
}&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 30 May 2020 12:36:09 GMT</pubDate>
    <dc:creator>ennine</dc:creator>
    <dc:date>2020-05-30T12:36:09Z</dc:date>
    <item>
      <title>Import ShapeFile into Autocad Map</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/import-shapefile-into-autocad-map/m-p/9550297#M354</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am struggling to import Shp file into Autocad Map, but I do not succeed.&lt;/P&gt;&lt;P&gt;I join hereafter net code, which refers mainly to the following link :&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/autocad-map-3d-developer/shp-import-locking-shp-file/m-p/9016773#M5700" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used both Autocad Map 2017 &amp;amp; 2020. I think I am missing something.&lt;/P&gt;&lt;P&gt;Any help is welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;namespace ImportShp
{
    public class ImportShpUtils
    {
        [CommandMethod ("ISHP")]
        public void ImportLayer()
        {
            ImportShpForm layerForm = new ImportShpForm();
            layerForm.Show();
        }
        public void ImportShpProcess(FileInfo shpfileInfo)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            MapApplication mapApp = HostMapApplicationServices.Application;
            using (Importer importer = mapApp.Importer)
            {
                importer.Init("SHP", shpfileInfo.FullName);

                string fileName = Path.GetFileNameWithoutExtension(shpfileInfo.FullName).Replace(" ", "");
                foreach (InputLayer inLayer in importer)
                {
                    inLayer.SetLayerName(LayerNameType.LayerNameDirect, fileName);
                    inLayer.SetDataMapping(ImportDataMapping.NewObjectDataOnly, fileName);
                    inLayer.Dispose();
                }
                importer.ImportPolygonsAsClosedPolylines = true;
                ImportResults result = importer.Import(true);
                sw.Stop();
                importer.Dispose();
            }
            shpfileInfo.Delete();
        }
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 30 May 2020 12:36:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/import-shapefile-into-autocad-map/m-p/9550297#M354</guid>
      <dc:creator>ennine</dc:creator>
      <dc:date>2020-05-30T12:36:09Z</dc:date>
    </item>
  </channel>
</rss>

