I use OpenGL to generate a model and insert it into the Rhino scene, but the scale is very large (see image1 for an example). I want that when loading the model, it automatically aligns to all types of Top, Front, Right and Perspective (see image2). I reviewed many articles on this subject and I came across this article => (https://developer.rhino3d.com/guides/rhinocommon/display-conduits/) and I was interested in the overridden CalculateBoundingBox of the DisplayConduit class. I wanted to align the object’s Bounding box with the Bounding box of the view, but so far nothing has worked)). I overridden the CalculateBoundingBox method, but it does not give anything. Below is the code I made to test this method. Please tell me if anyone has any ideas on this. This is very important to me. Thank you in advance))RhinoCommandDebugCommand.cs (3.3 KB)
I don’t understand what you mean by align? Does mean you want to zoom to the extents in each viewport?
Sorry, I just recently encountered the Rhino API. Yes you are right. For example, I created a sphere (image1) in the first message, in the end I need to get the result shown on image2 in the first message. I tried to solve this problem by overriding the CalculateBoudingBox method in the DisplayConduit class. I passed the BoundingBox of the sphere to the IncludeBoundingBox () method, but this did not produce the desired result. Thank you in advance))
In the image, technically, the object isn’t clipped. Portions just fall outside the view-able area.
For an example of zooming a view, see the following sample.
Thank you very much, Dale for the example, this is what I need. But I need to apply the ZoomExtents () method for each view (top, front, right and perspectice). I tried to do this through the redefined methods of the DisplayConduit class to refer to each view, but it only works for the current view. I don’t know how to get views collection and use the ZoomExtents () method for everyone.
Best regards, Dmitry
Maybe just loop over all views like so: (I admit, I haven’t tested this)
foreach (var view in e.RhinoDoc.Views) view.ActiveViewPort?.ZoomExtents() e.RhinoDoc.Views.Redraw()
Thanks a lot))