Replacing a topods_shape with an updated version.

Hello,

I have some code where i try to change the thickness of shape inside of a step file. I read the file into a TDocStd_Document, and i have the corresponding shapetool. My function takes the shape of the main label of the document, and extrudes this by a certain scaling factor. I'm having issues with replacing the original shape with my newShape, however. Here is my code:

void StepProcessor::ChangeThickness(float thickness)
{
std::cout << "thickness in chagner: " << thickness << "\n";
TDF_LabelSequence roots;
shapeTool->GetFreeShapes(roots);
TDF_Label label = roots.First();

TopoDS_Shape shape;
shapeTool->GetShape(label, shape);

VlakProperties vp;

double curThickness = vp.Thickness(shape);

gp_Vec dir = GeneralFunctions::GetNormalVec(vp.LargestFace(shape));
gp_Pnt center = vp.CentreMass(shape);
gp_Ax2 scaledir(center, dir);
gp_GTrsf myTrsf;
std::cout << " scaling : " << (thickness / curThickness) << "\n";
myTrsf.SetAffinity(scaledir, (thickness / curThickness));
BRepBuilderAPI_GTransform xformZ(shape, myTrsf);
TopoDS_Shape newShape = xformZ.Shape();
std::cout << vp.Volume(newShape) << " old: " << vp.Volume(shape);
shapeTool->SetShape(label, newShape);
shapeTool->UpdateAssemblies();
}

after which i export the file by transfering the doc:

if (!writer.Transfer(doc))
std::cout << "Err trsf file" << "\n";
if (!writer.Write(path.c_str()))
std::cout << "Err writing file" << "\n";

my doc and shapetool are member variables of the same class.
Handle(XCAFDoc_ShapeTool) shapeTool;
Handle(TDocStd_Document) doc;

When i export this to a .step, the original shape is in the step. I'm fairly certain that the newShape variable holds the correct shape, since its volume is equal to the original shape's volume multiplied by the scalingfactor. Do you have any idea what I am doing wrong?

Thank you,
Martijn.