View Single Post
Good point, and even if you are doing this by working with shape properties rather than line properties (setting shape magnet positions rather than setting the head/tail magnets of lines), you may still need to explicitly clear any pre-existing head/tail magnet settings.

Rotated trees:
Code:
property plstEastWest : {{1.0, 0.0}, {-1.0, 0.0}}
property plstNorthSouth : {{0.0, -1.0}, {0.0, 1.0}}
property plstMagnets : {plstEastWest, plstNorthSouth}

property plstHorizOrigins : {{275, 225}, {400, 170}, {400, 275}}
property plstVertOrigins : {{620, 160}, {675, 280}, {570, 280}}
property plstOrigins : {plstHorizOrigins, plstVertOrigins}


tell application id "OGfl"
	set recLineProps to {line type:orthogonal, stroke color:{1.0, 0.0, 0.0}}
	tell canvas of front window
		set {iFirst, iLast} to {1, 3}
		repeat with i from 1 to 2
			set lstOrigins to item i of plstOrigins
			
			-- EAST WEST IN FIRST CASE, THEN NORTH SOUTH
			set lstMagnets to item i of plstMagnets
			
			-- MAKE THE SHAPES
			repeat with j from 1 to 3
				make new shape at end of graphics with properties {corner radius:5, draws stroke:false, size:{90, 90}, origin:item j of lstOrigins, magnets:item i of plstMagnets}
			end repeat
			
			-- AND MAKE THE CONNECTIONS
			set {shpParent, shpChild, shpSibling} to items iFirst thru iLast of (shapes as list)
			connect shpParent to shpChild with properties recLineProps
			connect shpParent to shpSibling with properties recLineProps
			
			-- IN SOME CASES YOU MAY NEED TO CLEAR ANY PRE-EXISTING HEAD OR TAIL MAGNET SETTINGS 
			-- AS A PRECAUTION
			tell lines to set {head magnet, tail magnet} to {0, 0}
			
			-- PREPARE FOR NEXT LOOP
			set {iFirst, iLast} to {iFirst + 3, iLast + 3}
		end repeat
	end tell
end tell