Dear community,
I am a starting C# developer and Rhinoceros user. I have used Rhinoscript and am now making my first attempts to work with C# and Rhinoceros.
I used code from dalefugier (Dale Fugier) · GitHub called SampleCsModalForm, which I could compile and install. After installation, I could call the command SampleCsModalForm from within Rhinoceros and see a window with three buttons appear. When clicking one of the buttons, a MessageBox is called, which also works fine.
However, I also wanted to execute a script in the method that is called when a button is clicked:
private void HelloButton_Click(object sender, EventArgs e)
{
MessageBox.Show(“Hello Rhino!”, “SampleCsForm”, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
if (Rhino.RhinoApp.RunScript(“_-Line 0,0,0 10,10,10”, true))
{
MessageBox.Show(“Runscript OK!”, “SampleCsForm”, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
MessageBox.Show(“Runscript FAILED!”, “SampleCsForm”, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
I expected a line to appear in Rhino, but I got as result the MessageBox saying Runscript FAILED! Any ideas what I did wrong? Also, my goal I am working towards is to call a rather big script from an rvb file instead of calling direct rhino commands, something like Loadscript (and execute it), but from within a C# method.
Kind regards,
Filip Rooms
