3D PLM Enterprise Architecture

Data Access - File

Exporting a Document Format Type

Saving a document under a user-defined format type
Use Case

Abstract

This article accompanies the CAAOmbExportType use case. This use case explains how to save an existing document under a specific, user-defined format type.


What You Will Learn With This Use Case

This use case is intended to help you understand how to save an existing document under another format type that you yourself have defined. This may be useful when you have specific operations that need to be performed while saving a document. 

[Top]

The CAAOmbExportType Use Case

CAAOmbExportType is a use case of the CAAObjectModelerBase.edu framework that illustrates ObjectModelerBase framework capabilities.

[Top]

What Does CAAOmbExportType Do

The goal of CAAOmbExportType is to save an existing document under another format type defined by the user. It shows how to define the new format type and how to implement the CATIExportTypeManager interface's methods in order to save the document under the new format type.

[Top]

How to Launch CAAOmbExportType

To launch CAAOmbExportType, you will need to set up the build time environment, then compile CAAOmbExportType.m along with its prerequisites and set up the run time environment. This is fully described in the referenced article [1]. To launch the use case, you must perform the following steps:

[Top]

Where to Find the CAAOmbExportType Code

CAAOmbExportType code is located in the CAAOmbExportType.m use case module of the CAAObjectModelerBase.edu framework:

Windows InstallRootDirectory/CAAObjectModelerBase.edu/CAAOmbExportType.m
Unix InstallRootDirectory\CAAObjectModelerBase.edu\CAAOmbExportType.m

where InstallRootDirectory is the root directory of your CAA V5 installation. It is made of a unique source file named CAAEOmbExportTypeData.cpp.

[Top]

Step-by-Step

There are two logical steps in CAAOmbExportType:

  1. Defining the New Document Format Type
  2. Implementing CATIExportTypeManager

We will now comment each of these sections by looking at the code.

[Top]

Defining the New Document Format Type

CATProduct_OmbExportType  CATIExportTypeManager	      libCAAOmbExportType

A new document format type is simply defined by adding a new entry in the current framework's dictionary. This new entry will cause the File/SaveAs dialog box to list the new format type among the types defined to the save operation. The first parameter, CATProduct_OmbExportType, indicates that the exporting document is a Product-type document (i.e., a document having a .CATProduct suffix) and that the exported document format type is "OmbExportType", which will also be the suffix of the saved document. The second parameter indicates that this new document type will implement the CATIExportTypeManager interface in order to define the specific save operations necessary to export the new document. The last parameter is the name of the library in which the implementation module is to be found.

[Top]

Implementing CATIExportTypeManager 

See the Object Modeler articles [2] for a detailed explanation about interface implementations.

The implementation of CATIExportTypeManager is found in the CAAOmbExportType.m module defining the CAAEOmbExportTypeData implementation class.

CATImplementClass( CAAEOmbEExportTypeData,
	           CodeExtension,
		   CATBaseUnknown, 
	           CATProduct_OmbExportType );

The CATImplementClass macro defines the implementation class CAAEOmbExportTypeData as a code extension implementing the CATProduct_OmbExportType late type.

#include "TIE_CATIExportTypeManager.h"
TIE_CATIExportTypeManager( CAAEOmbExportTypeData );

The above statement indicates that this is an implementation of the CATIExportTypeManager interface.

HRESULT CAAEOmbExportTypeData::ExportData ( CATDocument *pDoc,
                                            CATUnicodeString path )
{
    cout << "************** Begin ExportData 1" << endl << flush;
    HRESULT rc = CATDocumentServices::SaveAs (*pDoc, 
		                              path);

    return rc;
}

In this case, the document is simply saved using the SaveAs method of CATDocumentServices. However, it is in this method that you must code any specific save operations necessary for your new document type.

[Top]


In Short

This use case has demonstrated how to:

[Top]


References

[1] Building and Launching a CAA V5 Use Case
[2] Creating Components
[Top]

History

Version: 1 [June 2001] Document created
[Top]

Copyright © 2001, Dassault Systèmes. All rights reserved.