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

 
Updating connectors after positioning shapes by script Thread Tools Search this Thread Display Modes
The default geometries of Automatic Layout's hierarchical layouts look odd to me – cognitively a bit distracting or noisy (parent nodes are not properly centred over their child ranges).

I have sketched a script that lays hierarchies out in a way that looks cleaner and simpler to me, but when linked shapes are repositioned by Applescript, the connectors are not automatically updated – they are left in a tangled mess.

I have found two ways to trigger a connector update – neither ideal, so I wonder if others have found better solutions.

1. Slightly nudge each shape in the layer, e.g.
Code:
repeat with oShape in shapes of lyrTree
    set {lngX, lngY} to origin of oShape
    set lstDelta to {lngX + 10, lngY - 10}
    set origin of oShape to lstDelta
    set origin of oShape to {lngX, lngY}
end repeat
2. Group all the involved shapes.
This is easily done in Applescript, and instantly triggers a connector update ...
Code:
set oGroup to assemble shapes of lyrTree
but I haven't found an Applescript technique for ungrouping ...

Any other ways of triggering a connector update without entailing a need to manually ungroup ?
 
To concretize,
before:

after:


Incidentally Automatic Layout gives this, which looks a little eccentric to me, and, as it happens, uses up slightly more horizontal space:



--

Last edited by RobTrew; 2011-10-27 at 08:31 AM..
 
An update on the line redraw bug (lines are not always correctly repositioned when connected shapes are moved by Applescript).

The trick may be to ensure that you always change both the X and Y coordinates of the shapes.

The early versions of my tree layout script only moved shapes 'sideways' leaving the 'vertical' positioning to automatic layout. Now that it has taken over both (axial and orthogonal) dimensions of shape positioning (to cope with a row gap bug in OG's automatic layout code) the connector redraw bug *seems*, touch wood, to have been avoided.

In short, when you set the origin property of a shape through Applescript, make sure that both the X and Y coordinates are (even if only fractionally) different from the existing values.

(I don't think that this is a superstitious belief ... Anyway, it seems to work :-)

--
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically resizing and positioning a OmniOutliner window RobTrew OmniOutliner 3 for Mac 2 2011-01-28 12:55 AM
Custom shapes in shapes inspector sunshine OmniGraffle General 4 2009-02-27 06:54 AM
Label positioning for each line-style? zerok OmniGraffle General 0 2007-11-16 12:50 PM


All times are GMT -8. The time now is 10:12 PM.


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