// get name
Handle(TCollection_HAsciiString) hName = new TCollection_HAsciiString;
- if ( ! GetLabelName (L, hName) ) continue;
-// Handle(TDataStd_Name) N;
-// if ( ! L.FindAttribute ( TDataStd_Name::GetID(), N ) ) continue;
-// TCollection_ExtendedString name = N->Get();
-// if ( name.Length() <=0 ) continue;
-
- // find target STEP entity for the current shape
-// TopoDS_Shape S;
-// if ( ! XCAFDoc_ShapeTool::GetShape ( L, S ) ) continue;
- if ( ! myLabels.IsBound ( L ) ) continue; // not recorded as translated, skip
- TopoDS_Shape S = myLabels.Find ( L );
+ if (GetLabelName (L, hName))
+ {
+ // find target STEP entity for the current shape
+ if ( ! myLabels.IsBound ( L ) ) continue; // not recorded as translated, skip
+ TopoDS_Shape S = myLabels.Find ( L );
- Handle(StepShape_ShapeDefinitionRepresentation) SDR;
- Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
- if ( ! FP->FindTypedTransient ( mapper, STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation), SDR ) ) {
+ Handle(StepShape_ShapeDefinitionRepresentation) SDR;
+ Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
+ if ( ! FP->FindTypedTransient ( mapper, STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation), SDR ) ) {
#ifdef OCCT_DEBUG
- std::cout << "Warning: Cannot find SDR for " << S.TShape()->DynamicType()->Name() << std::endl;
+ std::cout << "Warning: Cannot find SDR for " << S.TShape()->DynamicType()->Name() << std::endl;
#endif
- continue;
- }
+ continue;
+ }
- // set the name to the PRODUCT
- Handle(StepRepr_PropertyDefinition) PropD = SDR->Definition().PropertyDefinition();
- if ( PropD.IsNull() ) continue;
- Handle(StepBasic_ProductDefinition) PD = PropD->Definition().ProductDefinition();
- if ( PD.IsNull() ) continue;
- Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
+ // set the name to the PRODUCT
+ Handle(StepRepr_PropertyDefinition) PropD = SDR->Definition().PropertyDefinition();
+ if ( PropD.IsNull() ) continue;
+ Handle(StepBasic_ProductDefinition) PD = PropD->Definition().ProductDefinition();
+ if ( PD.IsNull() ) continue;
+ Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
- Prod->SetId ( hName );
- Prod->SetName ( hName );
+ Prod->SetId ( hName );
+ Prod->SetName ( hName );
+ }
// write names for components of assemblies
if ( XCAFDoc_ShapeTool::IsAssembly ( L ) ) {
TDF_Label Lref;
if ( ! XCAFDoc_ShapeTool::GetReferredShape ( lab, Lref ) ||
! myLabels.IsBound ( Lref ) ) continue;
- S = myLabels.Find ( Lref );
+ TopoDS_Shape S = myLabels.Find ( Lref );
S.Move ( XCAFDoc_ShapeTool::GetLocation ( lab ) );
hName = new TCollection_HAsciiString;
if ( ! GetLabelName (lab, hName) ) continue;
// find the target CDSR corresponding to a shape
- mapper = TransferBRep::ShapeMapper ( FP, S );
+ Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
Handle(Transfer_Binder) binder = FP->Find ( mapper );
Handle(StepShape_ContextDependentShapeRepresentation) CDSR;
if ( ! FP->FindTypedTransient (mapper,STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation), CDSR) )
// if shape itself not yet translated, do it now
//:abv 20.05.02: see comment in TransferShape(): added "! iasdr ||"
Handle(Transfer_Binder) resprod = TransientResult(sdr); //KA - OCC7141(skl 10.11.2004)
+ bool isJustTransferred = false;
if ( ! iasdr || resbind.IsNull() ) {
resbind = TransferShape(mapper, sdr, FP, shapeGroup, isManifold, theProgress);
+ if (resbind.IsNull())
+ return resbind;
Handle(Transfer_Binder) oldbind = FP->Find ( mapper );
if ( ! oldbind.IsNull() && !resbind.IsNull()) resbind->AddResult ( oldbind );
- FP->Bind (mapper,resbind);
- resprod=resbind; //KA - OCC7141(skl 10.11.2004)
+ isJustTransferred = true;
}
- if (resprod.IsNull())
- return resprod;
// A new resbind may have been produced
// DeclareAndCast(Transfer_SimpleBinderOfTransient,restrans,resbind);
//KA: we need only the current subshape in resprod, since the binder is copied
// in Transfershape which calls Transfersubshape [ OCC7141(skl 10.11.2004) ]
if ( ! iasdr ) {
- resprod->AddResult ( TransientResult ( SDRTool.SDRValue() ) );
- resbind->AddResult ( TransientResult ( SDRTool.SDRValue() ) ); //KA - OCC7141(skl 10.11.2004)
+ resprod->AddResult (TransientResult (sdr));
+ if (resprod != resbind)
+ resbind->AddResult (TransientResult (sdr)); //KA - OCC7141(skl 10.11.2004)
roots->Append ( myContext.GetRootsForPart ( SDRTool ) );
}
for ( Standard_Integer i=1; i <= roots->Length(); i++ ) {
resprod->AddResult ( TransientResult ( roots->Value(i) ) );
- resbind->AddResult ( TransientResult ( roots->Value(i) ) ); //KA - OCC7141(skl 10.11.2004)
+ if (resprod != resbind)
+ resbind->AddResult (TransientResult (roots->Value(i))); //KA - OCC7141(skl 10.11.2004)
+ }
+ if (isJustTransferred)
+ {
+ // We make CDSR of the current shape preceding CDSR of any subshapes,
+ // therefore add resbind at the end.
+ resprod->AddResult (resbind);
+ FP->Bind (mapper, resprod);
}
- myContext.NextIndex();
- //FP->Bind (mapper,resprod); //KA - OCC7141(skl 10.11.2004)
+ myContext.NextIndex();
// abv 16.10.00: bind CDSR (et al) to located shape in order to be able to track instances
- if ( mapper != start ) {
+ if (mapper != start && aLoc.Form() != gp_Identity) {
Handle(Transfer_Binder) bnd = FP->Find ( start );
for ( Standard_Integer j=1; j <= roots->Length(); j++ )
if ( bnd.IsNull() ) bnd = TransientResult ( roots->Value(j) );