Grasshopper

algorithmic modeling for Rhino

Since it's impossible to debug C# components written in Visual Studio until you test the item in Grasshopper 3D, I have resorted to using MessageBox.Show() to show my variables or just to step through when each code/method is hit.

With that said.. Sometimes I face an infinite loop, which opens so many MessageBox.Show() I can't close it, and I have to open Task Manager to close Rhino in order to pause the canvas.

It doesn't look like Grasshopper 3D has a "pause canvas" or "stop calculations" for a keyboard shortcut. 

How do you guys get out of these infinite MessageBox.Show() in Grasshopper without closing Rhino? Or, how do you guys debug your components?

Views: 1499

Replies to This Discussion

I don't get it? How do you manage to show messageboxes with variables without testing it in Grasshopper?

--

David Rutten

david@mcneel.com

Hi!

You can debug Grasshopper components in Visual Studio. If you have problems to configure the debugger you can use the VS template.

Using the debugger you can use Console.WriteLine() instead of MessageBox or you set breakpoints and the inspector...

And even if you can't get debugging to work (but you should!) you can use Rhino.RhinoApp.WriteLine() for debugging or write out a textfile with logging information.

--

David Rutten

david@mcneel.com

You debug in VS. If you use the GHA project wizards then debugging should work, if it doesn't you can probably repair it, though it's very cumbersome to do so in VS Express.

  • When you start debugging, Rhino.exe should be launched.
  • You run the Grasshopper command so that Grasshopper.dll and your GHA file both get loaded. At this stage breakpoints should turn from empty circles to full red discs. If they don't, debugging is not set up correctly.
  • You load a file with your component that already had inputs specified and you start debugging.

You cannot use the application command line to supply input values, you have to either open a file which is already set up, or you create new inputs from scratch.

--

David Rutten

david@mcneel.com

Hi David,

I'm using the VS Template for the current GH component I'm developing.  When I start debugging rhino opens up;I then type the grasshopper command into rhino and open grasshopper; after that I open a GH file with my component set-up with inputs; the issue is that my break points are remaining as empty circles.  I am using the debug settings provided by the GH VS template.  I'm thinking I should set the settings myself.  Could you describe the process of setting these settings or perhaps point me in the right direction to get the debugger set-up correctly? 

Many thanks for your time here!  

I figured the problem out.  I just had to change the output path in the VS properties menu for the debug build from the default "\bin" to the grasshopper library folder containing the other grasshopper components.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service