Magnets on lines
Hi, I'm trying to draw a timing diagram across two parallel lines that are vertical (indicating time flows downwards).
origin-ars.els-cdn.com/content/image/1-s2.0-S1573427712000239-gr1.jpg (cannot post http urls since im a forum newbie). When I use the line tool, to connect the two lines horizontally, I can only use the head/tail to connect to attach the horizontal line head/tail. How do I enable magnet points anywhere on the line? The connections in the inspection pane has the magnet point deselected. Do I need to manually create the magnet points with the magnet tool? Is there an easier way to do this? |
A simple straight line can only have 2 magnet points – at head and tail.
A multi-segment line, however, has a magnet at each segment boundary. One approach might be:[LIST][*][B]View > Magnets[/B][*]Hold down the shift key to constrain line drawing angles to multiples of 45 degrees[*]Make first click to start a straight line near the top of the canvas[*]Move down the canvas (keeping the shift key down) clicking once for every additional straight line segment[*]Dbl click to complete the line[/LIST] You should now have a vertical line with magnets at various points. |
Then, if you need more precision:[LIST][*]Select the multi-magnet line that you have created[*][B]Edit > Copy As > Applescript[/B][*]Paste into the Applescript Editor[*]Inspect the code and edit the segment point coordinates to the exact positions that you want[*]To make the code runnable, edit the first line so that it reads: [I]tell application id "OGfl"[/I][*]Rerun the code to create a more precise line, and delete the rough original[/LIST]
|
Ah excellent idea.
Thank you! |
1 Attachment(s)
And, of course, you can script various ways of adding one or more magnets to an existing vertical line.
sth like: [CODE]property pTitle : "Add Magnet(s) to vertical line" property pVer : "0.03" tell application id "OGfl" if (count of (windows where its id > 0)) < 1 then return tell front window -- READ THE EXISTING POINT LIST FROM ANY SELECTED LINE set lstSeln to selection if length of lstSeln < 1 then return set oSeln to first item of lstSeln if class of oSeln ≠ line then return set lstPoints to point list of oSeln set {{XFirst, YFirst}, {XLast, YLast}} to {item 1 of lstPoints, item -1 of lstPoints} -- PROMPT USER FOR NEW VERTICAL COORDINATES (comma delimited) set strCoords to text returned of (display dialog ("Enter Y coords for new magnets on selected line (comma-delimited if more than one) Current range: " & YFirst as string) & " - " & YLast default answer "0" buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel" with title pTitle & " ver. " & pVer) {} set lstNewY to my Commas2List(strCoords) repeat with i from 1 to length of lstNewY set item i of lstNewY to {XFirst, item i of lstNewY} end repeat -- ADD NEW MAGNETS AT SPECIFIED POSITIONS set point list of oSeln to my SortVerticalPoints(lstPoints & lstNewY) --AND ENSURE THAT MAGNETS ARE VISIBLE set magnets visible of its document to true end tell activate end tell on Commas2List(strCoords) set {dlm, my text item delimiters} to {my text item delimiters, ","} set lstNum to {} repeat with oPart in (text items of strCoords) try set end of lstNum to (oPart as number) on error display dialog oPart & " could not be interpreted as a number" buttons {"OK"} default button "OK" with title pTitle & " ver. " & pVer end try end repeat set my text item delimiters to dlm lstNum end Commas2List on SortVerticalPoints(lstPoints) set strLines to my NumList2Lines(lstPoints) set strSorted to do shell script "echo " & quoted form of strLines & " | sort -k 2 -n" set lstPoints to my Lines2NumList(strSorted) end SortVerticalPoints on NumList2Lines(lst) set {dlm, my text item delimiters} to {my text item delimiters, tab} repeat with i from 1 to length of lst set item i of lst to item i of lst as text end repeat set my text item delimiters to linefeed set strLines to (lst as text) set my text item delimiters to dlm strLines end NumList2Lines on Lines2NumList(strLines) set lstLines to paragraphs of strLines set {dlm, my text item delimiters} to {my text item delimiters, tab} repeat with i from 1 to length of lstLines set lstNums to text items of item i of lstLines repeat with j from 1 to length of lstNums set item j of lstNums to item j of lstNums as number end repeat set item i of lstLines to lstNums end repeat set my text item delimiters to dlm lstLines end Lines2NumList [/CODE] [COLOR="White"]--[/COLOR] |
Finally, in principle you should be able to add these junctions/magnets by CMD-clicking at new points on the line.
Good enough for approximate work, but for some reason it seems to generate slight horizontal inaccuracies on my system … (holding down the SHIFT key should reduce them) (If you select a magnet node, and kept the SHIFT key down, you should be able to drag the node to a new vertical position without introducing a kink into the line) [COLOR="White"]--[/COLOR] |
All times are GMT -8. The time now is 06:19 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.