algorithmic modeling for Rhino
So here's one that seems like a bit of an odd problem, but I promise it actually makes sense: I'm working on a plugin in VB.net to do rudimentary HVAC calcs in grasshopper. I would like to be able to control the color of the wires passing between my nodes to represent the different types of system inputs that I'm passing around in my HVAC system, i.e. red wires if you're passing data about hot water, blue wires if you're passing data about cold water.
I know this seems totally unneccessary, but if you regularly work on systems like this and are trying to make it more intuitive to new folks learning the systems it makes a little more sense. The goal is to be able to take the data from the HVAC system, bridge it with geometry from Rhino / GH and sent it all to an energy modeler to try and optimize building form / performance.
Thanks,
Mike
Tags:
Hi Mike,
if you want non-standard wires, you're going to have to draw them yourself. Bad news is you can only draw wires going into your components. Wires going out of your components are drawn by their receivers.
There's three things you can do:
Any of these you'd like to know more about?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
David,
I'm thinking that despite option 3 being the most complex, it's probably the one that would give me the most control? The issue of the wires being drawn by their recevers shouldn't be a problem as I see any nodes associated with this being exclusive to the HVAC tools, and they wouldn't be plugging into any other nodes that would give them the incorrect wire color. Would you be able to recommend a place to start with CanvasPostWires?
Mike
The attached VB project (made with Visual Studio 2008) will register a PostPaintWires handler. It will iterate whatever document is loaded in the canvas, find all instances of a specific parameter and draw special pink wires if a source of this parameter is the same type of parameter.
So if you connect a Special Wire parameter to an integer, nothing will happen, if you hook it up to another Special Wire parameter you'll get a pink wire.
The big benefit of this approach is that you can do all sorts of funky stuff, but the drawback is that you have to do a lot of iterating to find all the bits and pieces you have to draw.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
ps. I just added a new function called
RenderIncomingWires(ByVal painter As GH_Painter, ByVal sources As IEnumerable(Of IGH_Param), ByVal styles As IEnumerable(Of Pen))
which allows you to fairly easily override the display of each wire. You can call this function directly inside attribute Render methods so no tricky event handling and stuff required. Will this help?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
This most definitely will help. Thanks David!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by