Use the MDt library
 
 
 

The MDt library works by walking through the DAG structure of the scene and creating internal data tables that are then referenced by the MDt functions. This process can take a bit of time for large files or NURBS surfaces. If it takes too much time to generate the internal data tables, using the Maya API directly may better suit your needs.

Once the data tables are created, the translator is then able to access the tables and output the data in whatever format it needs to. References to the original Maya objects are stored (temporarily) so they can be referenced to get additional data without having to walk the DAG tree again.

Start with MDt functions and then use Maya API to obtain information that is not cached in the MDt data tables.

TipIt is not recommended that you start with the Maya API and add in the MDt functions. The MDt functions can be used to quickstart or prototype a translator, and then use the knowledge gained to refine/customize the translator.