Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STEP export: Support overriding header metadata #1396

Open
ubruhin opened this issue Sep 1, 2023 · 0 comments
Open

STEP export: Support overriding header metadata #1396

ubruhin opened this issue Sep 1, 2023 · 0 comments
Labels
enhancement New feature or request OCC feature Requires coding at OCC implementation level

Comments

@ubruhin
Copy link

ubruhin commented Sep 1, 2023

When exporting STEP files like that (an assembly in my case):

assembly = cq.Assembly(name='foo')
# assembly.add(...)
assembly.save('out.step', 'STEP')

The exported file contains some metadata in the header:

FILE_DESCRIPTION(('Open CASCADE Model'),'2;1');
FILE_NAME('Open CASCADE Shape Model','2023-09-01T11:49:38',('Author'),(
    'Open CASCADE'),'Open CASCADE STEP processor 7.7','Open CASCADE 7.7'
  ,'Unknown');

It would be nice to make this medatada configurable. The most important part for us is the timestamp to allow generating deterministic output from librepcb-parts-generator, but of course it would also make sense to override other metadata.

In C++ I do it like that (it works for me, but I'm not an OCC expert):

STEPCAFControl_Writer writer;
writer.SetColorMode(Standard_True);
writer.SetNameMode(Standard_True);

APIHeaderSection_MakeHeader hdr(writer.ChangeWriter().Model());
hdr.SetDescriptionValue(1, new TCollection_HAsciiString("PCB Assembly"));
hdr.SetName(new TCollection_HAsciiString("my project"));
hdr.SetAuthorValue(1, new TCollection_HAsciiString(""));
hdr.SetOrganizationValue(1, new TCollection_HAsciiString(""));
hdr.SetOriginatingSystem(new TCollection_HAsciiString("LibrePCB"));
hdr.SetTimeStamp(new TCollection_HAsciiString("2000-01-01T00:00:00"));

Links to OCCT documentation:

@ubruhin ubruhin added enhancement New feature or request OCC feature Requires coding at OCC implementation level labels Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request OCC feature Requires coding at OCC implementation level
Projects
None yet
Development

No branches or pull requests

1 participant