Skip to content

Instantly share code, notes, and snippets.

@jeromerobert
Created March 24, 2020 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeromerobert/7635e1ff4f209f3862a80b5abbcfd5e2 to your computer and use it in GitHub Desktop.
Save jeromerobert/7635e1ff4f209f3862a80b5abbcfd5e2 to your computer and use it in GitHub Desktop.
OpenCASCADE: Set the name of a TopoDS_Shape in a .step file
#include <STEPControl_Writer.hxx>
#include <STEPConstruct.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSControl_TransferWriter.hxx>
#include <StepRepr_RepresentationItem.hxx>
#include <TCollection_HAsciiString.hxx>
/** Set the name of a TopoDS_Shape in a .step file */
void setName(STEPControl_Writer & writer, const TopoDS_Shape & shape, const char * name) {
auto fp = writer.WS()->TransferWriter()->FinderProcess();
auto repr = STEPConstruct::FindEntity(fp, shape);
repr->SetName(new TCollection_HAsciiString(name));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment