Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:sdksamples:ghostedshade [2015/09/14] (current)
Line 1: Line 1:
 +====== Ghosting Viewports ======
 +====== C++ ======
 +> **Summary:​** //​Demonstrates how to set a viewport to ghosted display using the Rhino SDK.//
 +
 +=====Question=====
 +I would like to set the active viewport to ghosted display from a plug-in command. How is this accomplished?​
 +
 +=====Answer=====
 +The following example code demonstrates how to ghost a viewport using the Rhino SDK.
 +
 +===== C++ =====
 +<code c++>
 +
 +CRhinoCommand::​result CCommandTest::​RunCommand( const CRhinoCommandContext&​ context )
 +{
 +  CRhinoView* view = RhinoApp().ActiveView();​
 +  if( 0 == view )
 +    return CRhinoCommand::​failure;​
 +
 +  CRhinoViewport&​ vp = view->​ActiveViewport();​
 +
 +  const CDisplayPipelineAttributes* pStdAttrs = CRhinoDisplayAttrsMgr::​StdGhostedAttrs();​
 +  if( pStdAttrs )
 +  {
 +    vp.SetDisplayMode( pStdAttrs->​Id() );
 +    view->​Redraw();​
 +  }
 +
 +  return CRhinoCommand::​success;​
 +}
 +
 +
 +
 +</​code>​
 +
 +
 +{{tag>​Developer cplusplus}}
  
developer/sdksamples/ghostedshade.txt ยท Last modified: 2015/09/14 (external edit)