The Omni Group

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

Reply
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!
  Reply With Quote
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.
  Reply With Quote
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.
  Reply With Quote
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
  Reply With Quote
Awesome, thanks for the assistance!
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text label formatting jason.verly OmniGraphSketcher General 0 2013-01-08 12:17 PM
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 04:56 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.