AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

4 REPLIES 4
Reply
Message 1 of 5
evigneshmca
917 Views, 4 Replies

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

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

 

4 REPLIES 4
Message 2 of 5
norman.yuan
in reply to: evigneshmca

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

Message 3 of 5
scluna
in reply to: norman.yuan

This can be done adding your xref layer to current drawing then remove it again after the export completed
SCLuna
Message 4 of 5

wow,

 

thanks for your answers.

 

Looking for it for a long time.

 

Thanks.

Message 5 of 5

And here are some links in ADN IM Devblog posts with code snippets -

 

http://adndevblog.typepad.com/infrastructure/2012/04/export-dwg-to-sdf-using-autodeskgismapimportexp...

 

http://adndevblog.typepad.com/infrastructure/2012/03/exporting-dwg-to-sdf-using-epf-file-using-map-3...

 

Thanks,

 



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost