Forum archiveIssue archiveModeling Data and Algorithms

Archived discussion

Bounding box not updating

Modeling Data and AlgorithmsFri, 04/01/2016 - 17:282 replies

Browse this forum
QuestionAuthor

Hi get the bounding box of a shape by:

BoundingBox ret;
Bnd_Box box;
BRepBndLib::Add(myShape, box);
box.Get(ret.minX, ret.minY, ret.minZ, ret.maxX, ret.maxY, ret.maxZ);
return ret;

Which works, but as soon as i move the shape

gp_Vec vec(moveX, moveY, moveZ);
gp_Trsf transform;
transform.SetTranslation(vec);
gp_Trsf myTrsfX = myShape.Location().Transformation();
myTrsfX *= transform;
BRepBuilderAPI_Transform moveTransform(myShape, transform);
myShape = moveTransform.Shape();

 

When i then call the bounding box function again, i get the same bounding box coordinates, while the representation seems to actually be on the correct position.

Any ideas?

Discussion

2 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hello,

Have you confirmed that the transformation you are applying is actually working?

gp_Pnt shapeTranslation = myShape->Transformation().TranslationPart();

02Author

Sorry, code example actually works, i accidently (because of a lot of try an error attempts) was calculating a shapes bounding box by combining the bounding boxes of the shapes sub-edges, which seem to get not the correct result. If i actually calculate the bounding box of the shape, like above, it seems to work.