Link one document to another

Dear All,

I want to insert an existing document to the current document. What I expect is the gemetric model in the inserted document will be displayed and it also will be list in the OCAF tree inn the current document.

I tried the function TDocStd_XLinkTool as indicated in the application framework user's guide:

// open the document in the current application
Handle_TDocStd_Document labDocRef;
CDF_RetrievableStatus RS = m_App->Open(TPath,DocRef);

Handle(TDocStd_Document) DocCur = GetDocument()->GetOCAFDoc();

TDF_Label source = DocCur->Main();
TDF_Label target = DocRef->Main();
TDocStd_XLinkTool XLinkTool;

XLinkTool.Copy(target, source);

And I haven't got what I want. Does anyone know how to implement it?
I appreciate your help very much!


Dirk B's picture

Hi Chris!
I had the same problem. I copied the code from TDocStd_XLinkTool::Copy, and filled the TDF_DataSet with labels below 0:1:1, 0:1:2, ... and the TDF_RelocationTable with the labels below 0:1:1, 0:1:2, ... and newly created labels on the target doc. As far as I can tell this works fine.