Save a .step by tdf_label but wrong location

I got a assembly .step file and i want save a part of them.
My code:

void GetAssemblyShapes(const TDF_Label& label, std::vector& vecAssemblyShapes,Handle(XCAFDoc_ShapeTool) aShapeTool){
if (XCAFDoc_ShapeTool::IsAssembly(label)) {
for (const TDF_Label& child : shapeComponents(label,aShapeTool))
GetAssemblyShapes(child, vecAssemblyShapes,aShapeTool);
}
else if (XCAFDoc_ShapeTool::IsReference(label)) {
TDF_Label referred;
XCAFDoc_ShapeTool::GetReferredShape(label, referred);
if(XCAFDoc_ShapeTool::IsAssembly(referred)){
TDF_LabelSequence atestLabels;
XCAFDoc_ShapeTool::GetComponents(referred,atestLabels);
for (TDF_LabelSequence::Iterator cRootIter(atestLabels); cRootIter.More(); cRootIter.Next())
{
GetAssemblyShapes(cRootIter.Value(), vecAssemblyShapes,aShapeTool);
}
}
}


Handle(TDocStd_Document) ok = ReadSTEPToDocument(fileloc);
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(ok->Main());
TDF_LabelSequence aRootLabels;
aShapeTool→GetFreeShapes(aRootLabels);
std::vector vecShapelabels;
GetAssemblyShapes(aRootLabel, vecShapelabels,aShapeTool);

STEPCAFControl_Writer mywriter;
mywriter.SetColorMode(true);
mywriter.Transfer(alabel);

When i use XCAFDoc_ShapeTool::GetComponents(referred,atestLabels); and save them to .step.I get wrong location part,i want to know how to save right when the label IsReference.

Attachments: 
Dmitrii Pasukhin's picture

Hello, what means "wrong location"? Saving only reference always ignore any high level transformations. It means element will be located in the (0,0,0) position with identity matrix. If you want to change to the the same position as in the scene, you need to update something manually. For now it is not supported by default.

Best regards, Dmitrii.

ship Gold's picture

thanks,so how can i add a transformation in a TDF_Label