Site Tools


Differences

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

Link to this comparison view

developer:sdksamples:setcommandprompt [2015/09/14] (current)
Line 1: Line 1:
 +====== Setting Rhino'​s Command Prompt Text ======
 +> **Developer:​** //​[[developer:​cplusplusplugins|C++]]//​
 +> **Summary:​** //​Demonstrates how to set Rhino'​s command prompt text to show the progress of long processes.//​
 +
 +=====Question=====
 +How can I show the progress, for a process will execute for a long time, on the command line?
 +
 +For example, this is what Rhino'​s IGES importer prints:
 +
 +{{:​legacy:​en:​SdkSetCommandPrompt.jpg}}
 +
 +=====Answer=====
 +See the following sample code.
 +
 +=====C++=====
 +<code c++>
 +CRhinoCommand::​result CCommandTest::​RunCommand( const CRhinoCommandContext&​ context )
 +{
 +  ON_wString prompt;
 +  int i, entity_count = 1000;
 +  for( i = 0; i < entity_count;​ i++ )
 +  {
 +    prompt.Format( L"​Importing IGES entity %d of %d", i+1, entity_count );
 +    RhinoApp().SetCommandPrompt( prompt );
 +    RhinoApp().Wait(0);​
 +
 +    // TODO:
 +  }
 +  RhinoApp().Print( L"IGES import successful.\n"​ );
 +
 +  return success;
 +}
 +
 +</​code>​
 +
 +{{tag>​Developer cplusplus}}
  
developer/sdksamples/setcommandprompt.txt ยท Last modified: 2015/09/14 (external edit)