CATIProductからCATDocumentを取得するには、
以下の方法で取得する。
// spProdはCATIProductのスマートポインタ CATILinkableObject * pLinkableObj = NULL; HRESULT rc = spProd->QueryInterface(IID_CATILinkableObject, (void**)&pLinkableObj); if (SUCCEEDED(rc) && pLinkableObj != NULL) { CATDocument * pDoc = pLinkableObj->GetDocument(); { if (pDoc != NULL) { // CATDocumentの取得成功 } } }
トップ以外のProductを取得する場合は、
CATIProduct::GetReferenceProduct()を使用する必要がある。
※ReferenceProductを使用していない場合、
取得されるCATDocumentはトッププロダクトのDocumentとなる
CATIProduct_var spRefProd = spProd->GetReferenceProduct(); CATILinkableObject * pLinkableObj = NULL; HRESULT rc = spRefProd->QueryInterface(IID_CATILinkableObject, (void**)&pLinkableObj); ・ ・ ・