I searched the Map3d customization forum and couldn't find anything on this. Hoping someone here can lend a hand. I have c# code which creates AutoCAD DBPoints and attaches ObjectData to them. There are other objects in the dwg, but I'm only interested in the Points. I now want to export a SHP file of those points with OD so they can be imported into a GIS database by others.
Looking through the Autodesk.Gis.Map.ImportExport namespace, I'm just not seeing what needs to be done to accomplish this task. Any suggestions, pointers, links to blogs, etc. would be welcomed.
Solved! Go to Solution.
Solved by tyronebk. Go to Solution.
Solved by norman.yuan. Go to Solution.
Jeff,
Yes, you looked into the correct place: Autodesk.Gis.Map.ImportExport namespace. All the APIs in this namespace do exactly the same as Acad Map's MapImport/Export commands. Manually run the Acad Map built-in command certainly helps to understand more on the APIs.
You can also download AutoCAD MAP ObjectARX SDK (not to be confused with AutoCAD ObjectARX SDK), which comes with .NET API sample code, including a sample project of Map importing/exporting.
I know you probably will do it in .NET code. But if LISP solution is suitable, you can do it with a few lines of lisp code: Do the manual importing/exporting command; but instead of "OK" the dialog, you can save the manually built importing/exporting configuration as profile and use LISP (command...) to drive the profile). Also, the import/export profile is actual XML file. Browsing its content also helps to using import/export API.
Another more complicated method would be to use AutoCAD Map GIS platform API (FDO) to convert the point as FDO feature point and save them to shape (FDO source). You probably only want to look into this if the drawing has/needs FDO data connection.
I wrote a command to export structures and pipes to SHP a while ago (the ExportToSDF command does not properly handle curved pipes, it draws them as straight lines end to end). I think this blog pointed me in the right direction. I'm happy to share some of my code if you run into any road blocks.
Thanks to @norman.yuan and @tyronebk for pointing me in the right direction. I now have my code working almost exactly how it needs to. The only snag I've hit is in the exported ObjectData names. When I export manually in Map3D the exported column names are exactly as shown in the Mappings dialog. I can successfully create the Mappings in code, verify they are exactly what I need as I step through in Debug mode, yet when I Export() the shp file the Column names are all truncated to 10 characters. I did a search in the Map3d customization forum and found nothing related to this, and the Developer docs for Map don't mention there being a limitation on the length of the names.
Has anyone else seen this? Is there a setting I missed to allow longer names?
I believe the 10 character limit is defined in the SHP standard. If you export objects and properties using MAPEXPORT, and the field header is longer than 10 characters, it is also truncated. It also happens if you bulk copy from an SDF to SHP.
Example:
How are you exporting in Map 3D and retaining the header length?
For anyone else following along and curious about the 10 character limit, I found this:
I need to do the same thing with AutoCAD and ObjectARXSDK not AutoCAD Map, is there any library that can help me coding that ??
shapelib.dll
You'll need to download the source code and recompile for 64-bit.
There is also this that is more maintained, but I haven't had a chance to use the code.
Can't find what you're looking for? Ask the community or share your knowledge.