3D PLM PPR Hub Open Gateway |
Product Modeler |
Integration with ENOVIA LCAOptimal CATIA PLM Usability |
Technical Article |
ENOVIA LCA allows documents to be stored in two different modes:
In Exposed mode, CATIA might not be able to operate properly as it will lose the documents once they are stored. To prevent this from happening, the application must detect the active ENOVIA storage mode and disable commands that lead to incompatible situations.
One possible way of dealing with this problem is to have the Command Header decides whether the command is available or not depending on the ENOVIA storage mode. In this article we will show an example of how this could be done with the CATIPrdPLMPersistency interface.
A document storage mode is available through the CATIPrdPLMPersistency interface whose get_PersistencyMode method returns:
Thus when the active mode returned is not WorkpackageOrFile, CATIA commands that depend on this mode should be disabled.
In this example, the purpose of the Command Header is to retrieve the active ENOVIA storage mode and then enable or disable the command accordingly.
This CAAPuiPrsConfigAddinHeader command header class is part of the Adding a Toolbar to the Product Structure Workbench use case. More detailed information on command headers can be found in the The Command Headers article.
class CAAPuiPrsConfigAddinHeader : public CATCommandHeader { CATDeclareKindOf; CATDeclareHeaderResources; public: CAAPuiPrsConfigAddinHeader(const CATString & HeaderID, const CATString & loadName, const CATString & classname, void * argument, int state = CATFrmAvailable); CATCommandHeader *Clone(); virtual ~CAAPuiPrsConfigAddinHeader(); protected: CAAPuiPrsConfigAddinHeader(CATCommandHeader *header); void UpdateAvailability(); void AddUIActivatedCallback(); void RemoveUIActivatedCallback(); void UIActivated(CATCallbackEvent, void *, CATNotification *, CATSubscriberData, CATCallback); CATFrmEditor *_FrmEditor; CATCallback _UIActivatedCallback; }; |
The CAAPuiPrsConfigAddinHeader class derives from the CATCommandHeader. The main idea is to setup a callback for when the command is about to be activated. This callback with check the ENOVIA LCA storage mode and enable/disable the command accordingly.
Member |
Purpose |
CAAPuiPrsConfigAddinHeader constructor | Install the callback Update command availability |
CAAPuiPrsConfigAddinHeader destructor | Remove the callback |
Clone | Needed for command header duplication (see [2]) |
UpdateAvailability | Check document storage mode and update command availability |
AddUIActivatedCallback | Install the UIActivated callback |
RemoveUIActivatedCallback | Remove the UIActivated callback |
UIActivatedCallback | The callback: update command availability |
The goal of this method is to check the storage mode of the active document.
void CAAPuiPrsConfigAddinHeader::UpdateAvailability() { if (NULL == _FrmEditor) return; // // Get current active product // CATPathElement activePath = _FrmEditor->GetUIActiveObject(); CATIProduct *activeProduct = (CATIProduct *) activePath.SearchObject(CATIProduct::ClassName()); if (NULL == activeProduct) return; // // Query its PersistencyMode // CATIProduct_var spRefProd = activeProduct->GetReferenceProduct(); activeProduct->Release(); activeProduct = NULL; if (NULL_var == spRefProd) return; CATILinkableObject_var spLink(spRefProd); if (NULL_var == spLink) return; CATDocument *pDoc = spLink->GetDocument(); if (NULL == pDoc) return; CATIPrdPLMPersistency_var spPrdPLMPers(pDoc); CATIPrdPLMPersistency::PersistencyMode mode; ... |
If the storage mode cannot be retrieved or if it is not CATIPrdPLMPersistency::WorkpackageOrFile then the command is disabled by calling BecomeUnavailable. Otherwise the command is enabled with BecomeAvailable.
... if (NULL_var != spPrdPLMPers && SUCCEEDED(spPrdPLMPers->get_PersistencyMode(mode)) && mode == CATIPrdPLMPersistency::WorkpackageOrFile) { // // Enable only if workpackage/file mode // BecomeAvailable(); } else { // // Disable otherwise // BecomeUnavailable(); } } |
This article has shown how to avoid incompatibilities when CATIA is used with ENOVIA LCA:
[1] | Adding a Toolbar to the Product Structure Workbenchl |
[2] | The Command Headers |
[Top] |
Version: 1 [Feb 2004] | Document created |
[Top] |
Copyright © 2004, Dassault Systèmes. All rights reserved.