View Single Post
I'm using Objective-C ScriptBridge to build some shapes in OmniGraffle.
I'm able to create and add the shape to a canvas, but there are many properties which I can't figure out how to set correctly.
For instance I'm able to set things like origin, side padding, size, draws shadow. But I can't figure out how to set text placement. This shows as an enum.
I need to make that an object so that it can be added to the dictionary which I'm using as properties to initialize the shape (initWithProperties)... It looks something like this:
Code:
OmniGraffleShape *anotherGraffleShape = [[[self.graffleApp classForScriptingClass:@"shape"] alloc] initWithProperties:[self grafflePropertiesForHostShape:shapeMetaData]];
Here is a sample of my dictionary which I'm passing for the initWithProperties:

Code:
NSMutableDictionary *graffleProperties = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                          [NSNumber numberWithInt:shapeMetaData.sidePadding],@"sidePadding",
                                          [NSArray arrayWithObjects:[NSNumber numberWithInt:shapeMetaData.startingXOrigin],[NSNumber numberWithInt:shapeMetaData.startingYOrigin], nil],@"origin",
                                          [NSArray arrayWithObjects:[NSNumber numberWithInt:shapeMetaData.shapeWidth],[NSNumber numberWithInt:shapeMetaData.shapeHeight], nil],@"size",
                                          [NSNumber numberWithBool: shapeMetaData.drawsShadow],@"drawsShadow",
                                          [NSNumber numberWithBool: shapeMetaData.drawsStroke],@"drawsStroke",
                                          [NSNumber numberWithDouble:shapeMetaData.cornerRadius],@"cornerRadius",
                                          [NSString stringWithFormat:@"%c", OmniGraffleOGvaTop],@"textPlacement",
                                          nil];
It it wasn't obvious, the above example is using a custom object calls shapeMetaData, which I set most of the properties for a shape. Here I'm just getting those properties and adding them to a dictionary which will later be used to initialize the OmniGraffle Shape object.

I would really appreciate any examples of how to set the various properties for a shape. It would be even better if somebody could show an example of how to build a properties dictionary with most every property in the example.

Last edited by Joe.Hocker; 2013-11-07 at 11:04 PM.. Reason: wrapping some code with code attributes