All Frameworks  Class Hierarchy  This Framework  Previous  Indexes

CATPDMBase Class CATPDMServices

System.IUnknown
  |
  +---System.IDispatch
    |
    +---System.CATBaseUnknown
      |
      +---CATPDMServices
 

Usage: you must use this class as is. You should never derive it.


public class CATPDMServices

Class for PDM services.
Role:This class delivers services to be used either with ENOVIAvpm V4, either with ENOVIA V5 or both.


Constructor and Destructor Index


o CATPDMServices()
o ~CATPDMServices()

Method Index


o CATAnalyseDocIdFromVPM(CATIDocId*,CATUnicodeString&,CATUnicodeString&,CATUnicodeString&,CATUnicodeString&)
Returns the COID, COMPID, Table name and Environment name of a ENOVIAvpm V4 document.
o CATAnalysePrintableIDFromVPM(CATUnicodeString,CATUnicodeString&,CATUnicodeString&,CATUnicodeString&,CATUnicodeString&,CATListOfCATUnicodeString&)
Parses a ENOVIAvpm V4 printable Id.
o CheckDocSave(CATDocument*,CATBoolean&)
Checks if a document in session and its pointed documents can be saved.
o DisplayMessage(CATErrorType,char*,int,CATUnicodeString*,...)
Displays an error message.
o GetDocumentsToSave(CATDocument*,CATLISTP(CATDocument)*)
Retrieves the pointed documents that need to be saved before the reference document.
o GetPrintableId(CATBaseUnknown*&,CATUnicodeString&)
Get a printable Id for a PDM instance or PDM document.
o KeepQuiet(boolean*)
Controls weither meaningfull error are to be displayed or not in user report.
o LoadNomadSession(CATUnicodeString&,CATLISTP(CATIDocId)*,CATLISTP(CATDocument)*)
Loads in CATIA session a whole Nomad Session.
o LoadPDMDocument(int,CATLISTP(CATIDocId)*,CATLISTP(CATDocument)*,CATLISTP(CATDocument)*)
Load in CATIA V5 session CATIA documents stored in a ENOVIA database.
o NomadDocumentProperties(CATUnicodeString&,CATLISTP(CATDocument)*&,CATListOfCATBoolean*&,CATListOfCATUnicodeString*&)
Returns information on documents of the Nomad session.
o ReplaceDocument(CATDocument*)
Replaces in PDM a CATIA Document coming from a Nomad session.
o ReplicateDocument(CATUnicodeString&,CATDocument*)
Exports a PDM Document in a filebase Nomad session.
o ResetPDMDocuments(CATLISTP(CATDocument)*&,CATLISTP(CATDocument)*&)
Resets PDM documents properties.
o vDisplayMessage(CATErrorType,char*,char*,int,CATUnicodeString*,va_list)
Displays an error message.

Constructor and Destructor


o CATPDMServices
public CATPDMServices()
o ~CATPDMServices
public virtual ~CATPDMServices()

Methods


o CATAnalyseDocIdFromVPM
public static HRESULT CATAnalyseDocIdFromVPM(CATIDocId* iDocID,
CATUnicodeString& oCoid,
CATUnicodeString& oCompid,
CATUnicodeString& oCaenv,
CATUnicodeString& oCatab)
Returns the COID, COMPID, Table name and Environment name of a ENOVIAvpm V4 document.
Role:This method returns the Coid, Compid, Table name and Environment name of a document loaded in session.
Use PSNInteroperability.CATComputeDocId to get a document Identifier for ENOVIAvpm V4.
This method supports only documents coming from ENOVIAvpm V4.

Parameters:
iDocID
Document Identifier
oCoid
Coid of the document in ENOVIAvpm V4(Hexadecimal 16 crc long)
oCompid
Compid of the document in ENOVIAvpm V4(Hexadecimal 16 crc long)
oCatenv
the VPM environment name of the document (8 crc long).
For instance "VPMENV "
oCatab
the VPM table name of the document (18 crc long).
For instance "DOCUMENT " for a V5 document
Returns:
  • S_OK: All parameters are successfuly returned
  • E_FAIL: The document is not a ENOVIAvpm V4 document
  • E_FAIL: The method has failed
o CATAnalysePrintableIDFromVPM
public static HRESULT CATAnalysePrintableIDFromVPM( const CATUnicodeString iPrintableID,
CATUnicodeString& oCoid,
CATUnicodeString& oCompid,
CATUnicodeString& oCaenv,
CATUnicodeString& oCatab,
CATListOfCATUnicodeString& oClink)
Parses a ENOVIAvpm V4 printable Id.
Role:This method parses a printable Id you have got using CATPDMServices.GetPrintableId on a ENOVIAvpm V4 product structure instance (Product or document). It returns explicit information contained in the printable Id:

Parameters:
iPrintableID
Printable Id as returned by
CATPDMServices.GetPrintableId
oCoid
Coid of the entity in ENOVIAvpm V4(Hexadecimal 16 crc long)
oCompid
Compid of the entity in ENOVIAvpm V4(Hexadecimal 16 crc long)
oCatenv
the VPM environment name of the entity (8 crc long).
For instance "VPMENV "
oCatab
the VPM table name of the entity (18 crc long).
For instance "PART_LIST " for a part
or "DOCUMENT " for a V5 document
or "CATIA_MODEL " for a V4 document
oClink
List of CLINKs.
A CLINK is the Link Information stored in $EXT Table (Hexadecimal 16 crc long)
Returns:
  • S_OK: Parsing is successfull
  • E_FAIL: Invalid input argument
o CheckDocSave
public static HRESULT CheckDocSave(CATDocument* iDoc,
CATBoolean& oSavePossible)
Checks if a document in session and its pointed documents can be saved.
Role:This method allows check if a document in session has pointed documents that are dirty. In case some pointed documents are dirty (return code=S_FALSE), a dialog panel is displayed asking the user to confirm if he wants or not to save the document: In batch mode, the panel is not displayed and oSavePossible value is S_FALSE.
Note: This method doesn't perform the Save. It does only the check.
This method supports documents coming from ENOVIAvpm V4 or ENOVIA V5.

Parameters:
iDoc
Document to be checked for save.
oSavePossible
Only in case some pointed documents are dirty:
  • S_OK: The user has selected YES in the confirmation panel.
  • S_FALSE: The user has selected NO in the confirmation panel.
In batch mode, S_FALSE only possible value.
Returns:
  • S_OK: No pointed document is dirty.
  • S_FALSE: Some pointed documents are dirty.
  • E_FAIL: NULL pointer as input document.
  • E_FAIL: The method failed.
o DisplayMessage
public static void DisplayMessage(CATErrorType iLevel,
const char* iMsgKey,
int nbArgs=0,
const CATUnicodeString* iArgs=NULL,
... )
Displays an error message.
Role:This method displays an error message if the CATPDMServices.KeepQuiet current mode is FALSE. This message is displayed either:
Note: This method has the same purpose as CATPDMServices.vDisplayMessage with iMsgCtlg = "CATPDMBase".
See also:
CATPDMServices.vDisplayMessage
Parameters:
iLevel
The error level
iMsgKey
Identifier of the error message in the NLS file (without the prefix, ERR_, WRN_, INF_ ).
This prefix is automatically added by the MsgReporter:
  • ERR_ for Critical and Fatal
  • WRN_ for Warning
  • INF_ for Information
nbArgs
Nb of optional arguments
iArgs
Optional arguments of the error message, identified by /p1, /p2, ... in the NLS
o GetDocumentsToSave
public static HRESULT GetDocumentsToSave(CATDocument* iDoc,
CATLISTP(CATDocument)* oDocsTosave)
Retrieves the pointed documents that need to be saved before the reference document.
Role:This method checks if a PDM document in session meant to be saved has pointed documents that are dirty. In case some pointed documents are dirty, the method returns the list of pointed documents that need to be saved before the input document.
This method supports documents coming from ENOVIAvpm V4 or ENOVIA V5.
Note: Only CATProduct type document is supported as input document.

Parameters:
iDoc
Document to check for save.
oDocsToSave
List of the documents that need to be saved before current document.
Returns:
  • S_OK: No pointed document is dirty.
  • E_FAIL: NULL pointer as input document.
  • E_FAIL: The method failed.
o GetPrintableId
public static HRESULT GetPrintableId(CATBaseUnknown*& iProduct,
CATUnicodeString& oPrintableId)
Get a printable Id for a PDM instance or PDM document.
Role:This method returns a printable Id for a PDM instance or a PDM document.
This method supports instances and documents coming from ENOVIAvpm V4.
Parameters:
iProduct
Pointer to the Product
oPrintableId
Ouput parameter giving the printable Id of the PDM product
Returns:
  • S_OK: Printable Id successfuly returned.
  • E_FAIL: The method failed.
o KeepQuiet
public static boolean KeepQuiet(boolean* iDoNotTalk=NULL)
Controls weither meaningfull error are to be displayed or not in user report.
Role:This method controls weither meaningfull errors are to be displayed or not for user report purpose, and accordingly has a direct effect on CATPDMServices.DisplayMessage and CATPDMServices.vDisplayMessage
The typical usage is just reading the KeepQuiet Mode:
          if (CATPDMServices::KeepQuiet()) then "do not report error";
 

Another typical usage is to change locally the mode and then to restore it as it was:
         boolean do_not_talk=TRUE; 
         boolean was_eventually_talking=CATPDMServices::KeepQuiet(&do_not_talk); 
         ...some application code then...  
         CATPDMServices::KeepQuiet(&was_eventually_talking); 
 
See also:
CATPDMServices.DisplayMessage,
CATPDMServices.vDisplayMessage

Parameters:
iDoNotTalk
optional: sets the next KeepQuiet mode:
  • TRUE active registration of meaningfull errors
  • FALSE deactive registration of meaningfull errors
Returns:
the current KeepQuiet mode:
  • TRUE Quiet mode activated
  • FALSE Quiet mode deactivated
  • (Default)
o LoadNomadSession
public static HRESULT LoadNomadSession(CATUnicodeString& iNomadPath,
CATLISTP(CATIDocId)* oListDocumentId,
CATLISTP(CATDocument)* oLoadedDocuments)
Loads in CATIA session a whole Nomad Session.
Role:This method loads in the CATIA session the whole Nomad session from the input Nomad session file.

See also:
CATPDMServices.ReplaceDocument,
CATPDMServices.NomadDocumentProperties
CATPDMServices.ReplicateDocument

Parameters:
iNomadPath
Path of the directory where the Nomad Session file is located.
oListDocumentId
List of the document identifiers for the documents that have been loaded.
oLoadedDocument
List of the CATIA Documents that have been loaded.
Returns:
  • S_OK: Nomad session succeesfuly loaded.
  • S_FALSE: Nomad Session file not found
  • E_FAIL: Failed to load the nomad Session.
o LoadPDMDocument
public static HRESULT LoadPDMDocument(int iMode,
CATLISTP(CATIDocId)* iListDocumentId,
CATLISTP(CATDocument)* oRequiredLoadedDocument,
CATLISTP(CATDocument)* oPointedLoadedDocuments)
Load in CATIA V5 session CATIA documents stored in a ENOVIA database.
Role:This method allows load in the CATIA V5 session the CATIA V5 documents and CATIA V4 models that are stored in a ENOVIAvpm V4 or ENOVIA VPM V5 database.
You can load a list of documents and choose to load the pointed documents as well. As a result, the method provides the list of the required document and the list of the pointed documents implicitly loaded.
Use PSNInteroperability.CATComputeDocId to get a document Identifier for ENOVIAvpm V4.

Parameters:
iMode
To choose if pointed documents must be loaded in session:
  • 0: pointed documents are not loaded
  • 1: pointed documents are loaded
iListDocumentId
List of document identifiers to be loaded in session
oRequiredLoadedDocument
List of the CATIA Documents corresponding to the input PDM document identifier list. If a document cannot be loaded, the output list can contains NULL CATDocument pointers.
CATDocument pointers must be deleted by the caller.
oPointedLoadedDocument
List of the CATIA Documents implicitly loaded, only when iMode is set to 1 (load of pointed document).
CATDocument pointers must be deleted by the caller.
Returns:
  • S_OK: Document(s)have been loaded.
  • S_FALSE: Document not found. Wrong Document identifier.
  • E_FAIL: Failed to load a document.
o NomadDocumentProperties
public static HRESULT NomadDocumentProperties(CATUnicodeString& iNomadPath,
CATLISTP(CATDocument)*& oCATDocument,
CATListOfCATBoolean*& oStatus,
CATListOfCATUnicodeString*& oNomadName)
Returns information on documents of the Nomad session.
Role:This method allows retrieve the modification status and the Nomad identifier for each document of the Nomad session.

See also:
CATPDMServices.ReplaceDocument,
CATPDMServices.LoadNomadSession
CATPDMServices.ReplicateDocument

Parameters:
iNomadPath
Path of the directory where the Nomad Session file is located.
oCATDocument
List of documents in the Nomad session.
oStatus
Status of each document of the Nomad session:
  • TRUE: if document has been modified since its last database extraction.
  • FALSE: if the document has not been modified during its Nomad life.
oNomadName
Nomad file Identifier of each document of the Nomad session (usually "DOC1", "DOC2",...etc).
Returns:
  • S_OK: Properties successfuly returned .
  • S_FALSE: Empty Nomad Session.
  • E_FAIL: Failed to find the nomad Session.
o ReplaceDocument
public static HRESULT ReplaceDocument(CATDocument* iDocument)
Replaces in PDM a CATIA Document coming from a Nomad session.
Role:This method allows replace in PDM a CATIA document coming from a Nomad session. The document to be saved must already exists in the PDM.
If the Nomad document in session has pointed documents in the same Nomad session, they will be also automatically replaced in PDM.

See also:
CATPDMServices.LoadNomadSession,
CATPDMServices.NomadDocumentProperties
CATPDMServices.ReplicateDocument

Parameters:
iDocument
Document to be replaced in the PDM.
Returns:
  • S_OK: Document(s)have been replaced in PDM.
  • S_FALSE: Document cannot be replaced (already replaced, file document).
  • E_INVALIDARG: NULL pointer as input document.
  • E_FAIL: Failed to replace a document.
o ReplicateDocument
public static HRESULT ReplicateDocument(CATUnicodeString& iNomadPath,
CATDocument* iDocument)
Exports a PDM Document in a filebase Nomad session.
Role:This method allows export a PDM document in a Nomad session file created in the dedicated directory. A Nomad session file has a "DocNomad" extension.
If the document in session has pointed (PDM) documents, they will be automatically exported too in the same Nomad session file.
Note: Only CATProduct type document is supported as input document.

See also:
CATPDMServices.LoadNomadSession,
CATPDMServices.NomadDocumentProperties
CATPDMServices.ReplaceDocument

Parameters:
iNomadPath
Path of directory where the Nomad Session file must be created.
iDocument
Document to replicate in the Nomad session file.
Returns:
  • S_OK: Document(s)have been replicated in the Nomad session file.
  • S_FALSE: Document cannot be replicated (already replicated, file document).
  • E_FAIL: Failed to replicate a document.
  • E_INVALIDARG: NULL pointer as input document.
o ResetPDMDocuments
public static HRESULT ResetPDMDocuments(CATLISTP(CATDocument)*& iDocumentsToReset,
CATLISTP(CATDocument)*& oDocumentsReset)
Resets PDM documents properties.
Role:This method allows reset the PDM properties of PDM documents loaded in session. As a result, the documents in session becomes File documents and have no more relation with the database they come from.
Important: All pointing documents on these documents are reseted too.
Links beetween the reseted documents are updated accordingly in session.
The reseted documents get the Modified status in SaveManagement, meaning they become dirty and need to be saved.
This method supports all CATIA V5 types documents and CATIA V4 models.
This method supports documents coming from ENOVIAvpm V4 or ENOVIA V5.
Filebase documents are supported too and are kept as filebase documents.
Parameters:
iDocumentsToReset
List of documents to reset.
oDocumentsReset
List of reseted documents.
This list is created by new and has to be remove and deleted by the caller.
Returns:
  • S_OK: all the documents have been successfuly reseted.
  • E_FAIL: NULL pointer as input list.
  • E_FAIL: Failed reseting a document.
o vDisplayMessage
public static void vDisplayMessage(CATErrorType iLevel,
const char* iMsgKey,
const char* iMsgCtlg,
int nbArgs,
const CATUnicodeString* first,
va_list others)
Displays an error message.
Role:This method displays an error message if the CATPDMServices.KeepQuiet current mode is FALSE. This message is displayed either:
See also:
CATPDMServices.DisplayMessage
Parameters:
iLevel
The error level
iMsgKey
Identifier of the error message in the NLS file (without the prefix, ERR_, WRN_, INF_ ).
This prefix is automatically added by the MsgReporter:
  • ERR_ for Critical and Fatal
  • WRN_ for Warning
  • INF_ for Information
iMsgCtlg
I Name of the NLS file containing the error
It is typically called by DisplayMessage with iMsgCtlg = CATPDMBase
nbArgs
Nb of optional arguments
iArgs
Optional arguments of the error message, identified by /p1, /p2, ... in the NLS

This object is included in the file: CATPDMServices.h
If needed, your Imakefile.mk should include the module: CATPDMBase

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