| McNeel Wiki | |||||
| edit · print · help · all topics | |||||
Main Pages
Languages
| QuestionI would like to set the active viewport to shaded display from a plug-in command. How is this accomplished? AnswerThe following example code demonstrates how to shade a viewport using the Rhino SDK. 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;
}
C#
public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
{
MRhinoView view = RhUtil.RhinoApp().ActiveView();
if( view == null )
return IRhinoCommand.result.failure;
IOn.display_mode dm = view.ActiveViewport().DisplayMode();
if( dm != IOn.display_mode.shaded_display )
{
view.ActiveViewport().SetDisplayMode( IOn.display_mode.shaded_display );
context.m_doc.ViewModified( view );
view.Redraw();
}
return IRhinoCommand.result.success;
}
| ||||
| Last Modified [10/3/2008] rename · changes · history · subscriptions · references · file upload | |||||