3D PLM Enterprise Architecture |
Data Access - File |
Exporting a Document Format TypeSaving a document under a user-defined format type |
Use Case |
AbstractThis article accompanies the CAAOmbExportType use case. This use case explains how to save an existing document under a specific, user-defined format type. |
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]
CAAOmbExportType is a use case of the CAAObjectModelerBase.edu framework that illustrates ObjectModelerBase framework capabilities.
[Top]
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]
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:
CAAObjectModelerBase.edu.dico
file found in the CAAObjectModelerBase.edu/CNext/code/dictionary
directory of your workspace: delete the # character in front of the CATProduct_OmbExportType
document type and update the runtime view.File/Open
or File/Create
on a Product
document.File/SaveAs
on the current Product document.File/SaveAs
dialog box, select the "OmbExportType"
document type.File/SaveAs
dialog box, selection the directory and
name under which the document is to be saved.Save
" button to save the document
under the new format type. [Top]
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]
There are two logical steps in CAAOmbExportType:
We will now comment each of these sections by looking at the code.
[Top]
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]
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]
This use case has demonstrated how to:
File/SaveAs
dialog box.[Top]
[1] | Building and Launching a CAA V5 Use Case |
[2] | Creating Components |
[Top] |
Version: 1 [June 2001] | Document created |
[Top] |
Copyright © 2001, Dassault Systèmes. All rights reserved.