New feature - STEP Import | User Defined Attributes

Dear OCCT Community,

We are excited to announce a significant update to the OpenCASCADE Technology (OCCT). Our development team has introduced new functionality for STEP Import - User Defined Attributes (UDA, Metadata, property), which is now available in the latest master, CR0-WEEK-7.

The official recommended practices for STEP UDA can be found here.

This update addresses various issues reported by the community. One notable bugfix is detailed in the OCCT bugtracker issue: 33530.

Below, you can see the result of importing some STEP files:

STEP Import Result 1
STEP Import Result 2

Imported metadata is available only in XCAF reading. Metadata is stored as a TDataStd_NamedData(key-values) attribute attached to the Shape label.

This enhancement opens up several possibilities for users:

  • Custom Data Annotation: Users can now annotate STEP files with custom metadata, facilitating better organization and documentation of CAD models.
  • Workflow Automation: Automated processing of STEP files becomes more versatile with the ability to import, streamlining various engineering workflows.
  • Interoperability: Enhanced support for STEP metadata improves interoperability with other CAD software that utilize STEP format, fostering collaboration among different engineering teams.

To dump available metadata in DRAWEXE, you can use the following command (the code located in src\XDEDRAW\XDEDRAW_Shapes.cxx XGetProperties):

# Prints named properties assigned to all document's shape labels or chosen labels of shapes
XGetProperties Doc [label1, label2, ...] [shape1, shape2, ...]

To extract imported metadata by C++ code, you can use the following sample:

Handle(TDocStd_Document) aDoc = ...;
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);
  }
}

Moreover, we are actively working on additional features for the upcoming OCCT 7.9 release, including:

  • Importing metadata from GLTF files
  • Exporting metadata into STEP files

We believe these enhancements will further empower our community to leverage OCCT for various engineering and design tasks. Your feedback and contributions are invaluable as we continue to improve OCCT and support the needs of our users.

Best regards,
The OCCT Development Team.