questions about view

Hello everyone, after importing the STEP file, I selected a surface and unfolded it, but the distance between the unfolded and original surfaces, as shown in the picture, is a bit far. I need to scale and rotate them. How can I adjust the settings to reduce the distance between the two surfaces directly?

Attachments: 
gkv311 n's picture

You may try computing difference between bounding boxes, for example.

Handle(AIS_Shape) thePrsShape = ...;
Handle(AIS_Shape) thePrsUnfolded = ...;

Bnd_Box aBox1, aBox2;
thePrsShape->BoundingBox(aBox1);
thePrsUnfolded->BoundingBox(aBox2);
gp_XYZ aCenter1 = (aBox1.CornerMin().XYZ() + aBox1.CornerMax().XYZ()) * 0.5;
gp_XYZ aCenter2 = (aBox2.CornerMin().XYZ() + aBox2.CornerMax().XYZ()) * 0.5;
gp_XYZ aShift = aCenter2 - aCenter1;

gp_Trsf aShiftTrsf;
aShiftTrsf.SetTranslation(aShift);

thePrsUnfolded->InteractiveContext()->SetLocation(thePrsUnfolded, TopLoc_Location(aShiftTrsf));