All Frameworks  Class Hierarchy  This Framework  Previous  Next  Indexes

CATxPDMInterfaces Class CATxPDMSessionServices

CATxPDMSessionServices
 

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


public class CATxPDMSessionServices

Class for PDM services working on items loaded in session.
Role: This class is used for external File PDM system integration.

All the methods pre-requisites the PX1 license

See also:
CATIxPDMItem, CATIxPDMSession


Method Index


o BreakAllExternalLinks(CATIxPDMItem_var&)
Breaks external links of an item.
o CheckDesignRules(CATListOfCATString&,CATListValCATIxPDMItem_var*&,CATIReporter*&)
Check rules necessary for PDM before Save.
o CheckFeatureCompatibility(CATBaseUnknown*,CATBaseUnknown*)
Checks that two features are compatible.
o FindNonImportedPublications(CATIxPDMItem_var&,CATBaseUnknown*,CATListOfCATUnicodeString**)
Retrieves publications from an instance not imported in a specific item.
o GetItemFromDocument(CATDocument*,CATIxPDMItem_var&)
Retrieves an item from a document loaded in session.
o GetItemFromFeature(CATBaseUnknown_var&,CATIxPDMItem_var&)
Retrieves an item from a feature loaded in session.
o GetxPDMItemsInSession(CATListValCATIxPDMItem_var*&)
Retrieves all items loaded in session.
o IsImported(CATIxPDMItem_var&,CATBaseUnknown*,CATBaseUnknown*)
Retrieves if an object from an instance is imported in a specific item.
o LoadItemInSession(CATIxPDMItem_var&,CATIxPDMItem_var&)
Loads an item in session.
o NeedToLaunchCATDUAForLinksAnalysis(CATIxPDMItem_var&,CATBoolean&)
Check contents of item to verify if CATDUA will improve link status.
o RefreshItemInformation(CATIxPDMItem_var&,ItemRefresh&)
Refreshes some session information on a loaded item.
o SaveSessionToDirectory(char*,CATUnicodeString&,CATListValCATIxPDMItem_var*,CATListOfCATUnicodeString*)
Saves a session to a specific directory.
o SetExternalLinksStatus(CATIxPDMItem_var&,CATBoolean)
Manages links activity of an item.
o SetInitialDocFileName(CATIxPDMItem_var&,CATUnicodeString&)
Sets an initial file name on an item.
o SynchronizeAllExternalLinks(CATIxPDMItem_var&)
Synchronizes external links of an item.
o UnLoadItemFromSession(CATIxPDMItem_var&)
Unloads an item from session.

Enumerated Type Index


o ItemRefresh
Item information to refresh in session.

Methods


o BreakAllExternalLinks
public static HRESULT BreakAllExternalLinks(CATIxPDMItem_var& iPDMItem)
Breaks external links of an item.
Role:This method retrieves all the external links of the given document, and breaks them.
Only few links can be broken (like geometrical or parameter imports).

Notice that this API is equivalent to Isolate button in Edit/Links panel.

Save is necessary after a break.

Parameters:
iPDMItem
The item to break its external links.
Returns:
  • S_OK: All external links of the given item are successfully broken.
  • S_FALSE: There is no more external links to break.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • The input item pointer is NULL.
    • InputERR_1012:
    • Error during the break of one specific link.
    • InputERR_1004:
    • Internal error during the break process.
o CheckDesignRules
public static HRESULT CheckDesignRules( const CATListOfCATString& iListOfRulesToCheck,
CATListValCATIxPDMItem_var*& oItemsWithError,
CATIReporter*& oReporter)
Check rules necessary for PDM before Save.
Role:This method checks a customized list of rules necessary for PDM before Save. The list to choose depends of what is allowed in targeted PDM. These rules work also on items coming from ENOVIA V5 (with the exception of rule READONLY_CONSISTENCY, which is specific to file items).
Parameters:
iListOfRulesToCheck
List of string describing rules to check on all items in session. Authorized values are:
  • "RESOLVED_IMPORT": Check that all imports (geometry and parameters) are resolved. If you activate this check, this method will load pointed items to check the link. So number of items loaded in session could increase after this call.
  • "SYNCHRONIZED_IMPORT": Check that all imports (geometry and parameters) are synchronized. If you activate this check, this method will load pointed items to check the link. So number of items loaded in session could increase after this call.
  • "NESTED_LEVEL=x": Check number of levels of links. x is the maximum authorized value. If PartA imports geometry from PartB and PartB import parameter from PartC, there is 3 levels of links. If DrawingA has a link to ProductB and ProductB contains PartD, there is 3 levels of links. If you activate this check, this method will load pointed items to check the link. So number of items loaded in session could increase after this call.
  • "NESTED_IMPORT=x": Check number of levels of import. x is the maximum authorized value. If PartA imports geometry from PartB and PartB import parameter from PartC, there is 3 levels of imports. This check is a restriction of NESTED_LEVEL to geometrical and knowledge links between CATPart and CATShape. If you activate this check, this method will load pointed items to check the link. So number of items loaded in session could increase after this call.
  • "CYCLES": Check that there is no cycle between items. All kind of links are checked. Notice that 'Context' link from CATPart to CATProduct is not considered as a cycle. If you activate this check, this method will load pointed items to check the link. So number of items loaded in session could increase after this call.
  • "ONLY_PUBLICATIONS": Check that all imports are using publications. This check perform verification without loading pointed data.
  • "READONLY_CONSISTENCY": Check that all Read Only and Read Write status of item loaded is consistent. Inconsistent status could lead to Product Structure desynchronization in case of Save (SYN_1 and SYN_2 errors in CATDUA).
oItemsWithError
List of items with associated errors. Items can be duplicated in this list if there is several errors on one item.
oReporter
List of errors. Use CATIReporter#GetListReporterInfo to retrieve all errors. Authorized values are:
  • InputERR_1301:
  • An import is not synchronized.
  • InputERR_1302:
  • Impossible to find pointed object by an import.
  • InputERR_1303:
  • Too many level of imports.
  • InputERR_1304:
  • Too many level of links.
  • InputERR_1305:
  • There is a cycle between items.
  • InputERR_1306:
  • There is a import without publication.
Returns:
  • S_OK: The check runs successfully whithout any error.
  • S_FALSE: The check runs successfully and detects some errors, use oReporter to retrieve them.
  • E_FAIL: The check fails with an internal error. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1004:
    • Internal error.
    • InputERR_1251:
    • Requested rule is unknown.
    • InputERR_1252:
    • No item loaded in session.
o CheckFeatureCompatibility
public static HRESULT CheckFeatureCompatibility(CATBaseUnknown* iFirstFeature,
CATBaseUnknown* iSecondFeature)
Checks that two features are compatible.
Role:This method checks that two features are compatible. If two features are compatible, a link put on the first feature will be able to solve on second feature if you replace first document by second one.
Parameters:
iFirstFeature
The first feature to compare.
iSecondFeature
The second feature to compare.
Returns:
  • S_OK: Features are compatible
  • E_FAIL: There are two raisons:
    • The features are not compatible: no CATError class instance is generated. The static CATError.CATGetLastError method returns NULL
    • The method has failed. A CATError class instance is generated. The possible returned errors (listed by their identifier) are:
      • InputERR_1001:
      • The PX1 licence is not available.
      • InputERR_1002:
      • At least one input pointer is NULL.
o FindNonImportedPublications
public static HRESULT FindNonImportedPublications( const CATIxPDMItem_var& iItemWithImportedPublications,
CATBaseUnknown* iDocumentInstanceWithPublications,
CATListOfCATUnicodeString** oNonImportedPublications)
Retrieves publications from an instance not imported in a specific item.
Role:This method verifies that all objects published by an instance are imported in a specific item.
Parameters:
iItemWithImportedPublications
Item where we check that all objects published by iDocumentInstanceWithPublications are imported. This item has always a CATPart type.
iDocumentInstanceWithPublications
This is an instance of a Part in a Product (implementing CATIProduct interface).
oNonImportedPublications
List of publications existing in iDocumentInstanceWithPublications and not imported in iDocumentToCheck. If all publications are imported, this list is empty and return is S_OK.
Returns:
  • S_OK: The list is successfully computed.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • At least one input parameter is invalid.
o GetItemFromDocument
public static HRESULT GetItemFromDocument( const CATDocument* iInputDocument,
CATIxPDMItem_var& oPDMItem)
Retrieves an item from a document loaded in session.
Role:This method retrieves a handler to a CATIxPDMItem interface from a CATDocument.
Parameters:
iInputDocument
The document loaded in session
oPDMItem
The returned item
Returns:
  • S_OK: The item is successfully returned.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • The input document is NULL.
o GetItemFromFeature
public static HRESULT GetItemFromFeature( const CATBaseUnknown_var& iInputFeature,
CATIxPDMItem_var& oPDMItem)
Retrieves an item from a feature loaded in session.
Role:This method retrieves a handler to a CATIxPDMItem interface from a feature ('CATISpecObject').
Parameters:
iInputFeature
The feature loaded in session
oPDMItem
The returned item
Returns:
  • S_OK: The item is successfully returned.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • The input feature is NULL.
o GetxPDMItemsInSession
public static HRESULT GetxPDMItemsInSession(CATListValCATIxPDMItem_var*& oListOfLoadedItem)
Retrieves all items loaded in session.
Role:This method retrieves all items loaded in session. This list is especially useful to rename items by the SaveSessionToDirectory method.
Parameters:
oListOfLoadedItem
The list of loaded items in session. This list will be NULL if no item is loaded in session. The caller has to delete the list.
Returns:
  • S_OK: The list is successfully returned.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
o IsImported
public static HRESULT IsImported( const CATIxPDMItem_var& iItemWithImport,
CATBaseUnknown* ipRefObject,
CATBaseUnknown* iDocumentInstance)
Retrieves if an object from an instance is imported in a specific item.
Role:This method verifies that an object in an instance context is imported in a specific item.The object can be a geometry, parameter or a publication.
Parameters:
iItemWithImport
Item where we check that ipRefObject in context of Product iDocumentInstance is imported. This item has always a CATPart type.
ipRefObject
Search object (geometry, parameter, publication). Use result of CATIPrdObjectPublisher::GetFinalObject as imput for publications.
iDocumentInstance
This is an instance of a Part in a Product (implementing CATIProduct interface).
Returns:
  • S_OK: Object is imported.
  • S_FALSE: Object is not imported.
  • Search failed: Returned errors (listed by their identifier)
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • One input pointer is NULL.
o LoadItemInSession
public static HRESULT LoadItemInSession( const CATIxPDMItem_var& iItemToLoad,
CATIxPDMItem_var& oLoadedItem)
Loads an item in session.
Role:This method loads an item is session. If item is already loaded in session, this method just returns a handler on already loaded item.
Parameters:
iItemToLoad
The item to load.
oLoadedItem
The loaded item. It can be same as iItemToLoad if item was already loaded.
Returns:
  • S_OK: The item is successfully loaded.
  • S_FALSE: The item is already loaded.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1004:
    • Internal error.
    • InputERR_1121:
    • The file associated with the item is not on the disk.
    • InputERR_1123:
    • This non CATIA document can never be loaded
o NeedToLaunchCATDUAForLinksAnalysis
public static HRESULT NeedToLaunchCATDUAForLinksAnalysis( const CATIxPDMItem_var& iItemToCheck,
CATBoolean& oNeedToLaunchCATDUA)
Check contents of item to verify if CATDUA will improve link status.
Role:This method verifies if some CATDUA rules about links (a sub-set of CATDUA rules) are detected in the selected item. Only check is performed, no correction, no modification, this is the CATDUA jobs.

If some rules are detected, it means that after CATDUA links status will be different. Some links will potentially disappears and ConsistentSet could be very different.

Parameters:
iItemToCheck
The item to check.
iNeedToLaunchCATDUA
TRUE if CATDUA can be launch to improve links status, FALSE otherwise.
Returns:
  • S_OK: Check successfully performed.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • Not available on non loaded item.
    • InputERR_1004:
    • Internal error.
o RefreshItemInformation
public static HRESULT RefreshItemInformation(CATIxPDMItem_var& iPDMItem,
ItemRefresh& iToRefresh)
Refreshes some session information on a loaded item.
Role:This method refreshes session information like Read/Write status or Unresolved link status. This method should be called when some information changes on file system to update V5 session.
Notice that only a very limited set of modification directly on file are supported when item is loaded in V5 session. V5 is not a database and does not support concurrent engineering in a File Base environment.
Parameters:
iPDMItem
The item to refresh from file system.
iToRefresh
The kind of information to refresh.
Returns:
  • S_OK: The information is successfully refreshed.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1005:
    • The item is not loaded.
o SaveSessionToDirectory
public static HRESULT SaveSessionToDirectory( const char* iDirectoryPath,
CATUnicodeString& oErrorMessage,
CATListValCATIxPDMItem_var* iListItemToRename=NULL,
CATListOfCATUnicodeString* iListOfNewNames=NULL)
Saves a session to a specific directory.
Role:This method allows you save a session to a specific directory (in interactive or batch) while keeping links consistency between all documents if some are renamed.

As soon as you work on several documents, you have to use this method instead of the SaveAs method of the CATDocumentServices class to keep link consistency especially when renaming documents.

Item is saved in the targeted directory only if:

This method allows also to export data coming from ENOVIA V5 or ENOVIA VPM V4 to a File directory.

Item not processed by this method:

This method performs a complete export if the targeted directory doesn't contain any of documents in session. This means that all items will be saved in the targeted directory even if they are not modified in session.

Notes

Parameters:
iDirectoryPath
The path where all session items will be saved. This path could be a directory path or a DLName. It must be accessible with write access.
oErrorMessage
The detailled error message filled if result is E_FAIL with the error InputERR_1108.

For other errors, same content as message associaded to returned error.

iListItemToRename
The list of items to rename. The list of new names is the iListOfNewNames. The two lists must have the same size.

If an item of the directory is not added in this list, the used default name will be the CATIA display name.

If items are not file based, but VPM or ENOVIA items, you must fill up iListItemToRename and iListOfNewNames.

iListOfNewNames
The list of new name for documents of iListItemToRename. Name should be file name (no DBCS) with correct extension and without any path. For example 'Part1.CATPart' or 'Part1'. 'C:\Part1.CATPart', 'Part\1' or 'Part*.Part' are not supported. If there is no extension, it is automatically added.

The size of iListDocToRename and iListOfNewNames must be exactly the same.

Returns:
  • S_OK: All items are successfully saved.
  • S_FALSE: Some items have not been saved (item modified by synchro and read only), warning message available in oErrorMessage parameter.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1009:
    • List of documents to rename and list of new names must have the same size.
    • InputERR_1106:
    • Invalid input directory.
    • InputERR_1107:
    • Some documents cannot been saved, impossible to process.
    • InputERR_1108:
    • Internal error, see oErrorMessage for more details.
    • InputERR_1110:
    • Two documents with same display name exist in session. Duplicated name is available in error message.
    • InputERR_1111:
    • Invalid file name, check that name does not contain specific characters and that extension is correct. Invalid name and item are available in error message.
    • InputERR_1118:
    • One item of iListItemToRename is not loaded. Item name is available in error message.
    • InputERR_1201:
    • File already exist, overwriten with different file is not allowed.
o SetExternalLinksStatus
public static HRESULT SetExternalLinksStatus(CATIxPDMItem_var& iPDMItem,
const CATBoolean iActivated)
Manages links activity of an item.
Role:This method retrieves all the external links of the given document, and activates (or deactivates) them.

Notice that only geometrical links support this activation notion. A deactivated link means that geometrical modifications are no more propagated through this link. The link still exists and is still taken into account in SendTo, CATxPDMFileServices.GetConsistentSet or CATxPDMFileServices.SearchRootItems .

Notice that this API is equivalent to Activate/Deactivate buttons in Edit/Links panel.

Save is necessary after a link status modification.

Parameters:
iPDMItem
The item to activate/deactivate its external links.
iActivated
The activation/deactivation status to set on links.
Returns:
  • S_OK: All external links of the given item are successfully activated/deactivated.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • The input item pointer is NULL.
    • InputERR_1004:
    • Internal error during the activation process.
    • InputERR_1007:
    • Error during the activation process of one specific link.
o SetInitialDocFileName
public static HRESULT SetInitialDocFileName(CATIxPDMItem_var& iPDMItem,
const CATUnicodeString& iInitialFileName)
Sets an initial file name on an item.
Role:This method valuate the initial item name. This method is available on item with "New" status, other items could be renamed only through CATxPDMSessionServices::SaveSessionToDirectory
Parameters:
iPDMItem
The item to set .
iInitialFileName
The initial file name to set on item.
Returns:
  • S_OK: The information is successfully refreshed.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1005:
    • The item is not loaded.
    • InputERR_1013:
    • The item has already been saved.
o SynchronizeAllExternalLinks
public static HRESULT SynchronizeAllExternalLinks(CATIxPDMItem_var& iPDMItem)
Synchronizes external links of an item.
Role:This method retrieves all the external links of the given document, and synchronizes them if they are loaded in session.
Only activated links are synchronized.

Notice that this API is equivalent to Synchronize button in Edit/Links panel.

Save is necessary after a synchronization.

Parameters:
iPDMItem
The item to synchonize its external links.
Returns:
  • S_OK: All external links of the given item are successfully synchronized.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • The input item pointer is NULL.
    • InputERR_1003:
    • Error during the synchronisation of one specific link.
    • InputERR_1004:
    • Internal error during the synchronisation process.
    • InputERR_1005:
    • The pointed item is not loaded.
o UnLoadItemFromSession
public static HRESULT UnLoadItemFromSession( const CATIxPDMItem_var& iItemToUnLoad)
Unloads an item from session.
Role:This method unloads an item from session.

This unload method can be used only is specific cases

In short, this method can be used only to clean a session, not for selective unloading in a Product Structure.

Parameters:
iItemToUnLoad
The item to unload from session.
Returns:
  • S_OK: Item successfully unloaded.
  • E_FAIL: The method has failed. The possible returned errors (listed by their identifier) are:
    • InputERR_1001:
    • The PX1 licence is not available.
    • InputERR_1002:
    • Not available on non loaded item.
    • InputERR_1004:
    • Internal error.

Enumerated Types


o ItemRefresh
enum ItemRefresh {
  All,
  ReadWrite,
  UnresolvedLinks
}
Item information to refresh in session.
Parameters:
All
All attributes will be refreshed, see next values for details.
ReadWrite
Read/Write or Read/Only status will be recomputed from file information. ReadOnly status is read at item opening and kept during the session, a ReadOnly item cannot be saved so this information should be refreshed in session before saving if you modify file right access.
UnresolvedLinks
To optimize performances, V5 try to resolved a link only once. So if pointed item is not found, link will keep broken status during all the session. If you add the necessary file on disk during session, refreshing this information will allow to solve link.
This method is equivalent to 'Refresh' button in Edit/Links.
Notice that this call doesn't refresh all applicative information so display status could still be wrong in some cases.
See also:
CATxPDMSessionServices.RefreshItemInformation

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

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