How to add Name to a shape

We can use Handle(XCAFDoc_ShapeTool) and Handle(TDataStd_Name) to read a name of shape from doc,

but how to add a name to a shape? or add an Attribute to a shape? 

Hugues Delorme's picture


    Provided you have a TDF_Label that points to the shape, you can use TDataStd_Name::Set() for this.

weiguibai_144554's picture

Thank you,I have completed it by your method!

2265636806_166500's picture


 if I add a name to shape(like face) use TDataStd_Name::Set()  ,and then how to write to STEP file.

Entity Names can be attached to every Geometric Entity.   Why I can't?

Hope to help me, thanks.