I have successfully drawn 2d shapes over all rhino Views using the samples for Display Conduit.’ What I would like to do is to only draw my text/shapes on a specific viewport. I cannot find a method in Displaypipeline to select which view to draw in. is this functionality supported?
This is for the scenario where I will be using a specific viewport that enables the user to interact with different and would like to display information only in this viewport.
Thanks in advance for any help or tips!
You can get the
ViewPort object from the display pipeline, and then the name of the viewport. Based on that, decide what to draw.
Thanks, Menno for the reply. Unfortunately, I am still unaware of what the process for that would be. I have included my code example where this would be called. I am not able to find Viewport methods that suggest a draw selection. I must be missing some knowledge about this. I will have a further look into this but if you have a suggestion to help me along the way that would great!
protected override void DrawForeground(Rhino.Display.DrawEventArgs e)
var bounds = e.Viewport.Bounds;
var pt = new Rhino.Geometry.Point2d(bounds.Right - 100, bounds.Bottom - 30);
e.Display.Draw2dRectangle(bounds, System.Drawing.Color.White, 4, System.Drawing.Color.Transparent);
// Get RhinoViewport and then decide what to draw with it?
RhinoViewport rvp = RhinoDoc.ActiveDoc.Views.ActiveView.DisplayPipeline.Viewport;
DrawEventArgs e contains a reference to the
if (e.Display.ViewPort.Name == "Perspective")
// draw only in Perspective view port
Perfect! Thank you, Menno for helping me understand the way the events are working n this case.