generative modeling for Rhino
I want to display some text or the value of a variable with a panel during the runtime of a script, just to check if my script is correct.
I tried Console.WriteLine("some text") and connected a panel to the out-parameter but it's not working.
BTW If someone knows some C# tutorials for grasshopper!!! it would be nice, because all I could find are tutorials for compiler.
Print("some string"); to write to the "out" parameter.
"...during the runtime of a script..."
That's a bad idea. While the script is running the Rhino and Grasshopper interfaces are not updating. If you start updating the interface not only will that massively slow down the process, it will also result in all kinds of weird visuals as a lot of data is 'in limbo'.
If you must display something while the script is running, I recommend creating a new window and updating that. I can't actually type C# code now because I've broken the script editor, but try something like the following:
Form feedbackForm = new Form();
feedbackForm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
feedbackForm.Width = 300;
feedbackForm.Height = 150;
feedbackForm.TopMost = true;
Label feedbackLabel = new Label();
feedbackLabel.AutoSize = false;
feedbackLabel.Dock = DockStyle.Fill;
feedbackLabel.Text = "<feedback>";
//Perform script code, this should take a long time.
feedbackLabel.Text = "new feedback";
//When you're done with the script, destroy the feedbackform
Does that approach work?