1. Introduction to XDE Component
3. Example
void COCCmfcMDIDoc::ReadSTEP(){ // Create document Handle(TDocStd_Document) doc; XCAFApp_Application::GetApplication()->NewDocument("MDTV-XCAF", doc); // Load file (.step) STEPCAFControl_Reader myReader; myReader.ReadFile("hezi.STEP"); myReader.SetColorMode(true); myReader.SetNameMode(true); myReader.SetLayerMode(true); myReader.Transfer(doc); TDF_Label mainLabel = doc->Main(); // To get the node considered as an assembly from the XDE structure, you can use the node's Label (shape) Handle(XCAFDoc_ShapeTool) myShapeTool = XCAFDoc_DocumentTool::ShapeTool(mainLabel); // Query, edit, or initialize the document to handle XCAF colors (OCCT no longer uses this method to render models) Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(mainLabel); TDF_LabelSequence FreeShape; myShapeTool->GetFreeShapes(FreeShape);// Use GetFreeShapes to solve assembly and component display issues //myShapeTool->GetShapes(FreeShape); // Get names corresponding to assemblies and components (not applicable) int Roots = FreeShape.Length(); for (int index = 1; index <= Roots; index++) { TDF_Label label = FreeShape.Value(index); // Use XCAFPrs_AISObject to display Handle(XCAFPrs_AISObject) displayedShape = new XCAFPrs_AISObject(label); myAISContext->Display(displayedShape, true); }}

Want to learn more
Quickly scan the code to follow