Setting Viewports display mode to Ghosted


At the outset of my plugin execution (or later when my commands are being executed) I need to set the display mode of all the viewport to Ghosted. In the C++ SDK there’s an example exactly for that which looks briefly like:

CRhinoView* view = RhinoApp().ActiveView();
CRhinoViewport& vp = view->ActiveViewport();
const CDisplayPipelineAttributes* pStdAttrs = CRhinoDisplayAttrsMgr::StdGhostedAttrs();
vp.SetDisplayMode( pStdAttrs->Id() );

I’m working in C# with the .NET SDK so I wrote that as:

		MRhinoView view = RhUtil.RhinoApp().ActiveView();
		MRhinoViewport vp = view.ActiveViewport();
		Guid pStdAttrs = MRhinoDisplayAttrsMgr.StdGhostedAttrs().PipelineId();
		vp.DisplayPipeline().SetDisplayMode(ref pStdAttrs);

and stepping through it, all seems normal, no nulls.

But it has no effect: all viewports remain in their startup/default Wireframe display mode.

Any ideas?

(Supplementary question: how do I get a list of ALL viewports, not just the Active or Main one?)

Thank you

Peter Schwenn
AMTC Stevensville MD

(Dale Fugier) #2

Hi Peter,

Instead of doing this:

Guid pStdAttrs = MRhinoDisplayAttrsMgr.StdGhostedAttrs().PipelineId();

Do this:

Guid pStdAttrs = MRhinoDisplayAttrsMgr.StdGhostedAttrs().Id();

Also, to get all views, use MRhinoDoc.GetViewList.

– Dale


Dear Dale,

Thank you very much; works perfectly.

Peter Schwenn


Dale, where is MRhinoDoc declared?

(Dale Fugier) #5

MRhinoDoc is from the older, .NET SDK. The equivalent in RhinoCommon is Rhino.RhinoDoc.

Here is now to set a view to shaded display: