Skip to content

Instantly share code, notes, and snippets.

@jeromerobert
Created March 24, 2020 18:00
Show Gist options
  • Save jeromerobert/7635e1ff4f209f3862a80b5abbcfd5e2 to your computer and use it in GitHub Desktop.
Save jeromerobert/7635e1ff4f209f3862a80b5abbcfd5e2 to your computer and use it in GitHub Desktop.

Revisions

  1. jeromerobert created this gist Mar 24, 2020.
    13 changes: 13 additions & 0 deletions setname.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #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));
    }