Dear,
How can I access the command history from python?
Does the command history contain all informations of then command (not only the name
of the command)?
Kind regards
Dear,
How can I access the command history from python?
Does the command history contain all informations of then command (not only the name
of the command)?
Kind regards
Hi,
Does this give you what you want?
import rhinoscriptsyntax as rs
txt = rs.CommandWindow()
Itâs a string that youâll need to parse.
Alain
No, if youâre looking to reproduce the result of a command for example, you will not see anything in the command history like a mouse pick of a point, what objects were selected, etc. All it will give you is what the command line has reported back to you in serial order. It should more properly be called âCommandLineHistoryâ.
âMitch
What I need is to get all necessary information to re-create the objects:
if I create a cylinder, and create a box than I do a union, I would like to get the 3 commands: cylinder,
box, and union along with the details (radius, position, height, length, âŚ) to be able to recreate the
object.
Taoufik
When I run the python script I get an error: module object has no attribute CommandWindow
I am using Atom and Rhino5 on Mac
Taoufik
Yeah, it is rs.CommandHistory()
import rhinoscriptsyntax as rs
txt = rs.CommandHistory()
print txt
should work.
-Pascal
Hi
Where do I see the result of print? does Rhino has a console?
Taoufik
You can actually show the command history in Mac Rhino in the right sidebar as one of the panels. --Mitch
But the command history does not show the result of âprint txtâ, where do I find
the result of âprint txtâ?
Taoufik
With Python, any print statement will print to the âcommand lineâ. On Mac Rhino, that will only be one line to the tiny little lower left hand status bar, as Mac Rhino does not have a real command line per se. Therefore the last line is all you will see in that tiny space - unless you do something else. In order to see all of it you will either need to:
âMitch
I wrote the following but the out.txt file is empty:
import rhinoscriptsyntax as rs
txt = rs.CommandHistory()
f=open(âout.txtâ, âwâ)
f.write(txt)
f.close()
Taoufik
Looks like you actually need a full path to the file for f.write() to work. --Mitch
Is this still applicable? Experiencing trouble trying to do this using Rhino 7 on Big Sur.
rs.CommandHistory()
Seems to return nothing, but due to poor interface on Mac itâs difficult to figure out whether itâs returning ââ or None. Have tried exactly how was written above, as well as this to just print directly:
print rs.CommandHistory()
Any help would be greatly appreciated, thanks!
It does indeed look like it is still broken/not implemented on Mac⌠Iâll see if we can fix that.
RH-62435 Command history : Not on mac
-Pascal