OmniJS is excellent - fast and cross-platform, and already covering most of the OmniGraffle model.
The main gap, for the automated drawing and reformatting of nested diagrams, is scripting access to the outline structure that is visually revealed in the left-hand outline panel of OmniGraffle.
This means that I either have to write special code to guess the structure of a diagram from a combination of the (unsorted, or perhaps edit-time sorted) shape.outgoingLines collection, and the physical positions of each shape (is this a top-down tree or a left-right ? or perhaps a radial diagram ?), or write JSON records into user data to remember the nesting structure of an external document on which a diagram was originally based.
Scripted access to the outline structure would greatly simplify and reduce the volume of code required, and would be more reliable too. (It would also give omniJS an edge over the AppleScript+JS interface, which also lacks access to the outline structure).
Might that look feasible ?
(I guess one implementation might be an outline-sorted variant of the existing shape.outgoingLines() property ?)
(or ideally, for me at least, something like a document.outlineIDs() method, returning a nested list of shape ids, representing the parent-child nesting structure displayed in the outline sidebar)
The outline as it appears in OmniGraffle for Mac’s sidebar is actually the result of a limited subset of the hierarchical layout algorithm, that gets rerun as needed. So there isn’t an easy way to present it as a stable property on graphics themselves.
What we can provide – and it sounds like this is actually better for you – is we’ve added a canvas.outlineRoot property, which will return an OutlineNode representing the current hierarchy. Each node has a node.graphic property (which for the root will be null), and a node.children property. All of these are in the same order/structure as in OmniGraffle for Mac’s outline sidebar. (And is available for scripting on iOS as well, even though there’s no user interface for displaying the info in this way on that platform right now.) Note that this is a separate temporary tree of objects - if you change connections between real graphics you’d need to ask the canvas for it’s outlineRoot again to get an updated set.
Oh, also! Note that if your graphics aren’t tree structured that this uses hierarchical layout’s heuristics to make a tree structure, so it isn’t quite the same thing as following .outgoingLines, since in non-trees some of the outgoing lines will be discarded for the hierarchy as we determine that they point up to ancestors instead, et cetera.