
Fri, 04/01/2016 - 17:28
Forums:
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?
Fri, 04/01/2016 - 23:20
Hello,
Have you confirmed that the transformation you are applying is actually working?
gp_Pnt shapeTranslation = myShape->Transformation().TranslationPart();
Tue, 04/05/2016 - 14:53
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.