The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   AppleScripting Omni Apps (http://forums.omnigroup.com/forumdisplay.php?f=46)
-   -   Crashes when scripting "group rank" property in OmniGraffle (http://forums.omnigroup.com/showthread.php?t=12770)

timcoffman 2009-06-14 05:26 AM

Crashes when scripting "rank group" property in OmniGraffle
 
Running the following code will crash OmniGraffle 4. I get the same results in OmniGraffle 5. This was obtained using the Copy As Applescript command.
[CODE]tell application "OmniGraffle Professional 4"
tell canvas of front window
make new shape at end of graphics with properties {origin:{166.0, 166.0}, size:{54.0, 36.0}}
make new shape at end of graphics with properties {origin:{317.0, 171.0}, rank group:1, size:{54.0, 36.0}}
make new shape at end of graphics with properties {origin:{83.0, 81.0}, rank group:1, size:{54.0, 36.0}}
make new shape at end of graphics with properties {origin:{234.0, 86.0}, size:{54.0, 36.0}}
end tell
end tell[/CODE]
I have tried a number of ways to set the "rank group" property, with no success. Any suggestions?

My goal is to organized a bunch of shapes to the same rank via scripting, in the same way that I would accomplish by selecting them in groups and clicking "Same" under "Object Rank" in the "Advanced Settings" of the "Canvas: Diagram Layout" inspector.

timcoffman 2009-07-09 06:50 AM

Workaround, but App Locks Up on Layout (Minimizing Crossings)
 
I have worked around this problem by[LIST=1][*]Tagging all objects with a value indicating their intended rank grouping[*]Selecting sets of objects via that tag value[*]Using System Events to click the "Same" radio button[/LIST]This achieves assigning the shapes to their proper rank groupings, still using entirely Applescript.

However, the next problem comes when I ask the canvas to do the Layout. If I first select the "Minimize Crossings" mode, the applications locks up, consuming 100% of the processor, and never performs the layout. I am leaping to the conclusion that it is hitting an infinite loop in the layout code caused by some conflicting constraints due to the object ranks.


All times are GMT -8. The time now is 07:56 AM.

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