DiscussionsIssue archiveVisualization and 3D Viewer

Archived discussion

questions about view

Visualization and 3D ViewerSat, 11/02/2024 - 11:091 reply

Browse this forum
QuestionAuthor

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?

Discussion

1 archived reply

Posts are displayed in their archived order.

01Commenter-1

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));