omniJS + JXA Grid interface – GUI ⇄ API flipped?

Not sure if the confusion lies in me, the GUI design, or the API design, but something does appear to be puzzling in the GUI labelling or API labelling of Grid options in OG 7.5

Putting aside the other current difficulties of grid-option scripting (omniJS crashes, and JXA doesn’t repaint the display), there seems to be some disagreement between the GUI and APIs.


There are two main options for the grid displayed, one is a Real and the other is an Int.

  • The Real, which we can specify in fractional in/cm measures, or in points/pixels, is the absolute separation between lines (finer lines or heavier ?) e.g. 0.35 cm
  • The Int gives the number of finer lines between the heavier lines e.g. 8 or 10


  1. API spacing “between each minor grid line” = GUI “Major Grid Spacing”
  2. API majorSpacing = GUI “Minor Grid Steps”


The GUI labels are:

  • (Real separation of lines) => “Major Grid Spacing”
  • (Integral number of finer lines between heavier lines) => “Minor Grid Steps”

The API labels are:

  • (Real separation of lines) => spacing - “Number of points of spacing between each minor grid line”
  • (Integral number of finer lines between heavier lines) => majorSpacing - “Number of minor grid squares between each major grid line”

So before we can discover the crash or the un-repainted display, the first scripting challenge is to clearly bear in mind two slightly unexpected equations …

  • minor = major (spacing), &&
  • major = minor (steps)

Is that right ? Or have I, perhaps, misunderstood and flunked the test ?

JXA test code for Script Editor, but remember to move and release a shape to force a canvas and inspector repaint, and avoid the impression that nothing has happened:

(() => {
    'use strict';

    // SETTINGS --------------------------------------------------------------
        gridGrouping = 10,
        gridBroad = 100,
        gridFine = 10;


    const grid = Application('OmniGraffle');
    return (
        grid.spacing = (grid.spacing() > gridFine ? gridFine : gridBroad),
        grid.majorSpacing = gridGrouping, {
            grouping: grid.majorSpacing(),
            spacing: grid.spacing()

Yes, you are correct. GUI “minor grid steps” is the same as API “major spacing”. API “spacing” is the size of a minor grid line, so API “spacing” multiplied by API “major spacing” is equal to GUI “major grid spacing”.

At some point it looks like we changed the GUI for specifying the grid while leaving the AppleScript/JavaScript/internal model alone, and we hadn’t yet realized the discrepancy. Oops.

1 Like

Got it. That makes sense :-)