Hi everyone, I created DefinitionLibrary to solve the problem of discoverability and easy re-use of your useful Grasshopper logic, with version history.
I’m looking into adding snippets to this and I’d love your thoughts on two options I have - scroll down to see them below - and any other options you can think of.
Some background first:
When you use it to publish a file or cluster, it stores a copy of the file, plus meta data that you specify in the cloud.
It inserts a link to that inside the file/cluster you’re using locally. If a new version of any published cluster is available, it offers you the ability to update your local copy to that new version - now or at a convenient time for you later (or never).
That meta data is crucial of course because it means that you can easily find, in the cloud library, that very helpful file or cluster you created last year - and you can import it again to re-use or further develop as a new version.
DefinitionLibrary sees files, clusters and Hops definitions as all the same thing:
- a collection of interconnected GH components; in fact, the plug-in stores them all as .gh files in the cloud
It seems to me that snippets can also be treated this way. Whereas currently you can search for files or clusters, soon you’d be able to search for snippets to import onto your canvas, like this:
(note this screenshot has some SharePoint/OneDrive aspects which aren’t released yet)
Once you select & click import, it’ll be added to the currently-open file.
Now I come to the two options I’ve thought of so far for the actual mechanism for containing/associating the components into snippets: groups and sketch outlines.
Note that I do want to use standard parts of Grasshopper (no custom components) so that your work still functions if you uninstall DefinitionLibrary in the future.
Option 1: Groups - using standard Grasshopper groups as the container for a snippet
Mock-up:
When you go to Library → Publish, it will list ALL groups in the GH file (like it does for clusters/Hops now) and you can choose which one you’d like to publish as a snippet. This would mean you could publish multiple new snippets in one go, although the list of groups could be extremely long indeed.
After publishing, the group would have the standard DefinitionLibrary head-up display (name, version etc) appear above it like it does for clusters & Hops.
You can add components to this group or remove components like you would any other group and it would seem a natural conceptual fit to have groups used for snippets.
Since refactoring inside a group can be fiddly, I thought of an alternative, left-field idea:
Option 2: Sketch outlines - using a standard Grasshopper polyline on the canvas as the outline for a snippet
Mock-up:
Despite this option using polylines, which are added to the GH file using the Sketch tool, I would suggest that you wouldn’t need to draw the actual outlines - the plug-in could draw them for you around selected components through a menu action item.
This mechanism does mean you can only publish new snippets one at a time.
After publishing, the plug-in will draw the dashed line (which becomes part of the local file) and display the name & version head up display above the snippet outline.
Adding new components to this snippet would be as easy as positioning it inside the outline; DefinitionLibrary will recognise that as a change to the snippet - no need to explicitly add it to the snippet.
However, if there’s not enough room for this, I did have an idea in mind to offer new menu items that would have the plug-in automatically redraw the dashed outline to enclose the selected component(s):
What do you think?
It would be great to hear your thoughts, either here or in the DefinitionLibrary discussion forum: https://github.com/nicolaasburgers/definition-library-releases/discussions/37
Cheers - Nic