The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Script: Tree Tool - quick formatting and layout of OG hierarchy diagrams Thread Tools Search this Thread Display Modes
A generalised tool which gives:
  1. Clearer orthogonal layouts for OmniGraffle hierarchical diagrams,
  2. correction of automatic layout's row separation bug,
  3. very quick formatting of OG trees (tree directions, shapes, fills, strokes, shadows, sizes etc) using simple typed commands (see below).
For use with or without LaunchBar. (With LaunchBar, passing '?' as a parameter will display a simple help file).

Offers orthogonal trees (parents centered over children), as an alternative to the non-orthogonal tree layouts which are generated by OG's Graphviz-based Automatic Layout. Also corrects rank separation errors created by a known bug in the code of Automatic Layout (uneven gaps between rows).
With the c=false switch, it can be used for quick formatting, and row gap error correction, with Automatic Layout's own non-orthogonal layouts.

(A spin-off from an earlier script, which it replaces).

(The Graphviz engine supports orthogonally-styled links, but not, as yet, orthogonal trees, in which the line descending from parent to the centre of the children-line hits that line at 90 degrees this happens to be the kind of tree that my own work frequently requires. Hitherto I have been resorting to, which is decoratively less sophisticated, but has translated text outlines into true orthogonal trees since the early 90s, and also offers graphic tree-folding, hoisting etc.).

(NB It is important to back up your diagrams before experimenting with this draft script).

The current option switches (used in the dialog, or from LaunchBar) are:

Direction of tree layout:
d=[t|l|r|b] ( top-down, left-right, right-left, bottom-top )
Size of shapes:
w=+10 ( increase )
h=-10 ( decrease )
(wh|hw sets both)
Gaps between Rows and Objects (in points, not inches):
Type of shapes:
s= (no shapes - plain text rectangle - no border, no filll, no shadow)
s=somestring etc
( example: s=cir for circles )
s=? (choose from list)
Type of links:
l=[b|c|o|s] ( bezier, curved, orthogonal, straight )
a= (none)
a=[h|t|b|n] ( at head, tail, both, or neither )
m= (none)
m=[nsew|ns|ew|corners|c|8] ( North-South East-West etc)
[note that the script automatically adjusts magnets when it changes the layout direction of an orthogonal tree]
Stroke of shapes:
ks= (no stroke)
ks=? (pick color)
Stroke of lines:
kl= (no stroke)
kl=3 (3pt)
kl=+1 (increment)
kl=? (pick color)
Fill of shapes:
f= (no fill)
f=[n|s|l|r] (none, solid, linear, radial)
f=? (pick color)
Shadow of shapes:
shs= (no shadow)
shs=- (no shadow)
shs=? (pick color)
Shadow of lines:
shl= (off)
shl=? (pick color)
Corner radius:
[crs | scr] (corner radius of shapes)
[crl | lcr] (corner radius of lines)
cr (corner radius of both shapes & lines)
Script behavior:
u=t ( force link updating=true )
c=f ( center parents over children=false )
c= (ditto)
c=true (center parents over children)
c=t (ditto)
Multiple options:
Separate with a single space
l=o r=30 d=l o=5
(=links:orthogonal, row gap 30pt,
Left-Right tree, 5pt gap between objects
Attached Files
File Type: applescript TreeTool-148.applescript (59.8 KB, 335 views)

Last edited by RobTrew; 2012-01-07 at 02:24 PM..
Updated to accept cm and inch measurements in the formatting and separation commands, as well as in the default points.

(In addition to warning if a diagram is not a tree, it now also draws attention to any closed loops (cycles) and switches off orthogonal layout accordingly).
Ver 1.0 fixes some layout issues with particular tree geometries.
Ver 1.08
  • Adds text-size adjustments,
  • generalizes some fixes for particular layout issues,
  • allows for further abbreviation of commands (r+10 ts-1) etc,
  • and only re-runs automatic layout after commands which require it [c- d=l r+5 o-2 u+ etc], allowing for quicker adjustments to formatting issues which don't affect layout.

Note that the simple command c- is like running OG's built-in Automatic Layout but correcting errors introduced by its known row separation and object separation bugs (ie ensuring that row gaps and node gaps are consistent, and are as specified in the Automatic Layout inspector).

(c+ does the same, but also changes the layout to ensure that there are no dog's leg connectors to single children, and that all parents are symmetrically centered over their child ranges)


Last edited by RobTrew; 2011-11-23 at 11:42 AM..
Ver 1.30
  • Adds sub-tree operations to the target command. You can limit the scope of all formatting operations either to the sub-tree(s) of any selected shapes or lines, or to all shapes outside those sub-trees.
    t=t (formatting target is sub-tree)
    t=x (formatting target is all except sub-tree)
  • Adds text color operations - you can use a color picker tc=?, specify a grey scale numerically tc=.6, tc=60%, or tc=32767, clear colors to black tc=, or just specify red tc=r :-)
  • Fixes a few tree layout issues for special cases.


Last edited by RobTrew; 2012-01-02 at 01:37 AM.. Reason: ver 1.35 further added row/level operations
Ver 1.36
  • Adds row/level operations. t=r specifies the formatting target(s) as all shapes/lines on the same level as the selected shapes/lines.
  • Fixes abbreviated commands (ts+ lk- etc) for sub-tree and level targets.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script: Generate radial diagrams from outlines RobTrew OmniGraffle General 3 2012-09-03 11:26 AM
Odd behavior - line tool rearrances shapes? [A: template with auto-layout enabled was chosen] erickhill OmniPlan General 2 2012-06-27 02:02 PM
Script: clearer layout for orthogonal trees RobTrew OmniGraffle General 3 2011-10-31 01:10 PM
Script for formatting size based on incoming lines muntzing OmniGraffle General 7 2010-10-14 06:28 AM

All times are GMT -8. The time now is 10:05 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.