I'm facing an issue when trying to access to currently opened CATDocument of an already opened CATIA session.
What I have:
- A pointer to a CATIAApplication object:
CLSID clsid;
HRESULT hr = CLSIDFromProgID(L"CATIA.Application", &clsid);
CComPtr<IUnknown> pCatiaSession;
hr = GetActiveObject(clsid, NULL, &pCatiaSession);
CATIAApplication * pApp = NULL;
hr = pSession->QueryInterface(IID_CATIAApplication, (void**) &pApp);
CATIADocument * pDocument = NULL;
hr = pApp->get_ActiveDocument(pDocument);
What I need: a pointer to a CATDocument, to be able to work on the product structure.
I tried to retrieve the path of the CATIADocument, and then reopen it with CATDocumentServices::Open
, but the product was loaded a second time in some kind of ghost session because nothing is visible, as in a batch mode. I also tried to use CATDocumentServices, CATSessionServices and CATSession methods, but nothing does the trick...