Exporting Items
You can export model and file versions from the database to the file system. When exporting a file to the file system, the target location can be specified using either a regular file system path or a file scheme path.
Examples
Export a model version as an MPH file to the directory C:\\My Models.
// The itemVersionKey variable is initialized elsewhere. The
// filename saved with the model version is automatically used.
ExportModelItemVersionResult result = database
  .modelVersionByKey(itemVersionKey)
  .exportToDirectory("C:\\My Models");
 
// The file system path to the exported MPH file.
String filePath = result.exportedLocation();
Export a model version using a custom filename and without its Built, Computed, and Plotted Data.
// The modelLocationUri variable is initialized elsewhere.
ModelItemVersion version = DatabaseApiUtil
  .api()
  .modelVersionByLocationUri(modelLocationUri);
 
ExportModelItemVersionParamGenerator p = DatabaseApiUtil.param()
  .forExportModelVersion()
  .withTargetFilename("my_model_no_computed_data.mph")
  .withTargetDirectoryLocation("C:\\My Models")
  .withSourceComputedDataExcluded();
ExportModelItemVersionResult result = version.export(p);
String filePath = result.exportedLocation();
Export a file version to the root directory identified by the common file scheme.
SearchItemVersionResult result = database
  .searchItemVersions("my_geometry.mphbin")
  .firstOrNull();
database
  .fileVersionByKey(result.itemVersionKey())
  .exportToDirectory("common:///");
Unlike for example the temp file scheme, the common file scheme does not require an associated model.