One magnet on top, two magnets on bottom?

It’s a pretty common pattern to have one connection on the top and two connections on the bottom, is there some shortcut to configure the magnets this way?

IE, something like in the diagram below (I did “2 magnets per side” and added the top magnet manually)

There is not an option to quickly apply a magnet layout that specifically just has one magnet on the top and two on the bottom to an existing object, but you could make a stencil that uses that magnet layout.

Alternatively, though, you could use the “3 magnets per side” option, which can be assigned to a keyboard shortcut. This has the advantage of working for any given orientation, since each side will have the appropriate magnets for a singe centered connection or two connections that are evenly spaced. You can also always use the Magnet Tool to remove any of the excess magnets (just hold down the Option key) from this layout if needed.

Hope that helps!

1 Like

There is not an option to quickly apply a magnet layout

You don’t want to suggest a script assigned to keystroke ?

I would probably attach a script along these to a keystroke or Script Menu item.

Gives all selected shapes a one-above-two-below magnet pattern.

(A quicker way of applying a custom magnet pattern than getting entangled with mouse and UI, I think :-)

(function () {
    'use strict';

    var og = Application('OmniGraffle'),
        ws = og.windows,
        w = ws.length ? ws[0] : undefined;

    (w ? w.selection() : [])
    .forEach(function (g) {
        if (g.class() === 'shape') {
            g.magnets = [[0, -1.0], [-1.0, 1.0], [1.0, 1.0]];
        }
    })

})();

You can of course, adjust the position of the lower two magnets, for example:

g.magnets = [[0, -1.0], [-.5, 1.0], [.5, 1.0]]

Would give this:

1 Like

If you prefer AppleScript, setting the magnets of a single selected shape might look something like this:


tell application "OmniGraffle"
    tell front window
        set shp to item 1 of (selection as list)
        
        -- Top center, lower left, lower right
        
        set magnets of shp to {{0, -1.0}, {-1.0, 1.0}, {1.0, 1.0}}
        
    end tell
end tell

Ah, yup, that is definitely another great option, and certainly beats the options I shared. My prowess with scripting is only so so at best, so I’d overlooked that as a possibility. Thanks for sharing!

1 Like