OmniGraffle Extras
We’ve built a lot of extra goodies into OmniGraffle 6, including the ability to import and export files from other apps on your Mac. This is particularly important for users of Microsoft® Visio® or Adobe® Photoshop®, but you’ll need to upgrade to OmniGraffle Pro to import and export to these formats.
In addition to import/export, this section touches on some of the following advanced features of OmniGraffle:
- AppleScript support (requires OmniGraffle Pro)
- LinkBack support
- Using Regular Expressions in OmniGraffle
Importing from Other Applications
Several different file formats can be understood by OmniGraffle. You can import these files by opening them just as you would open a normal OmniGraffle file (File ▸ Open, or Command-O).
- (Pro) Microsoft® Visio® drawing files, templates, and stencils (.vsd, .vsdx, .vdx, .vst, .vtx, .vss, .vsx)
- Documents saved by Microsoft® Visio® diagramming software in its XML-based file format (and now even in its original binary file format) can be read by OmniGraffle Pro. Note that while you can open the binary format, you can’t export to it; you’ll have to save as an OmniGraffle diagram or export to the XML format. Also note that graphics in the Microsoft® Enhanced Metafile (EMF) format cannot be imported.
- PDF files (.pdf)
- There are two ways to import a PDF file into OmniGraffle:
- Use File ▸ Open and choose the PDF file you would like to work with. OmniGraffle attempts to import the PDF file as editable shapes.
- Drag a PDF file onto the Canvas. This places the PDF file as an image, over which you can add notes, annotations, and other standard OmniGraffle objects.
- DOT files (.dot)
- OmniGraffle understands a subset of the DOT language used by Graphviz. This isn’t a full implementation of DOT, but it can be quite useful.
- Diagram! 2 documents (.diagram2 and .dpalette2)
- Diagram is a NeXTSTEP/OPENSTEP application similar to OmniGraffle. OmniGraffle can import the objects in a Diagram file, but not attached EPS images, sounds, or links.
- OmniOutliner Documents (.ooutline and .oo3)
- When you open an OmniOutliner file, the items of the outline are interpreted as a diagram. A dialog appears; use it to indicate exactly how to interpret the outline: Use the pop-up list to choose a diagram style.
- OmniOutliner Documents (.ooutline and .oo3)
(Pro) Use the table to assign objects in the diagram style to columns in an outline. If you want to show multiple columns of information for each item, use a diagram style that has grouped objects. You can also assign a column to the objects’ notes.
(Pro) Choose whether to place the outline in a completely new document or in a new canvas on the open document.
- (Pro) Xcode projects (.xcode), Project Builder projects (.pbproj), and frameworks (.framework)
- OmniGraffle uses the Objective-C headers to construct a diagram of the inheritance, protocol, and category relationships.
- (Pro) Interface Builder nib files (.nib)
- OmniGraffle graphs the connections in the nib file for easy visualization.
- EOModeler files (.eomodeld)
- OmniGraffle creates a diagram of the database relationships described by the file.
- Folder structures
- Drag a folder from the Finder and drop it on OmniGraffle’s application icon to map out the folder’s contents as a diagram.
Exporting to Different Formats
You can create files of several different types from your OmniGraffle diagrams. Choose File ▸ Export (Option-Command-E). When you export, a new file is written to the disk, leaving your original document as it is on the screen. Of course, not all aspects of a diagram can be represented in all file formats.
The available file formats are:
- BMP bitmap image — A legacy graphics format.
- EPS vector image — Encapsulated PostScript. This is a common format in professional printing.
- GIF bitmap image — A legacy graphics format prevalent on the web.
- HTML image map — A hypertext file and a JPEG, PNG, or GIF image. URL actions in the original OmniGraffle document are coded into the image map as links so that the image can be clicked to follow them. (Note that actions on lines aren’t included, but actions on line labels are.)
- JPEG bitmap image — a popular compressed image format. You can lower the image quality to get a smaller file size.
- OmniGraffle Document (Pro) — an OmniGraffle document. You can make the file read-only (not editable), and you can choose to include linked images in the file so that they show up properly on someone else’s computer.
- OmniGraffle Stencil, OmniGraffle Template — Resources for OmniGraffle.
- OmniOutliner 3 — Represent the diagram as a text outline, using the connection lines between shapes to create a hierarchy. This doesn’t work as well for diagrams that don’t have strictly tree-like structures.
- PDF vector image — Portable Document Format. This is a nice cross-platform format that has good support for both vector components and bitmaps.
- PNG bitmap image — Portable Network Graphics, a popular format for the Web. This format uses lossless compression to retain the details of an image while decreasing its file size. It supports transparency.
- Photoshop® image (Pro) — Exports a layered .psd file that can be opened in Adobe® Photoshop®, or other graphics apps that can interpret a .psd file.
- SVG vector drawing (Pro) — An open Internet standard that uses XML.
- TIFF bitmap image — Tagged Image File Format. This format supports transparency.
- Visio® XML document (Pro) — The XML-based file format for the Microsoft® diagramming application.
Depending on the file format you choose, you have different options. Most offer an Export Area option, with which you can choose how much of the document to export.
- Current Selection — Only export the objects that are selected right now.
- All Objects — Export all of the objects on the canvas, but not the empty areas.
- Specific Region — Specify a precise region of the canvas to export.
- Current Canvas — Export the entire canvas.
- Entire Document — Export everything, creating one image file for each canvas.
Depending on the format you choose, you can also choose a scale for exporting smaller or larger than actual size, the resolution, the compression level, and whether to make the background transparent.
AppleScript Support (Pro)
OmniGraffle has extensive AppleScript support, making it easy for you to automate tasks within or to create entirely new OmniGraffle projects. To find out more about how OmniGraffle’s AppleScript object model and commands, launch AppleScript Editor (/Applications/Utilities, or use Shift-Command-U while in the Finder), choose File ▸ Open Dictionary, and then choose your version of OmniGraffle from the Open Dictionary dialog.
You can store AppleScripts in OmniGraffle’s scripts folder, for easy access from the Scripts menu. You can also attach scripts to individual objects on a canvas, using the Action inspector. When you activate the Browse tool, then click an object with a script attached, the script runs.
If you select some objects and then choose Edit ▸ Copy As ▸ AppleScript from the menu bar, you get the exact lines of AppleScript necessary to create those objects. This is a great way to learn how OmniGraffle’s AppleScript support works, or to add specific objects to your own scripts.
LinkBack
LinkBack is a way of embedding content between applications in such a way that you can always go back and edit the content with the software used to create it originally.
For lots of information about LinkBack, and a list of applications that support it, check the LinkBack repository on GitHub.
To embed OmniGraffle content in another LinkBack application, just copy and paste the content like you would normally. The same goes for embedding other applications’ content in OmniGraffle diagrams.
To embed OmniGraffle content inside a single object in OmniGraffle, select all of the objects on your canvas (Command-A), choose Edit ▸ Copy As ▸ PDF from the menu bar, and then Paste (Command-V). The objects you copied become a single image; double-clicking the object opens a new OmniGraffle window in which you can edit the objects to your heart’s content.
To edit OmniGraffle content embedded in another application:
Double-click the OmniGraffle content in the other application’s document; an OmniGraffle window appears containing the content.
Edit the content in the OmniGraffle window, just as you normally would.
In OmniGraffle, choose File ▸ Save; the content in the other application updates automatically.
To edit other LinkBack applications’ content embedded in an OmniGraffle diagram, just double-click it. When you save in the other application, the content in the OmniGraffle diagram updates.
Using Regular Expressions in OmniGraffle
OmniGraffle’s Find dialog supports the use of some simple regular expressions. A regular expression is a single string that represents a whole set of strings. The following syntax is used:
a*
— zero or more instances ofa
(matches the longest string possible)a*?
— zero or more instances ofa
(matches the shortest string possible)a+
— one or more instances ofa
(matches the longest string possible)a+?
— one or more instances ofa
(matches the shortest string possible)a?
— zero or one instance ofa
^
— beginning of a line$
— end of a line.
— any character[a-z]
— all characters betweena
andz
[abc-]
—a
,b
,c
, or-
(abc)
— matchesabc
and stores it as a group. Use the Select or Replace pop-up menu in the Find dialog to select or replace only one of these groups rather than the whole expression.\1
— text of first matched groupa|b
—a
orb
\n
— newline\r
— carriage return\t
— tab character\d
— digit\D
— non-digit\w
— word character (alphanumeric or underscore)\W
— non-word character\s
— whitespace\S
— non-whitespace\
— escape the next character
Regular expressions are very popular, so you should be able to find plenty of information about them on the internet or in a good library or bookstore. Here are a few examples to get you started:
&\s*$
— matches whitespace at the end of a line.<.*?>
— matches strings that begin with<
and end with>
, such as XML tags.&\S+@\S+
— very liberally matches things that resemble email addresses (anything@anything).(19|20)\d\d-\d\d?-\d\d?
— matches dates in the format YYYY-MM-DD, between 1900 and 2099