1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0023384: Translate sub-shape names between XDE document and STEP

Sub-shapes naming translation between XDE and STEP implemented as an optional mode of Reader/Writer.
New static variables are now available: write.stepcaf.subshapes.name for Writer and read.stepcaf.subshapes.name for Reader (both have 0 values by default).
XOpen command implemented in scope of XDEDRAW asset.

Added test case bugs xde CR23384
This commit is contained in:
apn
2012-09-07 13:03:39 +04:00
committed by ssv
parent 9fe1ada847
commit 02a0b964f2
6 changed files with 459 additions and 7 deletions

View File

@@ -77,6 +77,7 @@
#include <TColStd_HSequenceOfTransient.hxx>
#include <TDF_Tool.hxx>
#include <Message_Messenger.hxx>
#include <TDF_ChildIterator.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_TransientListBinder.hxx>
@@ -544,6 +545,45 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
// refresh graph
writer.WS()->ComputeGraph ( Standard_True );
/* ================================
* Write names for the sub-shapes
* ================================ */
if ( Interface_Static::IVal("write.stepcaf.subshapes.name") )
{
Handle(XSControl_TransferWriter) TW = this->ChangeWriter().WS()->TransferWriter();
Handle(Transfer_FinderProcess) FP = TW->FinderProcess();
for ( int i = 1; i <= labels.Length(); i++ )
{
TDF_Label L = labels.Value(i);
for ( TDF_ChildIterator it(L, Standard_True); it.More(); it.Next() )
{
TDF_Label SubL = it.Value();
// Access name recorded in OCAF TDataStd_Name attribute
Handle(TCollection_HAsciiString) hSubName = new TCollection_HAsciiString;
if ( !GetLabelName(SubL, hSubName) )
continue;
// Access topological data
TopoDS_Shape SubS = XCAFDoc_ShapeTool::GetShape(SubL);
if ( SubS.IsNull() )
continue;
// Access the correspondent STEP Representation Item
Handle(StepRepr_RepresentationItem) RI;
Handle(TransferBRep_ShapeMapper) aShMapper = TransferBRep::ShapeMapper(FP, SubS);
if ( !FP->FindTypedTransient(aShMapper, STANDARD_TYPE(StepRepr_RepresentationItem), RI) )
continue;
// Record the name
RI->SetName(hSubName);
}
}
}
return Standard_True;
}