How to read UDA data by latest OCC7.8.0

Hello, I ues the sample given in the "New feature - STEP Import | User Defined Attributes", code as:
Handle(TDocStd_Document) aDoc = new TDocStd_Document("MDTV-XCAF");
Standard_CString filename = "E:\WorkSpace\metadataFile.stp";
STEPCAFControl_Reader reader;
reader.ReadFile(filename);
if(reader.Transfer(aDoc)){
std::cout << "Translate successful\n";
}else{
std::cout << "Translate failed\n";
}
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->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);
}
}

But it falied while using the transfer() function.
How to translate a stp file to document for parsing UDA data?
Any help is greatly appreciated. Thank you!

Dmitrii Pasukhin's picture

Hello, We need to have step file to help you. But us for Transfer error should be not related with UDA. Additionally please turn on the reader.SetMetaMode(true).

Could you share STEP file?

Best regards, Dmitrii.

Elle Edition's picture

Hello Dmitrii,
I paste the STEP file and my simple test code. Thank you for your help.

Dmitrii Pasukhin's picture

Firstly, your file have no any metadata. Additionally, there are no issue with read process. Your path is incorrect, \s means digital presentation of symbol, needs to use /s.

Please use: "E:/WorkSpace/metadataFile.stp";

Best regards, Dmitrii.

 

Elle Edition's picture

Thank you Dmitrii!
Now I can read the STEP file.
Yes, you are right, i mess up the definition of UDA data, and I check the STEP file again, this file do not include metadata. And I upload a new STEP file. I think this file might be right. So can i read the UDA data as shown in the picture?
Best regards, Elle.

Dmitrii Pasukhin's picture

Well, yes, theoretically you can extract, but this file has no UDA. Only view and material.

So, you need to find another file with UDA.

for example from ticket: http://davidemercanti.altervista.org/sources/1M001934.stp

Best regards, Dmitrii.

Elle Edition's picture

Hi Dmitrii,
Thank you so much for your generous assistance. I'm pleased to inform you that I am now able to read the STP file using OCC 7.8. I insert UDA failed while using other softwares, that's why my stp file has no UDA. Your help has been invaluable in resolving these issues. Once again, thank you tremendously for your support.
Best regards,
Elle

yd kim's picture

Dear Dmitrii,

Hello, I am a new in OpenCASCADE.
I am trying to read UDA as you suggested, but figured out that there is no SetMetaMode method in STEPCAFControl_reader class in 7.8.0 version. As I know SetMetaMode method exists in 7.8.2 version, which could be found in dev. Am I right?
(https://dev.opencascade.org/doc/refman/html/class_s_t_e_p_c_a_f_control_...)

If not, would be make more details how to use it?

Sincerely,
YD Kim

Dmitrii Pasukhin's picture

Yes, UDA available on latest master.

If you are using Windows, you can dowload package: https://github.com/Open-Cascade-SAS/OCCT/actions/runs/12109372359/artifa... and 3rd-party https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_8_0/3rdpar...

In case of other OS, you need to build manually.

Best regards, Dmitrii.

 

yd kim's picture

Dear Dmitrii,

Thank you for your response.

Whenever I try to access the first website, it leads me to here (https://github.com/Open-Cascade-SAS/OCCT/suites/31529127101/artifacts/22...) with an error code of 404, which says that the page is not found.
I know it is related to the actions, but I could not possibly access install-windows-x64 for download it.

Is the OCCT version on this website different from 7.8.1?

I would be grateful if you check it one more time.

Sincerely,
YD Kim

Attachments: 
Dmitrii Pasukhin's picture

My apologies, the links is a for downloading an artefact, probably it requiere some permissions. I will check it later. The link to all artefacts: Integration request to master · Open-Cascade-SAS/OCCT@3998181

GitHub master is a latest version that is named as a 7.8.2dev.

OCCT 7.8.1 or 7.8.0 do not contains UDA. Only master version have these functionality. And only 7.9 will have as an original release.

In case if you can't download - you can build manually, check the GH Action script: https://github.com/Open-Cascade-SAS/OCCT/blob/3998181768cf799e299a74e307...

Best regards, Dmitrii.