Grasshopper record the Rhino commands being used

Hi everyone. I’m trying to record the Rhino commands used and I revised a script shared by JavierG (the bottom of the conversation):

Now I can have the Command History displayed in a Panel, updating every 5 seconds (controlled by Trigger).

There is a text-processing problem I’m struggling to resolve:

I self-typed a desired result in the screenshot below, annotated with a “Target” scribble next to it.

I have failed to:

  • Turn the rows of texts into multi-string (Right-click on the panel, the Multiline Data option is black out)

  • Extract only the commands (Is it possible to only extract the 1 word after "Command: " "?)

The .gh file is also attached for your reference.

command history text_simplified.gh (18.2 KB)

-------------(Below are just FYI of why I’m doing this, not necessary to read it, but happy to discuss)-----------

I’m doing a research on human-computer interaction and trying to design a real-time interactive “design partner” via Grasshopper based on design behaviour (by analyzing the commands used).

(For example, if many ‘delete’ commands happened in the past 10 seconds, it will display a colourful hatch to excite the designer.

If too many copy commands are used, it will display some dull graphics to calm down the designer, etc.)

My VB skills are very rusty. In Python to do what you suggest, you would do something like this:

Texto = [i.replace("Command: ","") for i in Texto.splitlines()[-Lineas:] if "Command:" in i]

But rather than access the entire command history window text, RhinoScriptSyntax’s rs.CommandHistory() might be more efficient.

https://developer.rhino3d.com/api/RhinoScriptSyntax/#application-CommandHistory

Something like this:

Texto =  [i.replace("Command: ","") for i in rs.CommandHistory().splitlines()[-Lineas:] if "Command:" in i]

You could also potentially use rs.ClearCommandHistory() after a fixed number or runs.

command history text_simplified_v2.gh (18.4 KB)

1 Like

Is that what you want ? you can get all commands used or the actual command in realtime.

RHINOTOGRASSHOPPER

1 Like

Thanks Seghier, the clip looks like exactly what I’m trying to achieve. However, I have tried several ways and yet failed to activate it.
(I followed the installation steps on food4rhino / right-click → unblock all files / restarted PC / restarted Rhino 7 / used different ways to ‘toggle’, etc.)

Would you please suggest how I might use it properly?

Screenshot captured below for your reference:

Thanks Adam, the python script gave me a good start, although a plugin was provided below, I will attempt to develop from your version too as it is potentially more customizable. (eg. categorize the commands into ‘geometry’ ‘transform’ group etc and count them directly in Python)

Thanks a lot and I really appreciate it!

You need to import the toolbar: RhinoToGrasshopper.rui

image

image

Or use the Commands:

EnableDocEvent to enable sending data

DisableDocEvent to disable sending data

1 Like

Thanks a lot Seghier, it worked beautifully after dragging the .rhp into Rhino interface.
May I ask how can I reset the data collected?

Or are there any manual I can look at? (Since I couldn’t find it from food4rhino)

What I’m trying is to create a list of “Command + Time”.
I am happy with the current approach (screenshot below), where I reset through the Data Recorder.
Just curious is there any easier way.

You can use Record Data from Sasquatch plugin

record_command.gh (9.8 KB)

Sorry no manual available, the use of the plugin is easy

1 Like

Thanks Seghier, thanks like a charm again.

1 Like