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.
Basics
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
Puzzle
- API
spacing
“between each minor grid line” = GUI “Major Grid Spacing” - API
majorSpacing
= GUI “Minor Grid Steps”
Details
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 --------------------------------------------------------------
const
gridGrouping = 10,
gridBroad = 100,
gridFine = 10;
// TOGGLE BETWEEN BROAD AND FINE GRID LINE SETTINGS ---------------------
const grid = Application('OmniGraffle').documents.at(0).canvases.at(0).grid;
return (
grid.spacing = (grid.spacing() > gridFine ? gridFine : gridBroad),
grid.majorSpacing = gridGrouping, {
grouping: grid.majorSpacing(),
spacing: grid.spacing()
}
);
})();