Accuracy of Bnd_OBB on imported STEP model

Hello Community,

I am trying to get a precise Oriented Bounding Box of a model I imported. The model i am working with has a rectangular base.

The problem i am facing is that the OBB seems to be slightly rotated, making it a little larger than it should be and the Directions off by a few degrees in consequence. 

This also happens on other models.

Here is the code i am using to import the model, convert it and build the OBB:

STEPControl_Reader reader;
reader.ReadFile(path);
reader.TransferRoots();
TopoDS_Shape shape = reader.OneShape();

// Shape Healing
Handle(ShapeFix_Shape) aFixShape = new ShapeFix_Shape();
aFixShape->Init(shape);
aFixShape->Perform();
shape = aFixShape->Shape();

Handle(ShapeFix_Wireframe) aFixWire = new ShapeFix_Wireframe(shape);
FixWire->ModeDropSmallEdges() = true;
aFixWire->FixSmallEdges();
aFixWire->FixWireGaps();
shape = aFixWire->Shape();

// Create OBB
Bnd_OBB obb;
BRepBndLib::AddOBB(shape, obb, true, true, false);

If i make a simple box (1x1x1 with origin (0,0,0)) and build its OBB, it's perfectly precise.

So I am wondering if the problem I am having is due to the complexity of the model? Or because of the conversion from the STEP format?

Any help will be appreciated!

gkv311 n's picture

Could you share a sample model?

Jan-Niklas Velten's picture

I have created a one-time download link link for you, since I unfortunately am not allowed to fully publicly post the model here, I hope that is OK.

Dmitrii Pasukhin's picture

If model is not public, please don't publish it there. There are a lot of people who will download it faster then developers. Please create a new ticket in bug tracker and Mark that as private.

Best regards, Dmitrii.

Jan-Niklas Velten's picture

Thanks for the advice, I will do that. I assume by bug tracker you mean tracker.dev.opencascade.org?

Dmitrii Pasukhin's picture

Yes, that's correct.

Jan-Niklas Velten's picture

I have opened an issue, but there is no way for me to mark it as private, nor edit it in any other way. How do I make it private?

Dmitrii Pasukhin's picture

Or you can use "contact us from" in the current site.

Best regards, Dmitrii