Is there any way to include Object Names in SVG export?

I’m drawing a picture and I hope to use it on the Internet. For this, SVGs would be great! And they are. My document exports as SVG just fine and renders nicely on my browser.

However, there are no good ways to refer to the objects on the canvas programmatically on a web page. I would like to do some javascript to change the colors of boxes and make mouse hovers and other actions possible. For this, I have named all objects in my document in OmniGraffle, but unfortunately these names do not carry over to the exported SVG file. Would there be any way to get object identifiers to the SVG file? Even if it’s programmatically through the JS interface on a Mac?

It would enable really easy and nice looking interactive web graphics through OG - I feel this is a feature with a lot of potential. If you want, I can write a demo to show what could be done here on the thread.

1 Like

As an example document:

I named all the objects similar to what the label says on the objects.

When I export it as SVG, I get:

<text transform="translate(233 309.264)" fill="black">
    <tspan font-family="Helvetica Neue" font-size="16" font-weight="500" x="21.368" y="15" textLength="67.264">The Boss</tspan>
</text>
<path d="M 230 384.488 L 346 384.488 C 347.10457 384.488 348 385.38343 348 386.488 L 348 442.488 C 348 443.59257 347.10457 444.488 346 444.488 L 230 444.488 C 228.89543 444.488 228 443.59257 228 442.488 L 228 386.488 C 228 385.38343 228.89543 384.488 230 384.488 Z" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/>

The label is there just fine, but the actual object that’s being drawn has no identifier. It could have an SVG group around it as the identifier, or simply have an id on the path itself. Currently I have no practical way to refer to the object in javascript.

I would go straight to Help > Contact Omni from the OG menu with that one – I can’t immediately see anything like a user-editable XSLT sheet …

  1. I would support that request as an enhancement.
  2. (Quite separate to [1] .) That (the label, the “object name”) should be a standard element of every object or group. Not only in any export (PDF, SVG, etc) but in the plist file as well. It is a royal pain in the backside to marry the label to the object when extracting them, because they are not married in OG (any file) but they are married in the OG diagram, which is the intent of the diagrammer.