How are Export a reference layer of a DWG to SDF ?

How are Export a reference layer of a DWG to SDF ?

Anonymous
Not applicable
1,055 Views
4 Replies
Message 1 of 5

How are Export a reference layer of a DWG to SDF ?

Anonymous
Not applicable

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

 

0 Likes
1,056 Views
4 Replies
Replies (4)
Message 2 of 5

norman.yuan
Mentor
Mentor

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

Drive CAD With Code

EESignature

0 Likes
Message 3 of 5

Anonymous
Not applicable
This can be done adding your xref layer to current drawing then remove it again after the export completed
0 Likes
Message 4 of 5

Anonymous
Not applicable

wow,

 

thanks for your answers.

 

Looking for it for a long time.

 

Thanks.

0 Likes
Message 5 of 5

Anonymous
Not applicable
0 Likes