Tuesday, January 20, 2009

SDO_GEOMETRY - FROM and TO Autodesk Map3d

Author: Jonio, Dennis


This Visual Studio 2005 solution contains everything you need to PUT/GET 2d curve SDO_GEOMETRY from/to Autodesk Map3d. It is of course a named-pipe solution. I have tested this particular one briefly on both Map3d 2008 and Map3d 2009. No warranties about anything. I have not included my SDO_GEOMETRY Validation class and anything having to do with SDO_DIM_ARRAY. This is posted elsewhere.
What you will need: Visual Studio 2005, Map3d 2008/2009, ODP.NET 11g.
The last and most significant new code included here is the DwgReader and the DwgWriter classes. They are nothing more than convenience containers for the geometry conversion methods contained with these same named classes.
As I have learned the idiosyncrasies and subtleties of doing conversions from one geometry system to the other are immense. For example: Circles ... what about circles? Just pursue this one issue yourself and you should become somewhat befuddled at what approach to take.
I am aware that the conversion routine for inner and outer rings of polygons is somewhat flawed in that it does not handle ring direction properly in all cases. This has not been a big concern for me since every piece of production geometry I create gets passed through a "validator" and in the case of ring orientation SDO_MIGRATE.TO_CURRENT works fine for fix up. This was another of those lessons learned. You should always check the geometry you are going to convert. If you were not aware already, you can easily create polygon geometry in Map3d that nothing but Map3d will understand. It is what it is.

The NETLOADable dll is ADSKDATABRIDGE.dll and the commandline command is: DOPUTGET.

Startup “ClientBasicIO.exe” and your off and running.

I have included the file “AGEOM1.sds” with the project. This is a serialized .NET dataset with a few geometries. You can load it within clientbasicio.exe.

Enough … code speaks for itself …


You can download the solution here: http://tf-net.googlecode.com/files/aPub.zip