The Omni Group
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!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Label the area of an object Thread Tools Search this Thread Display Modes
Hello,

I have a square and/or rectangle. I'd like graffle to set the label of the object to the area of that object. I know I can do the <%length> and <%width%> variables, but is there anyway to get the area? I tried x and * between those two variables, but it's doesn't multiply them.

Thanks!
 
Do all of your squares and rectangles merit this treatment, or just a select few? It should be possible to put together an Applescript you could run which would so label all of the squares and rectangles, or perhaps all of the selected squares and rectangles.
 
Quote:
Originally Posted by whpalmer4 View Post
Do all of your squares and rectangles merit this treatment, or just a select few? It should be possible to put together an Applescript you could run which would so label all of the squares and rectangles, or perhaps all of the selected squares and rectangles.
Oh that's interesting. For this particular diagram, all squares/rectangles will be labeled with their area.
 
Well, here's a quick hack that should label all rectangles on the current canvas of the front window with their size in square inches. Adjust the value of pScaleFactor accordingly if you want to use a different unit.

Code:
property pTextSize : 14 -- desired font size for label
property pScaleFactor : 72 -- conversion factor from internal size units to inches

tell application "OmniGraffle 5"
	tell canvas of front document
		repeat with _shape in graphics
			if (class of _shape is shape) then
				if (name of _shape is "Rectangle") then
					set {_length, _width} to (size of _shape)
					set _shapearea to (_length * _width) / (pScaleFactor * pScaleFactor)
					set text of _shape to {text:(_shapearea as text), size:pTextSize, alignment:center}
				end if
			end if
		end repeat
	end tell
end tell
 
Awesome, thanks for the assistance!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to label tasks individually? sam OmniPlan General 1 2009-12-23 10:13 PM
Selecting one object behind another object grewt OmniGraffle General 2 2008-06-16 11:43 AM
Make label below icon tji OmniGraffle General 3 2008-01-02 08:18 AM
'Within the next week' label confusing? bartv OmniFocus 1 for Mac 2 2007-12-13 08:45 AM


All times are GMT -8. The time now is 11:37 PM.


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