The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Center on page? (http://forums.omnigroup.com/showthread.php?t=30711)

RobertF57 2013-08-23 01:11 PM

Center on page?
 
Is there any way, after one selects all the objects on the page, to tell OG to take that entire "block" of objects and center the block on the page?

john.gersh 2013-08-26 06:41 AM

Group the objects.
Center the group on the canvas in the normal way.
Ungroup them.

RobTrew 2013-09-05 12:49 AM

If it proves cumbersome to repeatedly:[LIST][*]group the selected shapes,[*]attend to the options of the alignment inspector,[*]and then ungroup,[/LIST]
you could assign a script to a keystroke or a Launchbar/Alfred trigger:

[CODE]property pTitle : "Move selected graphics to centre of 1st canvas page"
property pVer : "0.01"
property pAuthor : "Robin Trew"

--CENTRE THE SELECTED BLOCK OF GRAPHICS ON THE FIRST PAGE OF THE OMNIGRAFFLE CANVAS

on run
tell application id "OGfl"
tell front window to set {oCanvas, lstSeln} to {its canvas, selection}

-- FIND THE CENTRE OF THE SELECTION(S)

-- Find horizontal and vertical minima and maxima of the selected shapes
set {rXMin, rXMax, rYMin, rYMax} to {10 ^ 6, 0, 10 ^ 6, 0}
repeat with oGraphic in lstSeln
tell oGraphic to set {{rX, rY}, {rAcross, rDown}} to {origin, size}
set {rRight, rBottom} to {rX + rAcross, rY + rDown}

if rX < rXMin then set rXMin to rX
if rRight > rXMax then set rXMax to rRight
if rY < rYMin then set rYMin to rY
if rBottom > rYMax then set rYMax to rBottom
end repeat

-- and derive an aggregate centre of the selected shapes
set {rMidSeln_X, rMidSeln_Y} to {(rXMin + (rXMax - rXMin) / 2), (rYMin + (rYMax - rYMin) / 2)}

-- GET THE X,Y DELTAS BETWEEN THE SELECTION(s) CENTRE AND THE PAGE CENTRE
tell oCanvas to set {rPageAcross, rPageDown} to page size
set {rDeltaX, rDeltaY} to {(rPageAcross / 2) - rMidSeln_X, (rPageDown / 2) - rMidSeln_Y}

-- TRANSLATE THE POSITION OF EACH SELECTED SHAPE
repeat with oGraphic in lstSeln
tell oGraphic
set {rX, rY} to origin
set origin to {rX + rDeltaX, rY + rDeltaY}
end tell
end repeat
end tell
end run

[/CODE]


All times are GMT -8. The time now is 02:48 AM.

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