Label the area of an object
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=whpalmer4;114692]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]
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 [/code] |
Awesome, thanks for the assistance!
|
All times are GMT -8. The time now is 09:20 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.