如何访问已打开的现有 CATIA 会话的 CATDocument?

How to get access to the already opened CATDocument of an existing CATIA session?

提问人:Nicolas Chevalier 提问时间:10/13/2023 更新时间:10/13/2023 访问量:106

问:

我在尝试访问已打开的 CATIA 会话的当前打开的 CATDocument 时遇到问题。

我有什么:

  • 指向 CATIAApplication 对象的指针:
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);

我需要什么: 指向 CATDocument 的指针,以便能够处理产品结构。

我试图检索 CATIADocument 的路径,然后用 重新打开它,但是在某种幽灵会话中第二次加载了产品,因为什么都不可见,就像在批处理模式下一样。我还尝试使用 CATDocumentServices、CATSessionServices 和 CATSession 方法,但没有任何效果......CATDocumentServices::Open

C++ CATIA CAA

评论

0赞 Disvoys 10/15/2023
#include “CATDocument.h” CATDocument *pDocument = NULL;pApp->get_ActiveDocument(&p文档);maruf.ca/files/caadoc/CAAMmrTechArticles/......相同的结果?
0赞 Nicolas Chevalier 10/17/2023
get_ActiveDocument将检索 CATIADocument,而不是 CATDocument。CATDocument 不是接口,因此它不能被强制转换(当然也不会从它继承)。

答: 暂无答案