XCAFApp_Application with an existing document

I found example to create document and add shapes structure to it:

Handle(XCAFApp_Application) anApp = wxGetApp().GetOCCApp();
Handle(TDocStd_Document) aDoc;
anApp->NewDocument ("XmlXCAF", aDoc);
Handle (XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
TDF_Label aLabel = myAssembly->NewShape();
myAssembly->SetShape(aLabel,aBottle);
... and so on

now in a different class (say a tree-view class), how do I retrieve the handle to this document?
Handle(XCAFApp_Application) anApp = wxGetApp().GetOCCApp();
Handle(TDocStd_Document) aDoc;
anApp->GetDocument (...aDoc...?); ??

mfregeau's picture

I got it:

anApp->GetDocument(1,aDoc);