Hi,
How to export a layer of a Xref dwg of a drawing file to SDF?
To export a Layer of a dwg to sdf, I am using following code.
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
...
Exporter myExporter = null;
MapApplication mapApp =HostMapApplicationServices.Application;
myExporter = mapApp.Exporter;
myExporter.Init("FDO_SDF", @"C:\Temp\Test.sdf");
myExporter.ClassMappingType = ExportClassMappingType.ByLayer;
myExporter.ClosedPolylinesAsPolygons = true;
string sSourceName = "Line";
string sSchemaName = "ADNSchema";
string sFeatureClassName = "LineFC";
ExportClassMapping mapping =ExportClassMapping.Create(sSourceName, sSchemaName, sFeatureClassName);
....
myExporter.SetGeometryTypeForClass(sSchemaName, sFeatureClassName, GeometryType.Line);
myExporter.TargetCoordinateSystem = "LL84";
....
Regards,
Vicky
I believe that the Autodesk.Gis.Map.ImportExport namespace can only be used to importing external data (from shp/sdf...) into AutoCAD Map as AutoCAD entities, and exporting AutoCAD entities to external data file (shp/sdf...).
So, you cannot use Autodesk.Gis.Map.ImportExport.Exporter to export map feature class data presented as map layer in AutoCAD Map. You can only export AutoCAD entities into shp/sdf with the Exporter class. It is the same as you run the command "MapExport"
The later version of AutoCAD Map comes with command MAPEXPORTTOSDF, MAPEXPORTFDO... (since Acad Map 2010? not sure. I use AcadMap 2012), which do not use the exporting API like command MAPEXPORT (i.e the API exposed as Autodesk.Gis.Map.ImportExport), rather they use platform APIs. Therefore, if you need to programatically exporting feature class data presented as map layers, you need to use Platform APIs/FDO APIs.
Norman Yuan
And here are some links in ADN IM Devblog posts with code snippets -
Thanks,