3D PLM PPR Hub Open Gateway

Product Modeler

Frequently Asked Questions

Quick Reference

Abstract

Here is a quick-access list of FAQs we have received from CAA partners as well as DS internal developers. Whenever possible in the answers, links to pertinent documents or use cases are provided for more detailed information.

How can I get a pointer to the document containing my Product?

How can I retrieve a pointer to the root product of my Product document?

I am in a CATIA interactive session in a Product document. I add a new product to my product structure using CATIProduct::AddProduct. The visualization and specs tree are not updated automatically. What should I do?


How can I get a pointer to the document containing my Product?

Use the CATILinkableObject interface of the ObjectModelerBase framework. Follow these steps:

CATIProduct *piProduct = ...
CATILinkableObject *piLinkableOnProduct = NULL;
HRESULT rc = piProduct -> QueryInterface(IID_CATILinkableObject,(void**)&piLinkableOnProduct);
if (SUCCEEDED(rc))
{
   CATDocument *pDoc = piLinkableOnProduct -> GetDocument();
}

How can I retrieve a pointer to the root product of my Product document?

You need to use the CATIDocRoots interface of the ObjectModelerBase framework. Here is the code to do this:

CATIDocRoots *piDocRootsOnDoc = NULL;
rc = pDoc -> QueryInterface(IID_CATIDocRoots,(void**)&piDocRootsOnDoc);
if ( FAILED(rc) ) return 1;

// get the root product which is the first element of the list returned by GiveDocRoots
CATListValCATBaseUnknown_var* pRootProducts = piDocRootsOnDoc -> GiveDocRoots();
CATIProduct_var spRootProduct = NULL_var;
if (pRootProducts->Size())
{
  spRootProduct = (*pRootProducts)[1];
  delete pRootProducts;
  pRootProducts = NULL;
}
piDocRootsOnDoc->Release();

In the above code, you can see that a CATIDocRoots pointer is first retrieved on the Product document. Using the GiveDocRoots method of CATIDocRoots, you can then retrieve a list whose first element is the root product. See the "Browsing a Product Structure" use case for more details.

I am in a CATIA interactive session in a Product document. I add a new product to my product structure using CATIProduct::AddProduct. The visualization and specs tree are not updated automatically. What should I do?

You must send the visualization and specs tree navigation events yourself. Here is the code needed to do this:

//Update the 3D view
CATIModelEvents_var spEvents = RootProduct;
CATModify ModifyEvent(RootProduct);
spEvents -> Dispatch (ModifyEvent);

//Update the graph view
CATIRedrawEvent_var spRedraw = RootProduct;
spRedraw -> Redraw();


History

Version: 1 [February 2002] Document created
[Top]

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