I know how to add magnets and delete magnets, but it's been impossible to get them to be aligned exactly the same on my rectangle and to be distributed evenly. How can I select multiple magnets and perform these functions?
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!
|
|
FAQ | Members List | Calendar | Today's Posts | Search |
Insert 16 magnets (8 couples) centered and evenly distributed | Thread Tools | Search this Thread | Display Modes |
Member
2012-01-19, 02:51 PM
I know how to add magnets and delete magnets, but it's been impossible to get them to be aligned exactly the same on my rectangle and to be distributed evenly. How can I select multiple magnets and perform these functions?
Post 1
|
Member
2012-01-19, 03:41 PM
Is this an example of what you are trying to achieve? I just used the Properties : Connections editor and selected the choice for 4 magnets on each side.
If this isn't what you are looking for, how about posting a picture?
Post 2
|
Member
2012-02-18, 04:46 PM
Ideally, specifying a unique number of magnets per side would be possible, with the default behavior being even distribution along each side.
I wouldn't find it inappropriate to limit the polygon [max. # of sides] to 4, but the overall facility would be a huge improvement. Further, a subgroup feature, allowing groups of magnets to be "clumped" (e.g.: 2 sets of 6 magnets, 2 sets of 2 =16 connections, subgroups, with weighted distribution, maintaining a ratio of >4:1 distance between subgroup separation and group member separation. Last edited by vidmaven; 2012-02-18 at 05:26 PM..
Post 3
|
Guest
2012-02-18, 11:43 PM
Here is an example of how to specify 16 evenly distributed points for the selected shape(s). You can add or reposition custom points by specifying them in virtual coordinates that extend from top left {-1.0, -1.0} down to bottom right {1,1}.
This script gives the cardinal directions, the four corners, and midpoints between corners and edge centres. You can adjust the point lists to whatever you like. There is no need for any kind of symmetry. Code:
-- SIMPLE MAGNET EXAMPLES, North-South, East-West, and four corners property plstNSMagnets : {{0.0, -1.0}, {0.0, 1.0}} property plstEWMagnets : {{1.0, 0.0}, {-1.0, 0.0}} property plstCornerMagnets : {{1.0, 1.0}, {1.0, -1.0}, {-1.0, -1.0}, {-1.0, 1.0}} property plstQuarterPoints : {{-0.5, -1}, {0.5, -1}, {1, -0.5}, {1, 0.5}, {-0.5, 1}, {0.5, 1}, {-1, 0.5}, {-1, -0.5}} tell application id "OGfl" tell front window repeat with oGraphic in (selection) as list if class of oGraphic = shape then set magnets of oGraphic to plstNSMagnets & plstEWMagnets & ¬ plstCornerMagnets & plstQuarterPoints end if end repeat end tell end tell Last edited by RobTrew; 2012-02-19 at 12:36 AM..
Post 4
|
Guest
2012-02-19, 08:20 AM
And for radially even spacing of the magnets (on a circle shape, for example) you could calculate the coordinates:
Code:
property plngMagnets : 16 property prStartDegrees : 360 / 32 on run set lstMagnets to RadialMagnets(plngMagnets, prStartDegrees) tell application id "OGfl" tell front window repeat with oGraphic in (selection) as list if class of oGraphic = shape then set magnets of oGraphic to lstMagnets end repeat end tell end tell end run on RadialMagnets(lngN, rStartDegree) if lngN < 1 then return {} set lstMagnets to {} set rTheta to rStartDegree set rDelta to 360 / lngN repeat with i from 1 to lngN set end of lstMagnets to {sin(rTheta), -(cos(rTheta))} set rTheta to rTheta + rDelta end repeat return lstMagnets end RadialMagnets on sin(rDegrees) (do shell script "echo 's(" & (rDegrees / 180) * pi & ")' | bc -l") as number end sin on cos(rDegrees) (do shell script "echo 'c(" & (rDegrees / 180) * pi & ")' | bc -l") as number end cos Last edited by RobTrew; 2012-02-19 at 12:21 PM.. Reason: Made the code slower but more legible ... :-)
Post 5
|
Member
2012-02-20, 09:04 AM
Great stuff! Thanks, Rob!
In the first example you provide, are the coordinates applied to each of 2 parallel sides(e.g.: NS)? To be honest, I hadn't looked into scripting for 'Graffle - good to know. I was somewhat surprised to find that magnets don't Snap to Grid. Regarding the scripting example, is consistency of magnet spacing maintained if the rect is resized? Thanks! bt
Post 6
|
Guest
2012-02-20, 09:54 AM
The coordinates are those of a virtual square with top left and bottom right corners at -1,-1 and 1, 1
In the application of the magnets, shapes are treated as transforms of such a square. North and South have to be applied separately. There is no automatic mirroring. Probably best to look at the coordinates specified in the script, and get a sense of how they relate to the 3 resultant thumbnails below. -- Last edited by RobTrew; 2012-02-20 at 10:02 AM..
Post 7
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to distribute objects evenly vertically/horizontally? [A: Alignment Inspector] | johnlawrence | OmniGraffle General | 6 | 2012-06-04 05:03 AM |
Evenly distributing magnets | Kaz219 | OmniGraffle General | 0 | 2009-02-26 03:46 AM |