Given a user-data key, OG 7.3 (Test) 177.3.0.283059 already provides good access to the corresponding value for a shape.
I think it might be very useful, however, to add a graphic.userData() function for omniJS here, for direct reading of the userData dictionary itself.
This is already possible in AppleScript and JXA, and allows us to ask what user data keys a graphics has, or to get all of its data in one move.
e.g. JXA
or AS:
(() => {
'use strict';
const userData = Application('OmniGraffle')
.documents.at(0)
.canvases.at(0)
.graphics.at(1)
.userData();
return Object.keys(userData);
})();
use framework "Foundation"
on run
tell application "OmniGraffle"
tell first canvas of first document
set recData to user data of item 2 of graphics
end tell
end tell
keysOfRecord(recData)
end run
on keysOfRecord(rec)
set ca to current application
(ca's NSDictionary's dictionaryWithDictionary:rec)'s allKeys() as list
end keysOfRecord