OBB is calculated abnormally large for the model

When creating an OBB for a surface model, the size of the OBB is calculated abnormally large for the model.
If you output the STL data of this shape and check it with CADAssistant, it will be a normal value.
Changing the flags of the OBB function did not work.

What approach should I take to get the correct value?
I would like to ask for your advice.

Thank you for your reply. .

Shoko

Standard_Boolean theIsTriangulationUsed = true;
Standard_Boolean theIsOptimal = false;
Standard_Boolean theIsShapeToleranceUsed = true;

Bnd_OBB bbox;
BRepBndLib::AddOBB(shape, bbox, theIsTriangulationUsed, theIsOptimal, theIsShapeToleranceUsed);

Mikhail Sazonov's picture

All the needed information you can find in the documentation of this method. What is not clear there?
If you have a triangulation in the shape then you will get the most quick and tight OBB. If you don't have triangulation but still want to obtain the tight box then set theIsOptimal to true.

Shoko Noguchi's picture

Thank you for your reply.

I'm assuming you know the information you need for this method.
However, even if I set a flag such as IsOptimal to True, I can't get the correct value...

OBB is said to be affected by shape tolerance, so I used the code below to reduce the tolerance value.
ShapeFix_ShapeTolerance aFixToler;
aFixToler.SetTolerance(shape, 0.001, TopAbs_EDGE);
aFixToler.SetTolerance(shape, 0.001, TopAbs_VERTEX);
aFixToler.SetTolerance(shape, 0.001, TopAbs_FACE);

The initial bounding box size value is
xBoxSize : 215547
yBoxSize : 215547
zBoxSize : 215545

After changing Tolerance
xBoxSize : 1441.68
yBoxSize : 1399.62
zBoxSize : 1243.7

But the original value is
xBoxSize : 239.84
yBoxSize : 178.13
zBoxSize : 153.72

Are there other settings that affect OBB?

Dmitrii Pasukhin's picture

Can you give just Bounding Box Result by AddOptimal? Is it work correct?

Best regards, Dmitrii.

Shoko Noguchi's picture

Dmitrii
Thank you for your advice.
I didn't try to set only theIsOptimal to True.
Sorry for the rookie mistake.
I am extremely grateful.

Shoko

Mikhail Sazonov's picture

I think I can't you help further without seeing your shape.

Shoko Noguchi's picture

Mikhail
thank you for your reply.
I'm sorry, but models cannot be sent externally.
Thank you for your helping heart.
I managed to get the OBB by setting only theIsOptimal to True.

Shoko