Author Topic: Temporary Command Line Message  (Read 2019 times)

0 Members and 1 Guest are viewing this topic.

Odoshi

  • Guest
Temporary Command Line Message
« on: December 26, 2013, 11:40:30 AM »
Hi,

I'd like to put a counter at the command line but not have it show all items in the command line history, like the following:

Adjusting item 1
Adjusting item 2
...

But I would like it to just "spin" and then when it is finished, maybe only display the last message.

Is this possible in .NET?

Thanks!

Anton3

  • Mosquito
  • Posts: 1
Re: Temporary Command Line Message
« Reply #1 on: January 13, 2014, 04:16:34 PM »
Is this what you want?

Code: [Select]
     
 [CommandMethod("LongOP")]
        public void LongOperation()
        {
            Document doc=Application.DocumentManager.MdiActiveDocument;
            Database db=doc.Database;
            Editor ed=doc.Editor;

            int maxItems=1000;
            int iToShow=150;

            int i=0;
            while( i< maxItems)
            {
                if ((i % iToShow)==0)
                    ed.WriteMessage("\nAdjusting item {0}",i+1);
                i++;
            }
            ed.WriteMessage("\nAll {0} items adjusted",i);
        }

elliottpd

  • Guest
Re: Temporary Command Line Message
« Reply #2 on: January 15, 2014, 02:15:26 PM »
If you write a message to the command line without the leading new line character (\n or vblf), then overwrite with the next message, the numbers appear to spin, while the rest of the message is static:
myEditor.WriteMessage("Updating block " & Cnt.ToString & " of " & myIDs.Count & vbCr)

IDabble

  • Guest
Re: Temporary Command Line Message
« Reply #3 on: January 15, 2014, 08:31:03 PM »
Yes, leave out the new line character "\n".
For your second and consecutive Editor.WriteMessage calls, you can lead them with one or more Unicode backspace characters "\u0008".
For example, one backspace character in C# prior to string "hello":

Editor.WriteMessage("\u0008hello");

hth

Odoshi

  • Guest
Re: Temporary Command Line Message
« Reply #4 on: January 16, 2014, 01:36:18 PM »
Thanks for the replies!

I'll give those a try in a bit. I've got code to do it in LISP with the old -. /, |, \ ,-...remember those days? ;)

Regards,
Mike

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Temporary Command Line Message
« Reply #5 on: January 16, 2014, 02:38:17 PM »
Thanks for the replies!

I'll give those a try in a bit. I've got code to do it in LISP with the old -. /, |, \ ,-...remember those days? ;)

Regards,
Mike

LISP = Lost In Stupid Parentheses
Revit 2019, AMEP 2019 64bit Win 10