Lifecycle Applications
|
Interoperability
|
Controling VPMDocumentRevision Saved from an
External Application
Implementing ENOVIUESaveFile |
Use Case |
Abstract
The document is related to the use case CAAVpiENOVIUESaveFile.
It describes how to implement a user-exit to control the object on which a
File/Save
will be performed from an external application, CATIA V5 for example
.
|
What You Will Learn With This Use Case
This Use-Case will show you how to implement the interface and user-exit called
ENOVIUESaveFile .
This User Exit allow you to control the object on which a File/Save is performed
by the LCA external application Plug-in whenever a Document
(ENOVIDocumentRevision) is saved into LCA.
This UseCase show you how to limit the number of iterations when we save a
document from CATIA V5 to ENOVIA LCA.
This interface may also be used to update or modify the intended saved object.
It allow you more generally, to perform any action of your choice, whenever a
Document is saved from an external application into ENOVIA.
This Use Case is especially aimed at helping you to implement your own
ENOVIUESaveFile User-Exit.
The CAAVpiENOVIUESaveFile Use Case
CAAVpiENOVIUESaveFile is a use case of the CAAVPMInterfaces.edu framework.
What Does CAAVpiENOVIUESaveFile Do
This user-exit sample gives the application designer an insight on how to modify
the preferred iteration (the one exposed to the user) on a save-file event
initiated by an external application.
To do so, the use case goes through the following steps:
- Implement the user-exit method called "GetObject (CATBaseUnknown
*& oObject)" in file
CAAVpiENOVISaveFile.m/src/CAAVpiENOVIUESaveFile.cpp by performing the
following steps:
- Test the value of int cUserExit.
- If cUserExit = 0, return S_FALSE => create a new iteration
- If cUserExit = 1 , delete the non preferred & return S_FALSE.
- If cUserExit = 2 , Retrieve the non preferred. Set it preferred. Return
it in oObject + S_OK
The actual implementation of the user-exit is contained in the file
CAAVpiENOVIUESaveFile.cpp.
How to Launch CAAVpiENOVIUESaveFile
Launch the use case, CAAVpiENOVIUESaveFile, as follows:
- First uncomment the following line in the dictionary file
(CAAVPMInterfaces.edu/CNext/code/dictionary/CAAVPMInterfaces.edu.dic):
#ENOVIA_VPMDocumentRevision
ENOVIUESaveFile
libCAAVpiENOVISaveFile
- Set int cUserExit to the value of your choice 0,1 or 2 by uncomment
the right line at the beginning of CAAVpiENOVIUESaveFile::GetObject method.
- Then compile CAAVpiENOVIUESaveFile with its prerequisites.
- Create a new document from your external application.
- Save it to LCA.
Where to Find the CAAVpiENOVIUESaveFile Code
The CAAVpiENOVIUESaveFile Use Case is located in the module
CAAVpiENOVISaveFile.m of the framework CAAVPMInterfaces.edu.
Windows |
InstallRootDirectory\CAAVPMInterfaces.edu\CAAVpiENOVISaveFile.m\ |
Unix |
InstallRootDirectory/CAAVPMInterfaces.edu/CAAVpiENOVISaveFile.m/ |
Where InstallRootDirectory is the directory where the CAA CD-ROM is
installed.
Step-by-Step
There are seven main steps in CAAVpiENOVIUESaveFile code:
- The User Exit itself extends
ENOVIA_VPMDocumentRevision
- Set/Read the cUserExit value
- If cUserExit = 0:
- Return S_FALSE.
- => A new iteration will be created.
- If cUserExit = 1 or 2:
- Get all iteration of current ENOVIA_VPMDocumentRevision.
- Abort (return S_FASE ) if the number of iteration is smaller than 2.
- If cUserExit = 1:
- Restrict the number of iterations to 2:
- Delete all non prefered & return S_FALSE
- => A new iteration will be created.
- If cUserExit = 2:
- Retrieve the first non prefered Iteration.
- Set it prefered.
- Return it in oObject + S_OK
- => the prefered iteration will be overwritten.
We will now comment each of these sections in detail.
The User Exit itself extends
ENOVIA_VPMDocumentRevision.
Extending ENOVIA_VPMDocumentRevision with your user exit allow the LCA plugin
code
to make your User Exit pointing to the Document Revision currently intended to
be saved.
Set/Read the cUserExit value
This allow you to choose the behaviour of the User Exit.
cUserExit = 0:
Return S_FALSE:
A new iteration will be created thereafter by Enovia.
UserExit = 1 or 2
Get all iterations of current ENOVIA_VPMDocumentRevision.
Abort (return S_FASE ) if the number of iteration is smaller than 2:
cUserExit = 1
Restrict the number of iterations to 2: Delete all non preferred & return
S_FALSE.
A new iteration will thereafter be created by Enovia.
cUserExit = 2
Retrieve the first non preferred Iteration.
...
Set it preferred,
and Return it in oObject + S_OK.
As a consequence, this iteration will be exposed to the User In Enovia.
And the initially preferred iteration will be overwritten.
In Short
This use case demonstrates how the user-exit technique can be used in the Catia
Plugin to implement a customized saving-behaviour.
As an example, a user-exit that limit the number of document iterations while
saving in ENOVIA is described.
References
History
Version: 1 [Nov 2003] |
Document created by BRL |
[Top] |
Copyright © 2003, Dassault Systèmes. All rights reserved.