.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extract SDF 2 in autocad.net API

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
scluna
1928 Views, 16 Replies

Extract SDF 2 in autocad.net API

Hi,

 

Is there anyone here who knows how to extract sdf version 2 using autocad api of 2013?

I tried to use sdfld32i.exe but is only useful for extracting sdf version 2 for previous version of autocad (e.g. autocad 2004).

 

Thanks and regrads.

SCLuna
16 REPLIES 16
Message 2 of 17
norman.yuan
in reply to: scluna

It looks like your question is about AutoCAD Map ObjectARX .NET API. You might want to try forum groups for AutoCAD Map 3D->AutoCAD Map 3D Developer for better AutoCAD Map specific responses.

 

Anyway, you may want to look at AutoCAD Map ObjectRAX .NET API's Autodesk.Gis.Map.ImportExport namespace for a solution. That is, you could try to write code import the data from the SDF file of older version and then export the data imported to SDF file, which is created by AutoCAD Map 2013, thus must be in a newer (if not newest) version of SDF file, I figured. The key point is to determine if AutoCAD Map 2013 can import data from very old version of SDF file.

 

If you have downloaded AutoCAD Map ObjectARX SDK, then you can find sample code on Autodesk.Gis.ImportExport namespace.

 

The other approach might be to try to connect AutoCAD Map to SDF as map layer (manaully or use AutoCAD Map Gis platform API) to see if the old version of SDF can be connected or not.

 

To be honest, I only touched SDF file with AutoCAD Map very occassionally (since AutoCAD Map 2009) and have never worked with SDF of that old version. So, my suggestion may not work, but you can give it a try.

Norman Yuan

Drive CAD With Code

EESignature

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

Hi Norman,

Thanks I'll try that and code the method in c++ then import the dll to my project.
Is there no way equivalent code in vb.net?

Thanks and regards
SCLuna
Message 4 of 17
norman.yuan
in reply to: scluna

Did you noticed that I mentioned AutoCAD Map ObjectARX .NET API? You can VB.NET or C#, of course. Also, for Map's GIS platform API, it is .NET only API.

Norman Yuan

Drive CAD With Code

EESignature

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

yeah. I found the folder thanks again
SCLuna
Message 6 of 17
scluna
in reply to: norman.yuan

Hi Norman,

The example also extract sdf version 3 using the same method
Dim myExporter As Exporter = Nothing
SCLuna
Message 7 of 17
scluna
in reply to: norman.yuan

Yes its posible to import and export sdf2 in map3d 2013. I use the _MAPSDFIN to import and _MAP2SDF to export. the problem is that i'm not sure if autocad has available libraries for these command which can be utilize by .net.
SCLuna
Message 8 of 17
norman.yuan
in reply to: scluna

In previous reply I have pointed out that AutoCAD Map has Map .NET API (i.e. only available in AutoCAD Map, not vanilla AutoCAD) that has ImportExport namespace, which include classes that does operation like manual Map lmport/export (i.e. command MapImport/MapExport/Map2SDF...).

 

However, since you are talking SDF v2, while AutoCAD Map .NET API was only available since AutoCAD Map 2006, I am not sure the .NET API would work or not. But you can try at least.

 

The Map platform API (available since AutoCAD Map 2009/10) can connect AutoCAD Map to SDF via FDO, but not SDF v2. It must be upgrade to V3 or later ASAIK.

 

I could have a try if you attach a sample SDF v2 file here.

Norman Yuan

Drive CAD With Code

EESignature

Message 9 of 17
scluna
in reply to: norman.yuan

The sdf version 2 should look like this

SCLuna
Message 10 of 17
scluna
in reply to: scluna

Please use this sdf version 2 with sif file

SCLuna
Message 11 of 17
scluna
in reply to: norman.yuan

Hi Norman,

Yes Map platform API can connect Autocad Map to SDF via FDO but I'm not trying to upgrade the sdf to version 3. I need to extract the sdf v2 from autocad map3d 2013 to be use/uploaded in mapguide 6.5.

Thanks and regards
SCLuna
Message 12 of 17
norman.yuan
in reply to: scluna

It looks like that AutoCAD Map's managed API (bother ObjectARX .NET API and Platform API) is not able to handle SDF v2 file. It has to be converted to V3 or later first.

 

If you have to do it programmatically, you have to managed to import the SDF v2 file into AutoCAD Map. Once the data gets into AutoCAD Map, then you can easily export it as later version of SDF file.

 

One way I could think of is:

 

1. Manually start MAPSDFIN to bring up "SDF Import" dialog box and fill the importing information.

2. Click "Save..." to save an importing profile.

3. Use SendStringToExecute() to execute command "-MAPSDFIN" with proper arguments, which specify which SDF file to inport, the importing profile to use, to get the SDF v2 file imported.

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 13 of 17
scluna
in reply to: norman.yuan

Hi Norman,

Sorry but SendStringToExecute is not the solution I have in mind. using the said method only calls the built-in wizard of autocad _map2sdf which is a manual way of creating sdf2 layer which is very tedious because i will need to select each layer then give each layer a name then decide if i will append it in one file or not. It is also prone to errors since i could have more than 1 autocad operator to generate the file. I need an api that could help standadize the procedure.
SCLuna
Message 14 of 17
Partha.Sarkar
in reply to: scluna

Hi scluna,

 

Map 3D doesn't have any public API to export Map objects to old SDF2.0 format.

You need to use either MAP2SDF command in AutoCAD Map 3D or you can use SDF Loader.

 

SDFLoader is included in SDFTookKit, and it can be downloaded from http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=4307350&linkID=9240658

 

BTW - I see you are using 2013 release. So I would suggest to check something here :

 

Open your DWG file in Map 3D 2013 and use the UI tool / command MAP2SDF to export in SDF2.0 and then check if all the objects / properties are exported correctly. Which application do you want to use them? Is it MG6.5 or older ?

 

If you are satisfied with UI export result, you can try using the SDFToolkit and see if you are able to get the same result. One thing you need to understand here. SDFTookKit is very old technology and not updated in last 6/7 years where as Map 3D has changed quite a lot enabling FDO and native data from various data sources. I never tried this backward compatibility checking, but there could be some issues.

 

Thanks,

Partha



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Message 15 of 17
scluna
in reply to: Partha.Sarkar

Hi Partha,

 

Yes. I am trying to extract sdf version from autocad 2013 to be used for mapguide 6.5. I did use the map2sdf command and successfully created the type of sdf version i need. I already tried your suggestion regarding the use of SDFToolkit but to no success, I am getting compatibility error. Seems like there is no other workaround only the manual process then.

 

Thanks and regards

SCLuna
Message 16 of 17
scluna
in reply to: Partha.Sarkar

Hi Partha

SCLuna
Message 17 of 17
scluna
in reply to: Partha.Sarkar

Hi Partha,

 

I did further testing in autocad 2013 and resolved the problem. using sdfld32i.exe only works for drawing created in autocad 2000/lt 2000 so the best way to get around the problem is by saving the autocad 2013 drawing to autocad 2000 format.

 

Thanks and regards,

Sherwin

SCLuna

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost