Skip to content

0033896 - STEP Write - General Attributes#634

Merged
dpasukhi merged 11 commits into
Open-Cascade-SAS:IRfrom
petrasvestartas:0033896
Aug 12, 2025
Merged

0033896 - STEP Write - General Attributes#634
dpasukhi merged 11 commits into
Open-Cascade-SAS:IRfrom
petrasvestartas:0033896

Conversation

@petrasvestartas
Copy link
Copy Markdown
Contributor

@petrasvestartas petrasvestartas commented Jul 21, 2025

Aim

The aim of this pull request is to add support for writing simple string attributes to STEP geometries. Currently, it is only possible to define labels and colors; however, object attributes are missing. Issue created with more details and discussion with @dpasukhi : https://tracker.dev.opencascade.org/view.php?id=33896

Use case:

  Handle(TDataStd_NamedData) wheelMetadata = TDataStd_NamedData::Set(wheelProto.label);
  wheelMetadata->SetString("COMPAS_wheel_metadata_1", "My Awesome metadata! 1");
  wheelMetadata->SetString("COMPAS_wheel_metadata_2", "My Awesome metadata! 2");

I have tried this workflow on Ubuntu using this example.zip. Explanation how to build and run this example is recorded in the video from minute 09:30: https://youtu.be/4pvzx5mxOYA?feature=shared&t=570 . Result is visible on the right side of this image under window called Properties:

image

@dpasukhi dpasukhi added 2. Enhancement New feature or request 1. Data Exchange Import/Export or iterating of the CAD data labels Jul 21, 2025
@dpasukhi dpasukhi linked an issue Jul 21, 2025 that may be closed by this pull request
@dpasukhi dpasukhi added this to the Release 8.0 milestone Jul 21, 2025
@petrasvestartas
Copy link
Copy Markdown
Contributor Author

@dpasukhi

How to ask for a review?

@dpasukhi
Copy link
Copy Markdown
Member

PR which is not a draft, automatically means ready to review.
Tomorrow I will test, validate export and review.
Thank you for patch

@dpasukhi dpasukhi requested review from Copilot and dpasukhi July 21, 2025 17:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements support for writing string metadata attributes to STEP geometries. Currently, STEP writers only support labels and colors, but this enhancement allows writing custom object attributes stored as NamedData.

  • Adds metadata writing capability through new MetadataMode flag and writeMetadata method
  • Exports string metadata as STEP property_definition entities linked to product definitions
  • Integrates metadata writing into the main transfer workflow alongside existing property writing

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
STEPCAFControl_Writer.hxx Adds metadata mode flag, getter/setter methods, and writeMetadata method declaration
STEPCAFControl_Writer.cxx Implements metadata writing functionality with STEP entity creation and model integration
DESTEP_Parameters.hxx Adds WriteMetadata parameter to control metadata export behavior

bool WriteName = true; //<! NameMode is used to indicate write Name or not
bool WriteLayer = true; //<! LayerMode is used to indicate write Layers or not
bool WriteProps = true; //<! PropsMode is used to indicate write Validation properties or not
bool WriteMetadata = true; //<! MetadataMode is used to indicate write validation properties.
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment incorrectly states 'write validation properties' but should describe writing metadata properties. The comment should be updated to match the actual functionality: 'MetadataMode is used to indicate write metadata properties or not'.

Suggested change
bool WriteMetadata = true; //<! MetadataMode is used to indicate write validation properties.
bool WriteMetadata = true; //<! MetadataMode is used to indicate write metadata properties or not.

Copilot uses AI. Check for mistakes.
Comment thread src/DataExchange/TKDESTEP/STEPCAFControl/STEPCAFControl_Writer.cxx
Comment on lines +1668 to +1669
Handle(TCollection_HAsciiString) aPropDesc =
new TCollection_HAsciiString("Metadata property");
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The hardcoded description 'Metadata property' should be made configurable or more descriptive. Consider using the key name in the description or making it a parameter to provide more meaningful STEP file content.

Suggested change
Handle(TCollection_HAsciiString) aPropDesc =
new TCollection_HAsciiString("Metadata property");
TCollection_AsciiString aDynamicDesc("Metadata property: ");
aDynamicDesc += aKey.ToCString();
Handle(TCollection_HAsciiString) aPropDesc =
new TCollection_HAsciiString(aDynamicDesc);

Copilot uses AI. Check for mistakes.
@dpasukhi
Copy link
Copy Markdown
Member

Do not rely or look on review of copilot. It is just for me to detect something hidden.

@petrasvestartas
Copy link
Copy Markdown
Contributor Author

Thank you :)

@dpasukhi dpasukhi changed the base branch from master to IR July 22, 2025 12:28
@petrasvestartas
Copy link
Copy Markdown
Contributor Author

Ping :)

@dpasukhi
Copy link
Copy Markdown
Member

Yes, review still on Todo. At the moment can't have a deep review according STEP ISO and manual resting.
It is required focus, others patches I'm doing while I'm on calls)

@dpasukhi dpasukhi requested a review from AtheneNoctuaPt July 30, 2025 07:59
@dpasukhi dpasukhi added the 3. CLA waited User need to process with CLA before review or integration processes label Jul 30, 2025
@dpasukhi
Copy link
Copy Markdown
Member

Dear @petrasvestartas

Thank you for your patch. To proceed with integration, please complete signing CLA process:
The links: Contribution Guide
Or https://dev.opencascade.org/get_involved

In case if you already have signed CLA, please share ID that OCCT team shared with your by email after accepting of CLA.

@petrasvestartas
Copy link
Copy Markdown
Contributor Author

I have just filled the form and uploaded.

I guess, I need to wait for confirmation.

@dpasukhi dpasukhi added 3. CLA approved User has the signed CLA and ready to review or integration processes and removed 3. CLA waited User need to process with CLA before review or integration processes labels Jul 30, 2025
@dpasukhi
Copy link
Copy Markdown
Member

dpasukhi commented Jul 30, 2025

I have just filled the form and uploaded.

I guess, I need to wait for confirmation.

Thank you. The only 1 missed, please put "x" in place that you signing on behalf of yourself. If it is not difficult, please send one more time the form with that update.
In meantime Dmitrii (Noctua) is working on your ticket with ISO validation.

@petrasvestartas
Copy link
Copy Markdown
Contributor Author

I have made the update on the form, and sent it.

@dpasukhi
Copy link
Copy Markdown
Member

dpasukhi commented Aug 5, 2025

My apologies for the delays.
Dmitrii (Noctua) complete internal review. The code have some difference from ISO.
Dmitrii will fix and update them, and also extend testing.
Unfortunately, current month is overbooked for de team. My apologies.
Your PR in our high to-do list.
Link to documentation: Version 1.8 https://www.mbx-if.org/home/wp-content/uploads/2024/05/rec_prac_user_def_attributes_v18.pdf

Added general_property and general_property_association entities to
comply with recommended practices.
Changed property_definition description to "user defined attribute" to
comply with recommended prectices.
Added support of writing integer and real metadata items.
Added WriteMetadata parameter to DESTEP_Parameters.
Tests group metadata/step is updated to check for written metadata.
@github-project-automation github-project-automation Bot moved this from Todo to Integration in Maintenance Aug 8, 2025
@dpasukhi dpasukhi merged commit 91000c4 into Open-Cascade-SAS:IR Aug 12, 2025
23 checks passed
@github-project-automation github-project-automation Bot moved this from Integration to Done in Maintenance Aug 12, 2025
@petrasvestartas
Copy link
Copy Markdown
Contributor Author

petrasvestartas commented Aug 12, 2025

Thank you!

What IR branch stands for?

@dpasukhi
Copy link
Copy Markdown
Member

IR branch is a weekly/biweekly collection of patches. Used to collect a few ticket and then have a huge testing on all of them.
It is some optimization of testing and also some space to validate logic and revert some commits with force updates.

@petrasvestartas
Copy link
Copy Markdown
Contributor Author

Wow, OCCT has serious testing before production code. It is nice to see this in action!

@dpasukhi
Copy link
Copy Markdown
Member

We have commercial repositories of projects and some clients tests which must to perform before integration.

@paulbuechner
Copy link
Copy Markdown

@dpasukhi Hey Dmitry, will this feature be only available with v8 or is it available in the latest release?

@dpasukhi
Copy link
Copy Markdown
Member

@paulbuechner The STP metadata export is available in 8.0.0.rc2 and latest master.
Import is available in 7.9.0 already.

@paulbuechner
Copy link
Copy Markdown

@paulbuechner The STP metadata export is available in 8.0.0.rc2 and latest master.

Import is available in 7.9.0 already.

By any chance, do you have some portfiles and patches lying around for the RC versions to load them via vcpkg, or are the current ones still applicable?

@dpasukhi
Copy link
Copy Markdown
Member

Well, for RC VCPKG is quite complicated.
I fully redesign the vcpkg approach and now all CI/CD is rely on custom VCPKG port. I guess you can check what is inside the GitHub actions and make your custom port.
Only in February I will patch the official VCPKG repo with new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Data Exchange Import/Export or iterating of the CAD data 2. Enhancement New feature or request 3. CLA approved User has the signed CLA and ready to review or integration processes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

STEP Export - Metadata support (General properties)

5 participants