The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Creating .graffleshapes tutorial Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
[Originally posted to the OmniGraffle users mailing list by David Kasprzyk, thought I'd post it here as well for easier access -- JP]

After much editing and such, and creating some shapes, I think I'm ready
to release my .graffleshapes tutorial for your benefit. Let me know if
you have any questions and I'd be happy to clarify any issues.

David's Shape Creation Tutorial:

The shapes file - shapes.graffleshapes:

All of the shapes and lineheads in OmniGraffle are defined in the
shapes.graffleshapes file. This file is part of the OmniGraffle.app
package. To access this file, right click (control-click if you don't
have two buttons) on the application to bring up the contextual menu.
Select 'Show Package Contents' from the menu, which will open up a new
window titled OmniGraffle. Open up the one folder inside, 'Contents',
then open up the 'Resources' folder in the new window. In the 'Resources'
window that opens, you should be able to find the shapes.graffleshapes
file. Since we don't want to damage the original file, I recommend option
dragging this file to the desktop, thus making a copy.

Creating your own personal shapes file:

Now that we have created our shapes.graffleshapes copy lets start by
renaming it, we'll call it shapestutorial.graffleshapes. Now that this is
done we need to place the file in the proper directory. All third party
graffleshapes files are stored in either,

Library/Application Support/OmniGraffle/Shapes/ if you want to give everyone
on your computer access or
~/Library/Application Support/OmniGraffle/Shapes/ if you want access only
for yourself

so lets move shapestutorial.graffleshapes into the local directory for now.

Overview of a .graffleshapes file:

Now lets open up the shapestutorial file and take a look at it. A
.graffleshapes file can be opened and edited with any text editor, such as
TextEdit and BBEdit. When you open up the file you will see the
information that creates OmniGraffle's default shapes. The basic outline
should look something like,

{
shapes = (
{
InspectorGroup = 32;
ShapeName = RoundedStack;
StrokePath = {
elements = (
...
);
};
TextBounds = "{{0.02, 0.02}, {0.855, 0.855}}";
},
{
...
}
);
}

That annoying syntax - A 'quick' discussion:

Since syntax is typically the cause of most errors in coding, it will
unfortunately be no different for creating graffleshapes. So to try and
assist you during your creation of graffleshapes I'll be going over
several of the main syntax issues.

First off all of the commands are case sensitive. Thus shapename is not
equivilant to ShapeName. All of the commands listed in this tutorial
should be copied directly for them to work properly.

Spaces and tabs are not required but they do make it easier to spot
problems if your shapes file doesn't load properly, and I highly recommend
using them.

Decimal numbers can be enter with or without the leading zero. So 0.5 is
just as valid in a graffleshapes file as .5 is. My best advice is to pick
a system and stay with it for convenience in debugging problems.

Commas and semicolons typically cause the most problems in getting your
shapes to properly load into OmniGraffle. I will therefore try and list
where semicolons and commas should go in you graffleshapes files.

Commas: Commas are used in two main sections of a graffleshapes file.
The first of these is to link elements together when defining a path. A
comma should follow every element that you define, with the exception of
the very last element. This can be seen in the following example:

elements = (
{element = MOVETO; point = "{-0.5, -0.5}"; } ,
{element = LINETO; point = "{0.5, -0.5}"; } ,
{element = LINETO; point = "{0.5, 0.5}"; } ,
{element = LINETO; point = "{-0.5, 0.5}"; } ,
{element = CLOSE; }
);

The second comma location is between each shape that is created. Like we
did with the elements, no comma should follow the last shape. The format
should be as shown below:

shapes = (
{
...
} ,
{
...
} ,
{
...
}
);

Semi Colons: While you end up using semi colons much more frequently than
commas, the placement of semi colons follows a specific rule.

The Rule of Semi Colons:
If you are setting a value, and thus using the = character, the you
must follow the expression with a semi colon. To emphasize the point here
are some examples:

shapes = (
...
);

StrokePath = {
...
};

element = MOVETO;

point = "{ ... }";

These quick guidelines should hopefully allow you to track down any
problems that you may experience in the creation of you graffleshapes.
Now that we have these guidelines set up, lets take a look at actually
creating the shapes.
__________________
"Vroom! Vroom!!"
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating and Editing Ad Filters - Tutorial Handycam OmniWeb General 9 2012-03-13 07:50 PM
Need help creating a script for creating a next action gcrump OmniFocus Extras 9 2009-02-21 06:10 PM
Templates tutorial? hardcoreUFO OmniGraffle General 0 2007-12-18 12:50 PM
Web Interface Tutorial sprocketjockey OmniFocus 1 for Mac 1 2007-07-05 03:09 PM
Tutorial? sjfischer OmniOutliner 3 for Mac 1 2006-10-05 01:10 PM


All times are GMT -8. The time now is 12:00 PM.


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