algorithmic modeling for Rhino
I am currently working on my architecture thesis project on grasshopper and I am finding that I need to write more and more code into C#, almost to the point of writing the almost the whole thing there.
I am wondering if there is a way to do this with a more robust coding environment like Visual Studio. Browsing through here it seems VS can be used to create new components, but I have no idea how to get started. (I only started writing code more complicated than for loops and if statements a week ago.)
So long story short, do you guys know of tools and tutorials to use VS with Rhino and Grasshopper? preferably with live-ish feedback?
Note: I can't do the whole code in VS because I am depending on some 3rd party plugins, mainly the ArchiCAD plugin which allows me to draw BIM Models from Grasshopper and I am not nearly proficient enough to use the ArchiCAD SDK in addition to the Rhino SDK.
Attached is some of the Code I currently have.
I've tried edit-and-continue on VS 2015 Community (it's still free, but has some nice debug features) and it works up to a point when you have to change method arguments, then it asks you to rebuild and restart. It is a really nice tool especially for debugging GH plugins as it doesn't require to restart rhino each time.
since you mentioned vs2015, i installed it some weeks ago to experiment and learn. But the visual C versions it installed kind of messed gh a bit. i had crashes in definitions that where working ok before vs2015. After trying to pinpoint which components were crashing rhino i found out that similarity and cull pattern causes the troubles. i read the crash dump file and reported conflicts with these net frameworks (4.5 etc)
Uninstalled vs 2015 and all the visual c's and the definitions got back to normal without crashes.
"it doesn't require to restart rhino each time"
Actually you don't need to restart Rhino whenever you rebuild the VS project, you only need to restart Grasshopper (by running "GrasshopperUnloadPlugin" followed by "Grasshopper" to reopen it). This will save you quite a bit of time :)
David, can you be more specific why the edit-and-continue did not work in you? any error messages? or did the debugger not even start at all?
The edit-and-continue works fine for me. I have used it quite a few times and it is quite convenient, though some kind of edits will still require a complete restart.
You can only edit the code when it is being paused (as it hit a break point set by you). And you have to compile the code in Debug mode, not Release mode.
Also, I think you will need the professional or community edition of Visual Studio to do edit-and-continue with Rhino/Grasshopper, as last I checked with Express (version 2015), the option to attach an external application to the debugger is not there.
It's been quite a while since I tried, as I recall the build just failed to start each time. I'm also not that heart-broken, I find that I rarely have to tweak code many times in a row and I've gotten pretty good at dealing with breakpoints over the years, so for debugging I don't need many restarts either.
True, I also realized that I do not rely on Edit and Continue that much, though I was quite thrilled when I very accidentally discovered this feature while debugging my gha plugins :)
Is it possible to use Visual Studio to develop components using Python?