So, is it possible to read it in Mesh and export it in Step? If so, please tell me how
Code :
myXdeDoc = new TDocStd_Document("MDTV-XCAF");
STEPCAFControl_Reader reader;
reader.ReadFile(toAsciiString(fileName).ToCString());
reader.SetMatMode(true);
if (reader.Transfer(myXdeDoc)) {
std::cout << "Translate successful\n";
}
else {
std::cout << "Translate failed\n";
}
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(myXdeDoc->Main());
NCollection_IndexedDataMap<TCollection_AsciiString, Handle(TDataStd_NamedData)> aNameDataMap; // Container to keep label's entry and its metadata
for (TDF_ChildIterator anIter(aShapeTool->Label(), Standard_True); anIter.More(); anIter.Next())
{
const TDF_Label& aLabel = anIter.Value();
TCollection_AsciiString anEntry;
TDF_Tool::Entry(aLabel, anEntry);
Handle(TDataStd_NamedData) aNamedData = aShapeTool->GetNamedProperties(aLabel);
if (!aNamedData.IsNull())
{
aNameDataMap.Add(anEntry, aNamedData);
}
Handle(XCAFPrs_AISObject) aPrs = new XCAFPrs_AISObject(aLabel);
myAISContext()->Display(aPrs, AIS_WireFrame, 1, false);
Fri, 10/25/2024 - 11:54
Hello.
Please take a look into documentation:
step · Open-Cascade-SAS/OCCT Wiki or de_wrapper · Open-Cascade-SAS/OCCT Wiki or xde · Open-Cascade-SAS/OCCT Wiki
https://github.com/Open-Cascade-SAS/OCCT/wiki/visualization#examples-cre...
Best regards, Dmitrii
Tue, 10/29/2024 - 03:28
So, is it possible to read it in Mesh and export it in Step? If so, please tell me how
Code :
myXdeDoc = new TDocStd_Document("MDTV-XCAF");
STEPCAFControl_Reader reader;
reader.ReadFile(toAsciiString(fileName).ToCString());
reader.SetMatMode(true);
if (reader.Transfer(myXdeDoc)) {
std::cout << "Translate successful\n";
}
else {
std::cout << "Translate failed\n";
}
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(myXdeDoc->Main());
NCollection_IndexedDataMap<TCollection_AsciiString, Handle(TDataStd_NamedData)> aNameDataMap; // Container to keep label's entry and its metadata
for (TDF_ChildIterator anIter(aShapeTool->Label(), Standard_True); anIter.More(); anIter.Next())
{
const TDF_Label& aLabel = anIter.Value();
TCollection_AsciiString anEntry;
TDF_Tool::Entry(aLabel, anEntry);
Handle(TDataStd_NamedData) aNamedData = aShapeTool->GetNamedProperties(aLabel);
if (!aNamedData.IsNull())
{
aNameDataMap.Add(anEntry, aNamedData);
}
Handle(XCAFPrs_AISObject) aPrs = new XCAFPrs_AISObject(aLabel);
myAISContext()->Display(aPrs, AIS_WireFrame, 1, false);
}
myView()->FitAll(0.01, false);
Tue, 10/29/2024 - 12:43
In your case after Display model automatically meshed. But you can mesh manually:
Export is the same as import.
Best regardsm Dmitrii.
Thu, 10/31/2024 - 01:31
Thank you for your reply.
have a good day
Fri, 10/25/2024 - 12:53
Here you may also find another introduction article with code sample displaying XCAF shape.
Tue, 10/29/2024 - 04:00
Thank you for your reply.