Site Tools


Differences

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

Link to this comparison view

developer:sdksamples:shadedisplay [2015/09/14] (current)
Line 1: Line 1:
 +====== Shading Viewports ======
 +> **Developer:​** //​[[developer:​cplusplusplugins|C++]]//​
 +> **Summary:​** //​Demonstrates how to set a viewport to shaded display using the Rhino C++ SDK.//
 +
 +=====Question=====
 +I would like to set the active viewport to shaded display from a plug-in command. How is this accomplished?​
 +
 +=====Answer=====
 +The following example code demonstrates how to shade 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;​
 +
 +  ON::​display_mode dm = view->​ActiveViewport().DisplayMode();​
 +  if( dm != ON::​shaded_display )
 +  {
 +    view->​ActiveViewport().SetDisplayMode( ON::​shaded_display );
 +    context.m_doc.ViewModified( view );
 +    view->​Redraw();​
 +  }
 +
 +  return CRhinoCommand::​success;​
 +}
 +
 +</​code>​
 +
 +{{tag>​Developer cplusplus}}
  
developer/sdksamples/shadedisplay.txt ยท Last modified: 2015/09/14 (external edit)