For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

XCAFApp_Application with an existing document

Mimosa Olive's picture
Forums: 

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...?); ??

Mimosa Olive's picture

I got it:

anApp->GetDocument(1,aDoc);