MetaHopper

Welcome to Metahopper - a tool for controlling Grasshopper with Grasshopper :)

This library contains a number of components and commands for querying and manipulating Grasshopper components dynamically. You can retrieve components and objects based on their type, their library, the group they're in, or by selecting them directly - or even get all the objects in a document at once. You can then retrieve information about these components + parameters, the libraries they belong to. You can also manipulate objects directly: enabling/disabling, turning preview on and off, changing the color of groups, the text and size of scribbles, and the shape of sketch objects.


MetaHopper also adds a new menu to the Grasshopper document editor, that wraps up several functions:

BestPracticize Selection lets you pick a group and auto-insert params for all the inputs and outputs coming into/out of the group. This makes for nice, tidy functional groupings that make your Grasshopper code easier to read. 

Save Snippet improves on an earlier script I released - it lets you select any group of components + objects and save them as a single user object - without needing to cluster them. This is useful when you want things saved that have internal UI elements - like a graph mapper or slider for instance - that you want to be able to manipulate with the reusable chunk of code you're saving.

Bottleneck Navigator opens up a window that lets you see all the components in your definition, sorted by their "Runtime" - how long it took them to execute. You can click on any item in the list and zoom to it instantly - so that you can find opportunities for optimization in your definition.

Download it here!

Load Previous Comments
  • Martin Siegrist

  • Andrew Heumann

    eh... I just don't really like that. keyboard and mouse events get nasty real fast. I'd rather not mess with it in MetaHopper. I couldn't even get that GameTools example working. ¯\_(ツ)_/¯

  • Andrew Heumann

    Never mind got it working. Still don't like it very much :-p

    That pop-up winform is a nasty hack... 

  • Martin Siegrist

    Then I did this.

  • Andrew Heumann

    ahhhh timers are the devil

  • Martin Siegrist

    hahahahaha

  • Andrew Heumann

    At least use events like this:

    KeyListener.gh

    :D

  • Andrew Heumann

    (you can edit that script to tell it what keys to listen to. right now it works for F7 and F8)

  • Martin Siegrist

    I'm not a programmer unfortunately, so I hope someone creates a keyboard activated slider for a future GH version

  • Andrew Heumann

    did my script work for you at least? if you want something more streamlined we can set it to point more directly to the sliders...

  • Martin Siegrist

    Yes the script works but the next problem of course is the counter... I used a state detection before, but that doesn't work now. Basically the script should make the slider go up 1 unit or down 1 unit at a time. I got your script to go up two units at a a time, my guess is that it records when I press and when I release the key?

  • Andrew Heumann

    yeah, you can either comment out the lines in that script that add /remove events for "Key Up" - or just use the attached which modifies a slider itself. KeyListener.gh

  • Martin Siegrist

    Cool man! Thanks for making my life a bit easier

  • Martin Siegrist

    Andrew, to extend my possibilities in Grasshopper, which programming language should I learn first?

    I've done a tiny bit of python scripting. Basically playing around with examples and adapt scripts a little bit but I'm far from being able to come up with my own code... But then apparently some stuff is inaccessible through python and I'd need to know about C#?

    Any tips?

  • Andrew Heumann

    Hey Martin. Personally, I like C# best - but this is largely a personal preference. See my extended thoughts on the matter here: http://www.grasshopper3d.com/forum/topics/which-scripting-language-...

  • huntan

    Hi guys, just a minor question, how do I get the MetaHopper menu bar as used in #10 in the vimeo video? 

    Thanks.

  • Andrew Heumann

    Hi huntan - if you install MetaHopper it will show up.
  • huntan

    Thanks. I guess I had to restart rhino for it to appear.

  • Vongsawat Wongkijjalerd

    SelObj can't seem to handle Objects that are changing too fast.
    It can still see the Param, but with 20ms timers or active slider manipulation, It can sometimes (or always) output with 0 items.. Is there a way to get around this?

  • Andrew Heumann

    Hi Vongsawat - can you explain what you're trying to do here? How and when are you refreshing the get param data component? If it executes while the other components are still solving it makes complete sense that it would not retrieve any value.
  • Vongsawat Wongkijjalerd

    I have a bunch of data inputs that update at different rates, but I only want the main portion of my code to trigger when I say so (at random intervals)
    I had thought using these components would solve this handily as SelObj would only grab the data whenever Expire turned true, but I can't have it output (and so trigger the entire code) with weird null-results, if that makes sense?
    D'you think that's possible with MetaHopper? I've tried dipping my toes in to VB scripting but I've no background in VB at all so quickly got scared off.

  • Andrew Heumann

    Vongsawat - I tried to rebuild your pictured definition but I am not able to reproduce the problem. Can you upload a file? 

  • Vongsawat Wongkijjalerd

    two versions: The top one runs at 20ms, apparently too fast at least for my pc. The bottom one runs haphazardly as every 4th or so result is a null-result, sometimes more.

    dataTrigger.gh

  • Andrew Heumann

    Well Vongsawat, this one had me really puzzled. Every time I opened YOUR definition, it didn't work, and every time I reconstructed your definition, it worked without fail. Here is what I think is happening:

    Grasshopper can only be computing one "Solution" at a time. In every solution, it only calculates "Expired" components - so that it avoids recalculating stuff which hasn't changed. The timer handles "expiring" the counter and scheduling a new solution - and so does the "Expire objects" component. Within a given solution, normal GH logic dictates that "upstream" components calculate first, and then passes that data long to other components further downstream. Now, since your metahopper rig does not involve conventional "wired" connections, there is nothing to tell grasshopper that the chunk of components with the counter needs to solve prior to the "param data" component retrieving the contents of the param downstream. Here is the really strange bit: In the absence of wired chains of dependency, Grasshopper decides which components should solve first BASED ON THEIR DRAW ORDER on the canvas. This means that, if you take your group of components with the counter and "Send to back" - everything works as expected. If you "Bring to front" you will consistently get an empty list from the param.

    I think the reason your lower set occasionally returns proper values is that you click the "expire" at just the right time to insert a complete solution IN BETWEEN the solutions triggered by the counter/timer combo. With the upper configuration + faster timer, this is next to impossible.

    So - all this is to say - by messing with the draw order, you may be able to cause this rig to work predictably - make sure you "bring to front" on all the metahopper components and "send to back" on the stuff you are listening to, in order to force it to compute first during any given solution. If this does not work, some sort of custom script may be necessary... but this strikes me as highly difficult.

    I'd also like to suggest an alternative approach: you may find that using the data dam set to "Never" in a situation like this is preferable. It will circumvent solution logic such that even as the upstream components expire, the data is only passed through (and the downstream components expired) when you hit the "play" button. If you need to control this with a boolean value instead of the ui element itself, you can use metahopper "Set object value" on a data dam to cause it to recompute programmatically.

    Thanks for a truly interesting puzzle - hope one of these solutions will get you where you need to be!

    Best,
    Andrew

  • Andrew Heumann

    I should also mention that the Data Dam has an in-built "timer" of its own, that allows you to "throttle" your data as I think you're attempting to do.

  • Vongsawat Wongkijjalerd

    Huh, weird things when you try to circumvent core grasshopper design I guess..

    Throttling by Data Dam with boolean trigger is exactly what I'm trying for. (huh, setObjVal as opposed to expireObj threw me for a loop there) Thanks for the suggestion though!

    Would you know why, when I connect a Data Recorder to this, the first time triggering will always double-trigger?.. subsequent triggers act as expected, if I clear the Recorder, the first value triggers twice again. Whether the behaviour's coming from the Dam or the Recorder ..

  • Xavier AM

    Damn, MetaHopper is absolutely AWESOME! I wish I had known it from the time I started writing complex definitions, it would have saved days of work.

    I am just figuring out component by component what are their purposes,  I feel like a child on Christmas day :-) A special big up for the "Label Groups" and the "Bottleneck analyzer".

    Thanks Andrew for this really good job!

  • AJ

    hi Andrew, how do you use the enable / disable button (like in the gif) ? thnx

  • Martin Siegrist

    AJ, you need to group the button with another grasshopper component/s

  • Frans Magnusson

    Thank you Andrew, for taking grasshopper to the meta-level! Does gh store the time of creation for objects and parameters? In that case that would be super useful to access with your tools - trying to build a log functionality. 

    Cheers!

  • Andrew Heumann

    Hi Frans - as far as I know the time a component/object is created is not stored by grasshopper. What exactly do you have in mind to accomplish with this logging? maybe there's a way to hack it in as a special "mode" that listens while things are added? 

  • Frans Magnusson

    Well, I trying out ways to document the development of definitions in a diary of sorts by using text panels. It works really well to place them in a context on the canvas, but I would also like to gather them in a chronological order. Right now I have built a kluge that uses record-components - but it would save so much hassle with timing of events to add some kind of time stamp to each grasshopper object. Do you know if they have IDs you can key with a time value?

  • Jens Buch Johansen

    Hi Andrew

    Really a fantastic plug-in you have made here - but I have one small request. Is it possible that you could make a way to edit snippets once they have been saved? It's annoying to spend the time writing the description and finding the right icon only to notice that you forgot a small detail and have to start over :)

  • Andrew Heumann

    Hi Jens - unfortuantely because this uses the same mechanism as UserObjects in Grasshopper, I cannot modify it - it is subject to the same limitations as they are. 

  • Frans Magnusson

    I feel your pain Jens. Have started to write name nick and description in a textpad document that keep around for a couple of days - there is never such a thing as a final version :)

  • AJ

    HI Andrew, while learning the HUI, you have directed me for using the Metahopper plugin. following your video, can i find the exercise files in order to practice? that would be sweet.

    A

  • Vongsawat Wongkijjalerd

    Hi,
    I'm finding the Set Obj + Data Dam component invaluable :) I'm wondering if its possible to start/stop as well as clear the recorder remotely with Set Obj or something similar?

  • Doaa

    Hey Andrew,
    Save snippets crashes Rhino even after reinstalling it.
    Any ideas?
    Thank you
  • Andrew Heumann

    Hi Doaa - that seems strange. What sort of platform setup do you use? Anything unusual like parallels on a mac or something? What version of rhino / gh?
  • Jo Kamm

    Hi Andrew, 

    Have you looked into the possibility of controlling icon/text settings?  A selector like the wire control component would be great.  

    I use text settings for parameters acting as inputs and outputs (in a "best practice" style), and icons for pretty much everything else, so a selector would be handy.  

    Or perhaps this capacity already exists in Metahopper?  

    Thanks!

  • Vongsawat Wongkijjalerd

    Hm, does get/set-object not interface with the Data Recorder at all? :T

  • Linluz

    The 14_RelativePaths.gh in the Example Files(2017-Mar-08)of  MetaHopper needs Shutterbug, could you please tell me where can I download it?

  • Tobias Heimig

    Hey Andrew, 

    i am working on some custom components to automate grasshopper for a university project on the rwth. Is there a posibillity do get look inside some of your MetaHopper components ? 

    It is a gread PlugIn and i use it a lot but in this case i hope to understand how you work on the grasshopper namespace to manipulate it. It would be a big help for me if i could get look inside.

    Thank you very much for the PlugIn and for your help.

    Tobias

  • Andrew Heumann

    hi Tobias - 

    The MetaHopper source is not publicly available, but I am happy to answer any questions you have if there are specific things you're trying to do. 

  • Tobias Heimig

    Hi Andrew, 

    Thank you very much. In the moment i am working on a component which "packs" Grasshopperfiles ... what actually means it creats a new folder with the grasshopper, the rhino and all plugin files. I did the most of it but in the moment i have to use the meta hopper "assembly info" to get the names and Filepaths of the plugin files.

    I tried to find something in the SDK information but i was not really succsessful ... so if you could give me an idea how the assembly info works that would be really fantastic. 

    If you would give me an idea how i 

  • Andrew Heumann

    Hi Tobias - See attached for a version of the code I use to get library dependencies by traversing the Grasshopper document, in a c# scripting component.

    Traverse Dependencies.gh

  • Andrew Heumann

    You might also be interested in the Freighter project by the resident geniuses at Proving Ground - I think it does much of what you're attempting to do. 

  • Andre Philippi

    Hi. I really would like to try this component, but the download link keeps returning 404. Is there any other place where we can download it, please?

  • Amir Soltani

  • Andre Philippi

    Thank you Amir!