Get text input from the AutoCAD command prompt in C#

Top  Previous  Next

This fragment should tell you much of what you need to know:

 

          Document doc = Application.DocumentManager.MdiActiveDocument;

          var db = doc.Database;

          Editor ed = doc.Editor;

 

          string sOldText;

          PromptResult pr = ed.GetString("\nEnter old test: ");

          if (pr.Status != PromptStatus.OK)

           {

              return;

           }

           sOldText = pr.StringResult;

 

Note that the user has to put the string in quotes if the string contains spaces:

 

"1234 5353"