'\r' literal in command history window


How do I print a series of strings in command history window in one line? Adding “\r” literal for carriage return at the beginning of strings results in printing each string in new line. I need to erase previously printed line and add new string in that line.


On Windows, you will want a “\r\n” combo…

OK wait, I miss understood your question.

If you want everything printed on one line, just don’t add an end-of-line marker. You are not going to be able to 'erase" a line of text you’ve already printed.

Which begs the question, what are you trying to do an why?

Thanks for your reply, Dale

Ok - what I’m trying to do is to print some kind of timer or status bar in command history window while algorithm is running. The algorithm is “for” loop. I need to print iterating varible and time passed since algorithm start in each loop - and I only need to see last line. I’m not interested in keeping that in command history since I print other data there. Maybe it can be printed in prompt line (like in RhinoVault plugin)?

I just figured out that I can use rhinosriptsyntax.StatusBarMessage() function for what I need.

See cheezy sample below:

import rhinoscriptsyntax as rs
for n in range(0, 100):
    rs.Prompt(str(n) + ' % complete')
1 Like

That’s what I need, thank you!