Skip To Content

CoordinateSystem.DatumTransformations (.NET)

The CoordinateSystem.DatumTransformations method returns all the datum transformation definitions in the drawing as a collection of dictionaries.

The combination of the from coordinate system and tocoordinate system included in each datum transformation definition is unique and acts as key values that distinguish one datum transformation definition from another in the drawing. Each datum transformation definition includes a collection of steps for performing the transformation. Each step has a direction that indicates the order the coordinate system transformation step is applied to.

Declaration

public IEnumerable<Dictionary<string, object>> Esri.ArcGISForAutoCAD.CoordinateSystem.DatumTransformations(Document doc)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

Returns

TypeDescription

IEnumerable<Dictionary<string, object>>

A collection of datum transformation definitions as dictionaries. Each datum transformation definition dictionary has the following keys: From, To, and Steps. The From and To keys have string values representing the coordinate systems. The value of the Steps key is a collection of dictionaries of coordinate system transformation steps. Each transformation step dictionary has the Step and Direction keys. The Step key has a value of the step as a string, and the Direction key indicates the order the transformation step will be applied, either "Forward" or "Reverse".

Remarks on error conditions

This method may throw an exception or return null if a parameter is invalid or there are no datum transformations in the drawing.

Example

Print the datum transformation definitions in the current drawing.

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;

// Get the datum transformations
var datumTransformations = Esri.ArcGISForAutoCAD.CoordinateSystem.DatumTransformations(doc);

// Print the datum transformation definitions
foreach (var dT in datumTransformations)
{
  doc.Editor.WriteMessage("\nFrom {0}: To {1}", dT["From"], dT["To"]);
  doc.Editor.WriteMessage("\nSteps: ");
  doc.Editor.WriteMessage("\n");
  foreach (var dict in dT["Steps"] as List<Dictionary<string, object>>)
  {
    foreach (var kvp in dict)
    {
      doc.Editor.WriteMessage("\t{0}: {1}\n", kvp.Key, kvp.Value.ToString());
    }
  }
}

/* Example output 
From 2882: To 3857
Steps:
 Direction: Forward
 Step: 1901
From 3857: To 4432
Steps:
 Direction: Reverse
 Step: 1173
 Direction: Forward
 Step: 1241
*/

See also

esri_coordsys_DatumTransformations—An AutoLISP function that returns all the datum transformation definitions in the drawing as a list of associated lists.