GetBoundingBox override deriving from DocObjects.Custom namespace

Hi!

Does anyone know how to use override from the topic properly? I’m drawing meshes that are not part of the doc in OnDraw override, the user can interact with them, e.g., hover + drag changes the radius of the cylinder, after the change (radius, new cylinder, etc), Redraw is called, and it calls

protected override BoundingBox GetBoundingBox(RhinoViewport viewport)
{
    return _cylinderMesh.GetBoundingBox(false);
}

True/False does not change a thing. I tried to make bBox right afer mesh and store it in a private field, but no change. Only viewport.ZoomBoundingBox(bBox); in override made a change with obvious side effects. Oh, plus viewport.SetClippingPlanes(bBox); also doesn’t help.

This is what I’m seeing - like bbox or near/far plane got “stuck”:

I’m not sure who I should pinpoint here (?) @wim Would you mind helping to pass this on to the right people?

Hi @D-W,

Can you provide us a relatively simple code sample that we can use to repeat?

– Dale

Hi @dale!

ASAP condensation - probably callback could be a few lines smaller, though that’s a rough/enough sketch, you should be able to reproduce this with it → CustomQuirks.zip (28.0 KB)

Thanks for kicking in!

Hi @D-W,

I’ve logged an issue so a knowledgeable developer can investigate.

– Dale

I investigated this and your code is modifying an object in the document in a way that Rhino doesn’t really expect. Objects added to the document are considered immutable and do not change. They are typically replaced when the geometry changes which allows for things like undo to work. If you like the behavior that you have set up with this sample code, you will need to add a conduit that adds the bounding box for your object to the bounding box calculation as the display does not repeatedly call your object’s boundingbox function every frame since it thinks it doesn’t need to.