OmniGraffle Edit > Select offers ancestors and descendants but not siblings and cousins.
Here is a rough draft of a script which selects all shapes or lines at the same level of nesting (same rank/row) as the selected shape(s) and or line(s). (A whole generation of links and/or shapes within the tree).
Here is a rough draft of a script which selects all shapes or lines at the same level of nesting (same rank/row) as the selected shape(s) and or line(s). (A whole generation of links and/or shapes within the tree).
Code:
property pTitle : "Select Peers" property pVer : "0.5" -- Ver 0.2 slightly more efficient -- Ver 0.3 slightly simpler -- Ver 0.4 exits with message if the graph is a loop -- Ver 0.5 intended to work with Lion FullScreen mode on run tell application id "OGfl" activate if my isFullScreen("OGfl") then set oWin to window 2 else set oWin to window 1 end if tell oWin -- QUIT IMMEDIATELY IF NOTHING IS SELECTED try set lstSeln to selection on error return end try -- GET THE DEPTHS (AND TREE ROOTS) OF ANY SELECTED SHAPES OR LINES set lstLevels to {} repeat with oSeln in lstSeln set lstAncestors to {} set oLevel to my GetLevel(oSeln, 1, lstAncestors) if first item of oLevel is missing value then display dialog "Not a tree - loop detected" buttons {"OK"} default button "OK" with title pTitle & " ver. " & pVer return end if set end of lstLevels to oLevel end repeat -- LIST OTHER SHAPES OR LINES AT THE SAME LEVEL BENEATH THE SAME ROOT set lstSeln to {} repeat with oLevel in lstLevels set {cClass, oRoot, lngLevel} to oLevel set lstSeln to lstSeln & my LevelGraphics(oRoot, cClass, lngLevel) end repeat -- SELECT THE PEER SHAPES OR LINES set selection to lstSeln end tell end tell end run -- GET THE DEPTH OF A GRAPHIC UNDER THE ROOT OF ITS TREE -- (CALL AT TOP LEVEL WITH 1 AS A lngBaseLevel ARGUMENT on GetLevel(oGraphic, lngBaseLevel, lstAncestors) tell application id "OGfl" tell oGraphic set lngID to id if lngID is in lstAncestors then return {missing value, missing value, missing value} end if set cClass to class if cClass is shape then if incoming lines ≠ {} then return my GetLevel(source of first incoming line, lngBaseLevel + 1, lstAncestors & lngID) else return {cClass, oGraphic, lngBaseLevel} end if else if cClass is line then set {_, oGraphic, lngBaseLevel} to my GetLevel(source, lngBaseLevel + 1, lstAncestors & lngID) return {cClass, oGraphic, lngBaseLevel} else return {missing value, missing value, 0} end if end tell end tell end GetLevel -- RETURN THE SHAPES AT A CERTAIN DEPTH BELOW THE SPECIFIED ROOT on LevelGraphics(oRoot, cClass, lngLevel) tell application id "OGfl" if lngLevel = 1 then if cClass ≠ shape then return (incoming lines of oRoot) as list else return {oRoot} end if else set lstLevel to {} repeat with oChild in (destination of outgoing lines of oRoot) as list set lstLevel to lstLevel & my LevelGraphics(oChild, cClass, lngLevel - 1) end repeat return lstLevel end if end tell end LevelGraphics on isFullScreen(strAppID) tell application "Finder" to set blnPreLion to (version < "10.7") if blnPreLion then return false else tell application id "sevs" set lstApps to application processes where creator type = strAppID if length of lstApps < 1 then return false set lstWins to windows of first item of lstApps if length of lstWins < 1 then return false return value of attribute "AXFullScreen" of item 1 of lstWins end tell end if end isFullScreen
Last edited by RobTrew; 2012-01-07 at 11:40 AM.. Reason: Ver 0.5 should now work with Lion FullScreen window