Wed, 12/13/2023 - 02:43
I tried the following but failed. Could you please give me an example of how to import an .OBJ file? please.
Handle(TDocStd_Application) anXdeApp = new TDocStd_Application();
BinXCAFDrivers::DefineFormat(anXdeApp); // to load XBF files
Handle(TDocStd_Document) anXdeDoc;
anXdeApp->NewDocument("XDE", anXdeDoc);
OSD::SetSignal(false); // catch signals
// read and translate STEP file into XCAF document
RWObj_CafReader aReader;
aReader.Perform(theFileName, Message_ProgressRange());
aReader.SetDocument(anXdeDoc);
TDF_Label mainLable = anXdeDoc->Main();
Handle(XCAFDoc_ShapeTool) myShapeTool = XCAFDoc_DocumentTool::ShapeTool(mainLable);
Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool(mainLable);
TDF_LabelSequence FreeShape;
myShapeTool->GetFreeShapes(FreeShape);
int Roots = FreeShape.Length();
for (int i = 1; i <= Roots; i++)
{
TDF_Label label = FreeShape.Value(i);
Handle(XCAFPrs_AISObject) displayedShape = new XCAFPrs_AISObject(label);
myAISContext()->Display(displayedShape, true);
}
Wed, 12/13/2023 - 13:38
Hello.
The problem is you put document after read process. Set document need to be done before Perform.
We a going to move on DE_Wrapper functionality. You are free to use next code:
Documentation is available on our site. Open CASCADE Technology: Data Exchange Wrapper (DE_Wrapper).
Best regards, Dmitrii.
Thu, 12/14/2023 - 03:39
thank you, junwun kim