Feature Request: Shortcuts for aligning components in GH

unhandled

(Henry Langner) #1

Hello Makers of Grasshopper!

I like GH very much since it is very powerful. It provides the possibility for huge definitions, which are however likely to become spaghetti muddles. One way to prevent this is aligning components. This is already partly implemented, as multiple selected components can be aligned by small buttons. Additionally, there is a lock mechanism that makes it easy to get straight cables.

I would like to present three suggestions to make aligning components even easier:

First: Please make it possible that the lock mechanism is also available for multiple selected components and groups. I like straight cables and if I want to have many consecutive components aligned, I have to move them individually.

Second: When working on the canvas, it would be useful to have shortcuts for alinging selected components. Maybe r for right, l for left, u for up, b for bottom, c for hrizontally centered and e for vertically centered. (These are, by the way, the same shortcuts that are used by CorelDraw.)

Third: Please provide some kind of grid, where components can stick to, if the user wants it.

Greeting from Berlin, Germany
Henry


(David Rutten) #2

Just straight up keys are not really possible, as keypresses (unless they are menu shortcuts which always involve a modifier along with a character key) are send directly to the Rhino command line. Arrow keys might work though.

It is very unlikely that grid snapping would yield straight wires, which is why I didn’t try to implement it.

I’d mostly like to focus on providing more manual snapping constraints (vertical distance between boxes, box edge alignments, wire unit length increments), a bit more standardisation in component box sizing (right now it’s heavily dependent on the sizes of input/output names, making all components ever so slightly different in size), and some auto-layout tools, probably based on the Kangaroo solver.


#3

In addition to force-based graph layout algorithms (assuming that’s what you meant), it might make sense to also look into hierarchical graph layout algorithms (Dynamo has something like this working somewhat). I suspect that the types of graphs one develops in GH (i.e. hierarchical DAGs) lend themselves well to such algorithms (as opposed to classical force-based, but perhaps Kangaroo is implied here as more of a constraint solver).

Edit: I’ve probably pimped this here before, but I’ve been using DOT/GraphViz quite a lot for automated graph drawings (thanks to a tip from @will) such as this one and the ones seen here (on the left). Might be worth looking up the white papers and source perhaps.


(David Rutten) #4

When it comes to auto-layout there’s both the perform-layout-on-the-entire-file and clean-up-what-I’ve-done-so-far approaches. I assume people have quite strong feelings about where they want certain components to be, so throwing all that manual positioning away and doing a full auto-layout is not something that you’ll want often. Perhaps when you get a file from someone else that’s a mess…


#5

Totally, untangling spaghetti on the fly to “reveal” the inherent algorithmic logic one has built (and maybe refactor based on that) and keeping things neat and tidy, is probably the most apparent use-case scenario I can see as well… and untangling big muddy balls from hell of course :grimacing:

Edit: Auto-inserting relays might also be part of this, as I recall someone on the old forum was looking into all this come to think of it, using Kangaroo as well.


(Henry Langner) #6

:heart_eyes: