For some Rhino commands, after selecting all curves and “Press Enter”, Rhino will pop up a dialog and show the “preview”. Could you tell us how you make the preview? Do you just create an ordinary surface and ask Rhino to show it? Do you have some C++ samples for the “preview”? Many thanks.
There are two ways to draw preview geometry:
1.) Create a
CRhinoGetPoint-derived class, override the
CRhinoGetPoint::DynamicDraw virtual function, and add your drawing code.
You will find several code samples that demonstrate this, in the developers samples repo on GitHub.
2.) Create a
CRhinoDisplayConduit-derived class and implement your drawing code.
Here is an overview on conduits:
Again, you will find several code samples that demonstrate this, in the developers samples repo on GitHub.
For your Lofting command, after selecting all curves and “Press Enter”, Rhino will pop up a dialog and show the lofting “preview”. Does the Lofting command just create an ordinary surface and show it? Or it uses a CRhinoDisplayConduit-derived class? The Lofting style is suitable for our plugin.
Loft command uses an MFC dialog box that inherits from
CRhinoDialog. The dialog box is semi-modal in that the user can use view commands and operations while the dialog box is displayed. There is a semi-model dialog box sample in the developer samples repo on GitHub.
When the dialog appears, it creates a
CRhinoDisplayConduit-derived class to draw the preview Brep. The conduit draws the preview Brep in the
We thought the Lofting command just creates an ordinary surface and shows it, so we create an ordinary surface and directly call m_doc.AddObject( brep_object ) to show the preview. Would this method cause any problem? If so, we may have to re-develop the preview. Thank you.
We have created a CRhinoDisplayConduit-derived class to draw and highlight the preview Brep. Should we draw in the CSupportChannels::SC_PREOBJECTDRAW channel (we would like to highlight the geometry)? To draw an ON_Brep, we just call CRhinoDisplayPipeline::DrawBrep inside ExecConduit?
Could you also tell me how to highlight a preview ON_Brep? Drawing it in the CSupportChannels::SC_PREOBJECTDRAW channel does not highlight it. Also we find m_pDoc->Redraw() does not trigger CSupportChannels::SC_PREOBJECTDRAW. Do you know why?
Preview geometry should be drawn in the
CSupportChannels::SC_DRAWOVERLAY channel, as demonstrated by the sample I referenced.
The geometry is not a line or a curve. It is a trimmed surface or a face (a ON_Brep). Your loft command draws the preview Brep in the CSupportChannels::SC_PREDRAWOBJECTS channel. Are you sure it should be drawn in the CSupportChannels::SC_DRAWOVERLAY channel?
Also we need to highlight the preview ON_Brep. How could we do it in the preview?
Pass your favorite color to
CRhinoDisplayPipeline::DrawBrep, the function you’ll use to draw the preview Brep.
A post was split to a new topic: Draw Breps in Display conduit