Wed, 08/28/2024 - 11:12
Hi,
in the example below shapes are written to STEP file and a name for the shape is set (written off the top of my head):
// read shape from BREP
BRep_Builder b;
TopoDS_Shape aShape;
BRepTools::Read(aShape, "C:/temp/shape.brep", b);
// write shape to STEP
STEPCAFControl_Writer aWriter;
Handle(TDocStd_Document) aDoc;
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( aDoc->Main() );
// uncomment next line and no name is written to STEP file anymore!
//Interface_Static::SetIVal("write.step.nonmanifold", 1);
TDF_Label aL = aSTool->AddShape(aShape); // add shape
TDataStd_Name::Set(aL, TCollection_ExtendedString("MY_NAME")); // add name
aWriter.Transfer(aDoc, STEPControl_StepModelType::STEPControl_AsIs);
aWriter.Write("C:/temp/shape.step");
The name occurs in the STEP file at #7
:
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('Open CASCADE Model'),'2;1');
FILE_NAME('Open CASCADE Shape Model','2024-08-28T09:26:22',('Author'),(
'Open CASCADE'),'Open CASCADE STEP processor 7.6','Open CASCADE 7.6'
,'Unknown');
FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));
ENDSEC;
DATA;
#1 = APPLICATION_PROTOCOL_DEFINITION('international standard',
'automotive_design',2000,#2);
#2 = APPLICATION_CONTEXT(
'core data for automotive mechanical design processes');
#3 = SHAPE_DEFINITION_REPRESENTATION(#4,#10);
#4 = PRODUCT_DEFINITION_SHAPE('','',#5);
#5 = PRODUCT_DEFINITION('design','',#6,#9);
#6 = PRODUCT_DEFINITION_FORMATION('','',#7);
#7 = PRODUCT('MY_NAME','MY_NAME','',(#8));
#8 = PRODUCT_CONTEXT('',#2,'mechanical');
#9 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design');
If the line //Interface_Static::SetIVal("write.step.nonmanifold", 1);
is uncommented, no name is written to STEP anymore. Why is that?
Thanks, Matthias
Attachments:
Wed, 09/04/2024 - 11:25
Hello, looks like as bug. I need to investigate. Could you please report a but into our bugtracker? https://tracker.dev.opencascade.org. Please unlogin from anonimus and login with your profile.
Best regards, Dmitrii.
Wed, 09/04/2024 - 14:01
https://tracker.dev.opencascade.org/view.php?id=33815
Thanks Dmitrii!