algorithmic modeling for Rhino
Hi Thomas,
I've never actually tested this, but you can try deriving a class from Grasshopper.Kernel.Graphs.GH_AbstractGraph. It should work, I' just never tried defining a Graph in a GHA dll before.
You can find useful class and method comments on IGH_Graph and GH_AbstractGraph.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hey David
Cool, I'm gonna try this!
Thanks
Hey David
It worked. I derived a class from GH_AbstractGraph. Then just removed the lines drawn to indicate the tangent handles of the bezier curve and changed:
this.m_crv = Rhino.Geometry.Curve.CreateControlPointCurve(cv, 3);
to:
this.m_crv = Rhino.Geometry.Curve.CreateInterpolatedCurve(cv, 3);
I'm looking into adding/removing points from the curve, but this doesn't seem to be as easy as adding another Graph type. And I wasn't able to find the class and method comments?
I'd be happy to share the component if anyone need it.
/Thomas
It's been a long time since I looked at the GraphMapper code, but I think it's not possible to add grips through mouse events. Seems that when the mouse is clicked more than 10pixels away from a grip, it simply ignores the click.
I think your efforts will be better spend trying to write a component that uses a Rhino curve to process data, at least then you'll have all the Rhino commands at your disposal.
A hack would be to have dozens of grips in the (0,0) coordinate, and to ignore those during evaluation. Only when you drag one of these grips off the (0,0) coordinate does it become part of the graph curve. But that's über-icky.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
What about setting the number of grips as a paramter for the component? and then pass it on to the actual graph?
Would this be possible?
/Thomas
It's not a component, like most objects in the Special tab, the Graph Mapper is a parameter (Gradients, Legends, Custom preview, Galapagos and Scribble being the exceptions). As such, it can only have a single input and a single output.
Also, to make this possible I'd have to write the code and re-release anyway, so I might as well code up a mechanism for adding grips the easy way...
The GraphMapper UI needs some work anyway, I want to add the ability to pan and zoom the graph as well.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by