The Canvas Grid
Every Canvas has a Grid or pattern of evenly-spaced overlapping guides to assist you in creating and aligning objects on the canvas.
Grid Properties
A canvas grid has properties whose values determine how it functions with the canvas. NOTE : in the current OmniJS scripting implementation, the values of grid properties are Read-Only , meaning can accessed by a script but are not alterable via a script.
drawsInFront • (see below 3) Whether the grid draws in front of all graphics or behind them.
majorSpacing • (1) Number of minor grid squares between each major grid line.
majorColor • (1) Color of the major grid lines.
minorColor • (2) Color of the minor grid lines.
snaps • (3) Whether graphics on the canvas snap to the grid.
spacing • Number of points of spacing between each minor grid line. (Also the width and height of each minor grid square.)
visible • (3) Whether the grid is currently visible or invisible.
Here’s an example script that reads the grid settings and creates a graphic to fill the area of a single major grid space. The fill and stroke colors of the created shape will match those of the grid.
cnvs = document.windows[0].selection.canvas
blockDimension = cnvs.grid.majorSpacing * cnvs.grid.spacing
minColor = cnvs.grid.minorColor
majColor = cnvs.grid.majorColor
aRect = new Rect(0,0,blockDimension,blockDimension)
aShape = cnvs.addShape('Rectangle',aRect)
aShape.fillColor = minColor
aShape.strokeColor = majColor
omnigraffle:///omnijs-run?script=cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%0AblockDimension%20%3D%20cnvs%2Egrid%2EmajorSpacing%20*%20cnvs%2Egrid%2Espacing%0AminColor%20%3D%20cnvs%2Egrid%2EminorColor%0AmajColor%20%3D%20cnvs%2Egrid%2EmajorColor%0AaRect%20%3D%20new%20Rect%280%2C0%2CblockDimension%2CblockDimension%29%0AaShape%20%3D%20cnvs%2EaddShape%28%27Rectangle%27%2CaRect%29%0AaShape%2EfillColor%20%3D%20minColor%0AaShape%2EstrokeColor%20%3D%20majColor
Make a 1-Grid-Block Graphic
Copy Script Run Script
01 cnvs = document .windows [0].selection .canvas
02 blockDimension = cnvs .grid .majorSpacing * cnvs .grid .spacing
03 minColor = cnvs .grid .minorColor
04 majColor = cnvs .grid .majorColor
05 aRect = new Rect (0,0,blockDimension ,blockDimension )
06 aShape = cnvs .addShape ('Square' ,aRect )
07 aShape .fillColor = minColor
08 aShape .strokeColor = majColor
The Toothpick Puzzle
Here’s an example script demonstrating setting up a canvas grid. It is a classic “Toothpick Puzzle” where the lines on the canvas represent virtual toothpicks. The puzzles are from the research paper Toothpick Geometry by Jung Kim and John Rader at the University of Hawai’i at Manoa .
Puzzle #1 : remove one toothpick to leave only three squares:
function setupCanvasGrid(cnvs){
cnvs.canvasSizingMode = CanvasSizingMode.Infinite
cnvs.grid.majorSpacing = 10
cnvs.grid.spacing = 10
cnvs.grid.majorColor = Color.blue
cnvs.grid.minorColor = Color.white
cnvs.grid.snaps = true
cnvs.grid.visible = true
cnvs.grid.drawsInFront = false
}
function deleteGraphicsFromCanvas(cnvs){
cnvs.graphics.forEach(function(graphic){
graphic.remove()
})
}
function setupToothpickPuzzle1(){
var cnvs = document.windows[0].selection.canvas;
deleteGraphicsFromCanvas(cnvs);
setupCanvasGrid(cnvs);
var g1 = cnvs.newLine();
var g2 = cnvs.newLine();
var g3 = cnvs.newLine();
var g4 = cnvs.newLine();
var g5 = cnvs.newLine();
var g6 = cnvs.newLine();
var g7 = cnvs.newLine();
var g8 = cnvs.newLine();
var g9 = cnvs.newLine();
var g10 = cnvs.newLine();
var g11 = cnvs.newLine();
var g12 = cnvs.newLine();
var g13 = cnvs.newLine();
g1.strokeThickness = 10;
g1.name = "Toothpick M";
g1.shadowColor = null;
g1.strokeCap = LineCap.Butt;
g1.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g1.points = [new Point(200.00, 410.00), new Point(200.00, 590.00)];
g2.strokeThickness = 10;
g2.name = "Toothpick L";
g2.shadowColor = null;
g2.strokeCap = LineCap.Butt;
g2.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g2.points = [new Point(0.00, 410.00), new Point(0.00, 590.00)];
g3.strokeThickness = 10;
g3.name = "Toothpick K";
g3.shadowColor = null;
g3.strokeCap = LineCap.Butt;
g3.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g3.points = [new Point(400.00, 210.00), new Point(400.00, 390.00)];
g4.strokeThickness = 10;
g4.name = "Toothpick J";
g4.shadowColor = null;
g4.strokeCap = LineCap.Butt;
g4.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g4.points = [new Point(200.00, 210.00), new Point(200.00, 390.00)];
g5.strokeThickness = 10;
g5.name = "Toothpick I";
g5.shadowColor = null;
g5.strokeCap = LineCap.Butt;
g5.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g5.points = [new Point(0.00, 210.00), new Point(0.00, 390.00)];
g6.strokeThickness = 10;
g6.name = "Toothpick H";
g6.shadowColor = null;
g6.strokeCap = LineCap.Butt;
g6.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g6.points = [new Point(200.00, 10.00), new Point(200.00, 190.00)];
g7.strokeThickness = 10;
g7.name = "Toothpick G";
g7.shadowColor = null;
g7.strokeCap = LineCap.Butt;
g7.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g7.points = [new Point(0.00, 10.00), new Point(0.00, 190.00)];
g8.strokeThickness = 10;
g8.name = "Toothpick F";
g8.shadowColor = null;
g8.strokeCap = LineCap.Butt;
g8.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g8.points = [new Point(10.00, 600.00), new Point(190.00, 600.00)];
g9.strokeThickness = 10;
g9.name = "Toothpick E";
g9.shadowColor = null;
g9.strokeCap = LineCap.Butt;
g9.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g9.points = [new Point(210.00, 400.00), new Point(390.00, 400.00)];
g10.strokeThickness = 10;
g10.name = "Toothpick D";
g10.shadowColor = null;
g10.strokeCap = LineCap.Butt;
g10.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g10.points = [new Point(10.00, 400.00), new Point(190.00, 400.00)];
g11.strokeThickness = 10;
g11.name = "Toothpick C";
g11.shadowColor = null;
g11.strokeCap = LineCap.Butt;
g11.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g11.points = [new Point(210.00, 200.00), new Point(390.00, 200.00)];
g12.strokeThickness = 10;
g12.name = "Toothpick B";
g12.shadowColor = null;
g12.strokeCap = LineCap.Butt;
g12.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g12.points = [new Point(10.00, 200.00), new Point(190.00, 200.00)];
g13.strokeThickness = 10;
g13.name = "Toothpick A";
g13.shadowColor = null;
g13.strokeCap = LineCap.Butt;
g13.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g13.points = [new Point(10.00, 0.00), new Point(190.00, 0.00)];
}
setupToothpickPuzzle1()
omnigraffle://localhost/omnijs-run?script=function%20setupCanvasGrid%28cnvs%29%7B%0A%09cnvs%2EcanvasSizingMode%20%3D%20CanvasSizingMode%2EInfinite%0A%09cnvs%2Egrid%2EmajorSpacing%20%3D%2010%0A%09cnvs%2Egrid%2Espacing%20%3D%2010%0A%09cnvs%2Egrid%2EmajorColor%20%3D%20Color%2Eblue%0A%09cnvs%2Egrid%2EminorColor%20%3D%20Color%2Ewhite%0A%09cnvs%2Egrid%2Esnaps%20%3D%20true%0A%09cnvs%2Egrid%2Evisible%20%3D%20true%0A%09cnvs%2Egrid%2EdrawsInFront%20%3D%20false%0A%7D%0A%0Afunction%20deleteGraphicsFromCanvas%28cnvs%29%7B%0A%09cnvs%2Egraphics%2EforEach%28function%28graphic%29%7B%0A%09%09graphic%2Eremove%28%29%0A%09%7D%29%0A%7D%0A%0Afunction%20setupToothpickPuzzle1%28%29%7B%0A%09var%20cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%3B%0A%09deleteGraphicsFromCanvas%28cnvs%29%3B%0A%09setupCanvasGrid%28cnvs%29%3B%0A%09var%20g1%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g2%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g3%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g4%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g5%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g6%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g7%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g8%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g9%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g10%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g11%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g12%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g13%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09g1%2EstrokeThickness%20%3D%2010%3B%0A%09g1%2Ename%20%3D%20%22Toothpick%20M%22%3B%0A%09g1%2EshadowColor%20%3D%20null%3B%0A%09g1%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g1%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g1%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%20410%2E00%29%2C%20new%20Point%28200%2E00%2C%20590%2E00%29%5D%3B%0A%09g2%2EstrokeThickness%20%3D%2010%3B%0A%09g2%2Ename%20%3D%20%22Toothpick%20L%22%3B%0A%09g2%2EshadowColor%20%3D%20null%3B%0A%09g2%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g2%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g2%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%20410%2E00%29%2C%20new%20Point%280%2E00%2C%20590%2E00%29%5D%3B%0A%09g3%2EstrokeThickness%20%3D%2010%3B%0A%09g3%2Ename%20%3D%20%22Toothpick%20K%22%3B%0A%09g3%2EshadowColor%20%3D%20null%3B%0A%09g3%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g3%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g3%2Epoints%20%3D%20%5Bnew%20Point%28400%2E00%2C%20210%2E00%29%2C%20new%20Point%28400%2E00%2C%20390%2E00%29%5D%3B%0A%09g4%2EstrokeThickness%20%3D%2010%3B%0A%09g4%2Ename%20%3D%20%22Toothpick%20J%22%3B%0A%09g4%2EshadowColor%20%3D%20null%3B%0A%09g4%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g4%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g4%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%20210%2E00%29%2C%20new%20Point%28200%2E00%2C%20390%2E00%29%5D%3B%0A%09g5%2EstrokeThickness%20%3D%2010%3B%0A%09g5%2Ename%20%3D%20%22Toothpick%20I%22%3B%0A%09g5%2EshadowColor%20%3D%20null%3B%0A%09g5%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g5%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g5%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%20210%2E00%29%2C%20new%20Point%280%2E00%2C%20390%2E00%29%5D%3B%0A%09g6%2EstrokeThickness%20%3D%2010%3B%0A%09g6%2Ename%20%3D%20%22Toothpick%20H%22%3B%0A%09g6%2EshadowColor%20%3D%20null%3B%0A%09g6%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g6%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g6%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%2010%2E00%29%2C%20new%20Point%28200%2E00%2C%20190%2E00%29%5D%3B%0A%09g7%2EstrokeThickness%20%3D%2010%3B%0A%09g7%2Ename%20%3D%20%22Toothpick%20G%22%3B%0A%09g7%2EshadowColor%20%3D%20null%3B%0A%09g7%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g7%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g7%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%2010%2E00%29%2C%20new%20Point%280%2E00%2C%20190%2E00%29%5D%3B%0A%09g8%2EstrokeThickness%20%3D%2010%3B%0A%09g8%2Ename%20%3D%20%22Toothpick%20F%22%3B%0A%09g8%2EshadowColor%20%3D%20null%3B%0A%09g8%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g8%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g8%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20600%2E00%29%2C%20new%20Point%28190%2E00%2C%20600%2E00%29%5D%3B%0A%09g9%2EstrokeThickness%20%3D%2010%3B%0A%09g9%2Ename%20%3D%20%22Toothpick%20E%22%3B%0A%09g9%2EshadowColor%20%3D%20null%3B%0A%09g9%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g9%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g9%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%20400%2E00%29%2C%20new%20Point%28390%2E00%2C%20400%2E00%29%5D%3B%0A%09g10%2EstrokeThickness%20%3D%2010%3B%0A%09g10%2Ename%20%3D%20%22Toothpick%20D%22%3B%0A%09g10%2EshadowColor%20%3D%20null%3B%0A%09g10%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g10%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g10%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20400%2E00%29%2C%20new%20Point%28190%2E00%2C%20400%2E00%29%5D%3B%0A%09g11%2EstrokeThickness%20%3D%2010%3B%0A%09g11%2Ename%20%3D%20%22Toothpick%20C%22%3B%0A%09g11%2EshadowColor%20%3D%20null%3B%0A%09g11%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g11%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g11%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%20200%2E00%29%2C%20new%20Point%28390%2E00%2C%20200%2E00%29%5D%3B%0A%09g12%2EstrokeThickness%20%3D%2010%3B%0A%09g12%2Ename%20%3D%20%22Toothpick%20B%22%3B%0A%09g12%2EshadowColor%20%3D%20null%3B%0A%09g12%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g12%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g12%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20200%2E00%29%2C%20new%20Point%28190%2E00%2C%20200%2E00%29%5D%3B%0A%09g13%2EstrokeThickness%20%3D%2010%3B%0A%09g13%2Ename%20%3D%20%22Toothpick%20A%22%3B%0A%09g13%2EshadowColor%20%3D%20null%3B%0A%09g13%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g13%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g13%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%200%2E00%29%2C%20new%20Point%28190%2E00%2C%200%2E00%29%5D%3B%0A%7D%0A%0AsetupToothpickPuzzle1%28%29
Toothpick Puzzle #1
Copy Script Setup Puzzle Solve Puzzle
01 function setupCanvasGrid (cnvs ){
02 cnvs .canvasSizingMode = CanvasSizingMode .Infinite
03 cnvs .grid .majorSpacing = 10
04 cnvs .grid .spacing = 10
05 cnvs .grid .majorColor = Color .blue
06 cnvs .grid .minorColor = Color .white
07 cnvs .grid .snaps = true
08 cnvs .grid .visible = true
09 cnvs .grid .drawsInFront = false
10 }
11
12 function deleteGraphicsFromCanvas (cnvs ){
13 cnvs .graphics .forEach (function (graphic ){
14 graphic .remove ()
15 })
16 }
17
18 function setupToothpickPuzzle1 (){
19 var cnvs = document .windows [0].selection .canvas ;
20 deleteGraphicsFromCanvas (cnvs );
21 setupCanvasGrid (cnvs );
22 var g1 = cnvs .newLine ();
23 var g2 = cnvs .newLine ();
24 var g3 = cnvs .newLine ();
25 var g4 = cnvs .newLine ();
26 var g5 = cnvs .newLine ();
27 var g6 = cnvs .newLine ();
28 var g7 = cnvs .newLine ();
29 var g8 = cnvs .newLine ();
30 var g9 = cnvs .newLine ();
31 var g10 = cnvs .newLine ();
32 var g11 = cnvs .newLine ();
33 var g12 = cnvs .newLine ();
34 var g13 = cnvs .newLine ();
35 g1 .strokeThickness = 10;
36 g1 .name = "Toothpick M" ;
37 g1 .shadowColor = null ;
38 g1 .strokeCap = LineCap .Butt ;
39 g1 .strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
40 g1 .points = [new Point (200.00, 410.00), new Point (200.00, 590.00)];
41 g2.strokeThickness = 10;
42 g2.name = "Toothpick L" ;
43 g2.shadowColor = null ;
44 g2.strokeCap = LineCap .Butt ;
45 g2.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
46 g2.points = [new Point (0.00, 410.00), new Point (0.00, 590.00)];
47 g3.strokeThickness = 10;
48 g3.name = "Toothpick K" ;
49 g3.shadowColor = null ;
50 g3.strokeCap = LineCap .Butt ;
51 g3.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
52 g3.points = [new Point (400.00, 210.00), new Point (400.00, 390.00)];
53 g4.strokeThickness = 10;
54 g4.name = "Toothpick J" ;
55 g4.shadowColor = null ;
56 g4.strokeCap = LineCap .Butt ;
57 g4.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
58 g4.points = [new Point (200.00, 210.00), new Point (200.00, 390.00)];
59 g5.strokeThickness = 10;
60 g5.name = "Toothpick I" ;
61 g5.shadowColor = null ;
62 g5.strokeCap = LineCap .Butt ;
63 g5.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
64 g5.points = [new Point (0.00, 210.00), new Point (0.00, 390.00)];
65 g6.strokeThickness = 10;
66 g6.name = "Toothpick H" ;
67 g6.shadowColor = null ;
68 g6.strokeCap = LineCap .Butt ;
69 g6.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
70 g6.points = [new Point (200.00, 10.00), new Point (200.00, 190.00)];
71 g7.strokeThickness = 10;
72 g7.name = "Toothpick G" ;
73 g7.shadowColor = null ;
74 g7.strokeCap = LineCap .Butt ;
75 g7.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
76 g7.points = [new Point (0.00, 10.00), new Point (0.00, 190.00)];
77 g8.strokeThickness = 10;
78 g8.name = "Toothpick F" ;
79 g8.shadowColor = null ;
80 g8.strokeCap = LineCap .Butt ;
81 g8.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
82 g8.points = [new Point (10.00, 600.00), new Point (190.00, 600.00)];
83 g9.strokeThickness = 10;
84 g9.name = "Toothpick E" ;
85 g9.shadowColor = null ;
86 g9.strokeCap = LineCap .Butt ;
87 g9.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
88 g9.points = [new Point (210.00, 400.00), new Point (390.00, 400.00)];
89 g10.strokeThickness = 10;
90 g10.name = "Toothpick D" ;
91 g10.shadowColor = null ;
92 g10.strokeCap = LineCap .Butt ;
93 g10.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
94 g10.points = [new Point (10.00, 400.00), new Point (190.00, 400.00)];
95 g11.strokeThickness = 10;
96 g11.name = "Toothpick C" ;
97 g11.shadowColor = null ;
98 g11.strokeCap = LineCap .Butt ;
99 g11.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
100 g11.points = [new Point (210.00, 200.00), new Point (390.00, 200.00)];
101 g12.strokeThickness = 10;
102 g12.name = "Toothpick B" ;
103 g12.shadowColor = null ;
104 g12.strokeCap = LineCap .Butt ;
105 g12.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
106 g12.points = [new Point (10.00, 200.00), new Point (190.00, 200.00)];
107 g13.strokeThickness = 10;
108 g13.name = "Toothpick A" ;
109 g13.shadowColor = null ;
110 g13.strokeCap = LineCap .Butt ;
111 g13.strokeColor = Color .RGB (0.647059, 0.647059, 0.647059);
112 g13.points = [new Point (10.00, 0.00), new Point (190.00, 0.00)];
113 }
114
115 setupToothpickPuzzle1 ()
function setupCanvasGrid(cnvs){
cnvs.canvasSizingMode = CanvasSizingMode.Infinite
cnvs.grid.majorSpacing = 10
cnvs.grid.spacing = 10
cnvs.grid.majorColor = Color.blue
cnvs.grid.minorColor = Color.white
cnvs.grid.snaps = true
cnvs.grid.visible = true
cnvs.grid.drawsInFront = false
}
function deleteGraphicsFromCanvas(cnvs){
cnvs.graphics.forEach(function(graphic){
graphic.remove()
})
}
function solveToothpickPuzzle1(){
var cnvs = document.windows[0].selection.canvas;
deleteGraphicsFromCanvas(cnvs);
setupCanvasGrid(cnvs);
var g1 = cnvs.newLine();
var g2 = cnvs.newLine();
var g3 = cnvs.newLine();
var g4 = cnvs.newLine();
var g5 = cnvs.newLine();
var g6 = cnvs.newLine();
var g7 = cnvs.newLine();
var g8 = cnvs.newLine();
var g9 = cnvs.newLine();
var g10 = cnvs.newLine();
var g11 = cnvs.newLine();
var g12 = cnvs.newLine();
g1.strokeThickness = 10;
g1.name = "Toothpick M";
g1.shadowColor = null;
g1.strokeCap = LineCap.Butt;
g1.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g1.points = [new Point(200.00, 410.00), new Point(200.00, 590.00)];
g2.strokeThickness = 10;
g2.name = "Toothpick L";
g2.shadowColor = null;
g2.strokeCap = LineCap.Butt;
g2.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g2.points = [new Point(0.00, 410.00), new Point(0.00, 590.00)];
g3.strokeThickness = 10;
g3.name = "Toothpick K";
g3.shadowColor = null;
g3.strokeCap = LineCap.Butt;
g3.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g3.points = [new Point(400.00, 210.00), new Point(400.00, 390.00)];
g4.strokeThickness = 10;
g4.name = "Toothpick J";
g4.shadowColor = null;
g4.strokeCap = LineCap.Butt;
g4.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g4.points = [new Point(200.00, 210.00), new Point(200.00, 390.00)];
g5.strokeThickness = 10;
g5.name = "Toothpick H";
g5.shadowColor = null;
g5.strokeCap = LineCap.Butt;
g5.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g5.points = [new Point(200.00, 10.00), new Point(200.00, 190.00)];
g6.strokeThickness = 10;
g6.name = "Toothpick G";
g6.shadowColor = null;
g6.strokeCap = LineCap.Butt;
g6.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g6.points = [new Point(0.00, 10.00), new Point(0.00, 190.00)];
g7.strokeThickness = 10;
g7.name = "Toothpick F";
g7.shadowColor = null;
g7.strokeCap = LineCap.Butt;
g7.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g7.points = [new Point(10.00, 600.00), new Point(190.00, 600.00)];
g8.strokeThickness = 10;
g8.name = "Toothpick E";
g8.shadowColor = null;
g8.strokeCap = LineCap.Butt;
g8.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g8.points = [new Point(210.00, 400.00), new Point(390.00, 400.00)];
g9.strokeThickness = 10;
g9.name = "Toothpick D";
g9.shadowColor = null;
g9.strokeCap = LineCap.Butt;
g9.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g9.points = [new Point(10.00, 400.00), new Point(190.00, 400.00)];
g10.strokeThickness = 10;
g10.name = "Toothpick C";
g10.shadowColor = null;
g10.strokeCap = LineCap.Butt;
g10.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g10.points = [new Point(210.00, 200.00), new Point(390.00, 200.00)];
g11.strokeThickness = 10;
g11.name = "Toothpick B";
g11.shadowColor = null;
g11.strokeCap = LineCap.Butt;
g11.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g11.points = [new Point(10.00, 200.00), new Point(190.00, 200.00)];
g12.strokeThickness = 10;
g12.name = "Toothpick A";
g12.shadowColor = null;
g12.strokeCap = LineCap.Butt;
g12.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g12.points = [new Point(10.00, 0.00), new Point(190.00, 0.00)];
}
solveToothpickPuzzle1()
omnigraffle://localhost/omnijs-run?script=function%20setupCanvasGrid%28cnvs%29%7B%0A%09cnvs%2EcanvasSizingMode%20%3D%20CanvasSizingMode%2EInfinite%0A%09cnvs%2Egrid%2EmajorSpacing%20%3D%2010%0A%09cnvs%2Egrid%2Espacing%20%3D%2010%0A%09cnvs%2Egrid%2EmajorColor%20%3D%20Color%2Eblue%0A%09cnvs%2Egrid%2EminorColor%20%3D%20Color%2Ewhite%0A%09cnvs%2Egrid%2Esnaps%20%3D%20true%0A%09cnvs%2Egrid%2Evisible%20%3D%20true%0A%09cnvs%2Egrid%2EdrawsInFront%20%3D%20false%0A%7D%0A%0Afunction%20deleteGraphicsFromCanvas%28cnvs%29%7B%0A%09cnvs%2Egraphics%2EforEach%28function%28graphic%29%7B%0A%09%09graphic%2Eremove%28%29%0A%09%7D%29%0A%7D%0A%0Afunction%20solveToothpickPuzzle1%28%29%7B%0A%09var%20cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%3B%0A%09deleteGraphicsFromCanvas%28cnvs%29%3B%0A%09setupCanvasGrid%28cnvs%29%3B%0A%09var%20g1%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g2%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g3%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g4%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g5%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g6%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g7%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g8%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g9%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g10%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g11%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g12%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09g1%2EstrokeThickness%20%3D%2010%3B%0A%09g1%2Ename%20%3D%20%22Toothpick%20M%22%3B%0A%09g1%2EshadowColor%20%3D%20null%3B%0A%09g1%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g1%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g1%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%20410%2E00%29%2C%20new%20Point%28200%2E00%2C%20590%2E00%29%5D%3B%0A%09g2%2EstrokeThickness%20%3D%2010%3B%0A%09g2%2Ename%20%3D%20%22Toothpick%20L%22%3B%0A%09g2%2EshadowColor%20%3D%20null%3B%0A%09g2%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g2%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g2%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%20410%2E00%29%2C%20new%20Point%280%2E00%2C%20590%2E00%29%5D%3B%0A%09g3%2EstrokeThickness%20%3D%2010%3B%0A%09g3%2Ename%20%3D%20%22Toothpick%20K%22%3B%0A%09g3%2EshadowColor%20%3D%20null%3B%0A%09g3%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g3%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g3%2Epoints%20%3D%20%5Bnew%20Point%28400%2E00%2C%20210%2E00%29%2C%20new%20Point%28400%2E00%2C%20390%2E00%29%5D%3B%0A%09g4%2EstrokeThickness%20%3D%2010%3B%0A%09g4%2Ename%20%3D%20%22Toothpick%20J%22%3B%0A%09g4%2EshadowColor%20%3D%20null%3B%0A%09g4%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g4%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g4%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%20210%2E00%29%2C%20new%20Point%28200%2E00%2C%20390%2E00%29%5D%3B%0A%09g5%2EstrokeThickness%20%3D%2010%3B%0A%09g5%2Ename%20%3D%20%22Toothpick%20H%22%3B%0A%09g5%2EshadowColor%20%3D%20null%3B%0A%09g5%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g5%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g5%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%2010%2E00%29%2C%20new%20Point%28200%2E00%2C%20190%2E00%29%5D%3B%0A%09g6%2EstrokeThickness%20%3D%2010%3B%0A%09g6%2Ename%20%3D%20%22Toothpick%20G%22%3B%0A%09g6%2EshadowColor%20%3D%20null%3B%0A%09g6%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g6%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g6%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%2010%2E00%29%2C%20new%20Point%280%2E00%2C%20190%2E00%29%5D%3B%0A%09g7%2EstrokeThickness%20%3D%2010%3B%0A%09g7%2Ename%20%3D%20%22Toothpick%20F%22%3B%0A%09g7%2EshadowColor%20%3D%20null%3B%0A%09g7%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g7%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g7%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20600%2E00%29%2C%20new%20Point%28190%2E00%2C%20600%2E00%29%5D%3B%0A%09g8%2EstrokeThickness%20%3D%2010%3B%0A%09g8%2Ename%20%3D%20%22Toothpick%20E%22%3B%0A%09g8%2EshadowColor%20%3D%20null%3B%0A%09g8%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g8%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g8%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%20400%2E00%29%2C%20new%20Point%28390%2E00%2C%20400%2E00%29%5D%3B%0A%09g9%2EstrokeThickness%20%3D%2010%3B%0A%09g9%2Ename%20%3D%20%22Toothpick%20D%22%3B%0A%09g9%2EshadowColor%20%3D%20null%3B%0A%09g9%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g9%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g9%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20400%2E00%29%2C%20new%20Point%28190%2E00%2C%20400%2E00%29%5D%3B%0A%09g10%2EstrokeThickness%20%3D%2010%3B%0A%09g10%2Ename%20%3D%20%22Toothpick%20C%22%3B%0A%09g10%2EshadowColor%20%3D%20null%3B%0A%09g10%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g10%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g10%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%20200%2E00%29%2C%20new%20Point%28390%2E00%2C%20200%2E00%29%5D%3B%0A%09g11%2EstrokeThickness%20%3D%2010%3B%0A%09g11%2Ename%20%3D%20%22Toothpick%20B%22%3B%0A%09g11%2EshadowColor%20%3D%20null%3B%0A%09g11%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g11%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g11%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20200%2E00%29%2C%20new%20Point%28190%2E00%2C%20200%2E00%29%5D%3B%0A%09g12%2EstrokeThickness%20%3D%2010%3B%0A%09g12%2Ename%20%3D%20%22Toothpick%20A%22%3B%0A%09g12%2EshadowColor%20%3D%20null%3B%0A%09g12%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g12%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g12%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%200%2E00%29%2C%20new%20Point%28190%2E00%2C%200%2E00%29%5D%3B%0A%7D%0A%0AsolveToothpickPuzzle1%28%29
function setupCanvasGrid(cnvs){
cnvs.canvasSizingMode = CanvasSizingMode.Infinite
cnvs.grid.majorSpacing = 10
cnvs.grid.spacing = 10
cnvs.grid.majorColor = Color.blue
cnvs.grid.minorColor = Color.white
cnvs.grid.snaps = true
cnvs.grid.visible = true
cnvs.grid.drawsInFront = false
}
function deleteGraphicsFromCanvas(cnvs){
cnvs.graphics.forEach(function(graphic){
graphic.remove()
})
}
function setupToothpickPuzzle2(){
var cnvs = document.windows[0].selection.canvas;
deleteGraphicsFromCanvas(cnvs);
setupCanvasGrid(cnvs);
var g1 = cnvs.newLine();
var g2 = cnvs.newLine();
var g3 = cnvs.newLine();
var g4 = cnvs.newLine();
var g5 = cnvs.newLine();
var g6 = cnvs.newLine();
var g7 = cnvs.newLine();
var g8 = cnvs.newLine();
var g9 = cnvs.newLine();
var g10 = cnvs.newLine();
var g11 = cnvs.newLine();
var g12 = cnvs.newLine();
g1.strokeThickness = 10;
g1.name = "Toothpick L";
g1.shadowColor = null;
g1.strokeCap = LineCap.Butt;
g1.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g1.points = [new Point(400.00, 210.00), new Point(400.00, 390.00)];
g2.strokeThickness = 10;
g2.name = "Toothpick K";
g2.shadowColor = null;
g2.strokeCap = LineCap.Butt;
g2.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g2.points = [new Point(200.00, 210.00), new Point(200.00, 390.00)];
g3.strokeThickness = 10;
g3.name = "Toothpick J";
g3.shadowColor = null;
g3.strokeCap = LineCap.Butt;
g3.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g3.points = [new Point(0.00, 210.00), new Point(0.00, 390.00)];
g4.strokeThickness = 10;
g4.name = "Toothpick I";
g4.shadowColor = null;
g4.strokeCap = LineCap.Butt;
g4.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g4.points = [new Point(400.00, 10.00), new Point(400.00, 190.00)];
g5.strokeThickness = 10;
g5.name = "Toothpick H";
g5.shadowColor = null;
g5.strokeCap = LineCap.Butt;
g5.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g5.points = [new Point(200.00, 10.00), new Point(200.00, 190.00)];
g6.strokeThickness = 10;
g6.name = "Toothpick G";
g6.shadowColor = null;
g6.strokeCap = LineCap.Butt;
g6.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g6.points = [new Point(0.00, 10.00), new Point(0.00, 190.00)];
g7.strokeThickness = 10;
g7.name = "Toothpick F";
g7.shadowColor = null;
g7.strokeCap = LineCap.Butt;
g7.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g7.points = [new Point(210.00, 400.00), new Point(390.00, 400.00)];
g8.strokeThickness = 10;
g8.name = "Toothpick E";
g8.shadowColor = null;
g8.strokeCap = LineCap.Butt;
g8.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g8.points = [new Point(10.00, 400.00), new Point(190.00, 400.00)];
g9.strokeThickness = 10;
g9.name = "Toothpick D";
g9.shadowColor = null;
g9.strokeCap = LineCap.Butt;
g9.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g9.points = [new Point(210.00, 200.00), new Point(390.00, 200.00)];
g10.strokeThickness = 10;
g10.name = "Toothpick C";
g10.shadowColor = null;
g10.strokeCap = LineCap.Butt;
g10.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g10.points = [new Point(10.00, 200.00), new Point(190.00, 200.00)];
g11.strokeThickness = 10;
g11.name = "Toothpick B";
g11.shadowColor = null;
g11.strokeCap = LineCap.Butt;
g11.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g11.points = [new Point(210.00, 0.00), new Point(390.00, 0.00)];
g12.strokeThickness = 10;
g12.name = "Toothpick A";
g12.shadowColor = null;
g12.strokeCap = LineCap.Butt;
g12.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g12.points = [new Point(10.00, 0.00), new Point(190.00, 0.00)];
}
setupToothpickPuzzle2()
omnigraffle://localhost/omnijs-run?script=function%20setupCanvasGrid%28cnvs%29%7B%0A%09cnvs%2EcanvasSizingMode%20%3D%20CanvasSizingMode%2EInfinite%0A%09cnvs%2Egrid%2EmajorSpacing%20%3D%2010%0A%09cnvs%2Egrid%2Espacing%20%3D%2010%0A%09cnvs%2Egrid%2EmajorColor%20%3D%20Color%2Eblue%0A%09cnvs%2Egrid%2EminorColor%20%3D%20Color%2Ewhite%0A%09cnvs%2Egrid%2Esnaps%20%3D%20true%0A%09cnvs%2Egrid%2Evisible%20%3D%20true%0A%09cnvs%2Egrid%2EdrawsInFront%20%3D%20false%0A%7D%0A%0Afunction%20deleteGraphicsFromCanvas%28cnvs%29%7B%0A%09cnvs%2Egraphics%2EforEach%28function%28graphic%29%7B%0A%09%09graphic%2Eremove%28%29%0A%09%7D%29%0A%7D%0A%0Afunction%20setupToothpickPuzzle2%28%29%7B%0A%09var%20cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%3B%0A%09deleteGraphicsFromCanvas%28cnvs%29%3B%0A%09setupCanvasGrid%28cnvs%29%3B%0A%09var%20g1%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g2%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g3%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g4%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g5%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g6%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g7%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g8%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g9%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g10%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g11%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g12%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09g1%2EstrokeThickness%20%3D%2010%3B%0A%09g1%2Ename%20%3D%20%22Toothpick%20L%22%3B%0A%09g1%2EshadowColor%20%3D%20null%3B%0A%09g1%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g1%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g1%2Epoints%20%3D%20%5Bnew%20Point%28400%2E00%2C%20210%2E00%29%2C%20new%20Point%28400%2E00%2C%20390%2E00%29%5D%3B%0A%09g2%2EstrokeThickness%20%3D%2010%3B%0A%09g2%2Ename%20%3D%20%22Toothpick%20K%22%3B%0A%09g2%2EshadowColor%20%3D%20null%3B%0A%09g2%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g2%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g2%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%20210%2E00%29%2C%20new%20Point%28200%2E00%2C%20390%2E00%29%5D%3B%0A%09g3%2EstrokeThickness%20%3D%2010%3B%0A%09g3%2Ename%20%3D%20%22Toothpick%20J%22%3B%0A%09g3%2EshadowColor%20%3D%20null%3B%0A%09g3%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g3%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g3%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%20210%2E00%29%2C%20new%20Point%280%2E00%2C%20390%2E00%29%5D%3B%0A%09g4%2EstrokeThickness%20%3D%2010%3B%0A%09g4%2Ename%20%3D%20%22Toothpick%20I%22%3B%0A%09g4%2EshadowColor%20%3D%20null%3B%0A%09g4%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g4%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g4%2Epoints%20%3D%20%5Bnew%20Point%28400%2E00%2C%2010%2E00%29%2C%20new%20Point%28400%2E00%2C%20190%2E00%29%5D%3B%0A%09g5%2EstrokeThickness%20%3D%2010%3B%0A%09g5%2Ename%20%3D%20%22Toothpick%20H%22%3B%0A%09g5%2EshadowColor%20%3D%20null%3B%0A%09g5%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g5%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g5%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%2010%2E00%29%2C%20new%20Point%28200%2E00%2C%20190%2E00%29%5D%3B%0A%09g6%2EstrokeThickness%20%3D%2010%3B%0A%09g6%2Ename%20%3D%20%22Toothpick%20G%22%3B%0A%09g6%2EshadowColor%20%3D%20null%3B%0A%09g6%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g6%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g6%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%2010%2E00%29%2C%20new%20Point%280%2E00%2C%20190%2E00%29%5D%3B%0A%09g7%2EstrokeThickness%20%3D%2010%3B%0A%09g7%2Ename%20%3D%20%22Toothpick%20F%22%3B%0A%09g7%2EshadowColor%20%3D%20null%3B%0A%09g7%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g7%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g7%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%20400%2E00%29%2C%20new%20Point%28390%2E00%2C%20400%2E00%29%5D%3B%0A%09g8%2EstrokeThickness%20%3D%2010%3B%0A%09g8%2Ename%20%3D%20%22Toothpick%20E%22%3B%0A%09g8%2EshadowColor%20%3D%20null%3B%0A%09g8%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g8%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g8%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20400%2E00%29%2C%20new%20Point%28190%2E00%2C%20400%2E00%29%5D%3B%0A%09g9%2EstrokeThickness%20%3D%2010%3B%0A%09g9%2Ename%20%3D%20%22Toothpick%20D%22%3B%0A%09g9%2EshadowColor%20%3D%20null%3B%0A%09g9%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g9%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g9%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%20200%2E00%29%2C%20new%20Point%28390%2E00%2C%20200%2E00%29%5D%3B%0A%09g10%2EstrokeThickness%20%3D%2010%3B%0A%09g10%2Ename%20%3D%20%22Toothpick%20C%22%3B%0A%09g10%2EshadowColor%20%3D%20null%3B%0A%09g10%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g10%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g10%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20200%2E00%29%2C%20new%20Point%28190%2E00%2C%20200%2E00%29%5D%3B%0A%09g11%2EstrokeThickness%20%3D%2010%3B%0A%09g11%2Ename%20%3D%20%22Toothpick%20B%22%3B%0A%09g11%2EshadowColor%20%3D%20null%3B%0A%09g11%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g11%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g11%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%200%2E00%29%2C%20new%20Point%28390%2E00%2C%200%2E00%29%5D%3B%0A%09g12%2EstrokeThickness%20%3D%2010%3B%0A%09g12%2Ename%20%3D%20%22Toothpick%20A%22%3B%0A%09g12%2EshadowColor%20%3D%20null%3B%0A%09g12%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g12%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g12%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%200%2E00%29%2C%20new%20Point%28190%2E00%2C%200%2E00%29%5D%3B%0A%7D%0A%0AsetupToothpickPuzzle2%28%29
function setupCanvasGrid(cnvs){
cnvs.canvasSizingMode = CanvasSizingMode.Infinite
cnvs.grid.majorSpacing = 10
cnvs.grid.spacing = 10
cnvs.grid.majorColor = Color.blue
cnvs.grid.minorColor = Color.white
cnvs.grid.snaps = true
cnvs.grid.visible = true
cnvs.grid.drawsInFront = false
}
function deleteGraphicsFromCanvas(cnvs){
cnvs.graphics.forEach(function(graphic){
graphic.remove()
})
}
function solveToothpickPuzzle2(){
var cnvs = document.windows[0].selection.canvas;
deleteGraphicsFromCanvas(cnvs);
setupCanvasGrid(cnvs);
var g1 = cnvs.newLine();
var g3 = cnvs.newLine();
var g4 = cnvs.newLine();
var g5 = cnvs.newLine();
var g6 = cnvs.newLine();
var g7 = cnvs.newLine();
var g8 = cnvs.newLine();
var g10 = cnvs.newLine();
var g11 = cnvs.newLine();
var g12 = cnvs.newLine();
g1.strokeThickness = 10;
g1.name = "Toothpick L";
g1.shadowColor = null;
g1.strokeCap = LineCap.Butt;
g1.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g1.points = [new Point(400.00, 210.00), new Point(400.00, 390.00)];
g3.strokeThickness = 10;
g3.name = "Toothpick J";
g3.shadowColor = null;
g3.strokeCap = LineCap.Butt;
g3.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g3.points = [new Point(0.00, 210.00), new Point(0.00, 390.00)];
g4.strokeThickness = 10;
g4.name = "Toothpick I";
g4.shadowColor = null;
g4.strokeCap = LineCap.Butt;
g4.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g4.points = [new Point(400.00, 10.00), new Point(400.00, 190.00)];
g5.strokeThickness = 10;
g5.name = "Toothpick H";
g5.shadowColor = null;
g5.strokeCap = LineCap.Butt;
g5.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g5.points = [new Point(200.00, 10.00), new Point(200.00, 190.00)];
g6.strokeThickness = 10;
g6.name = "Toothpick G";
g6.shadowColor = null;
g6.strokeCap = LineCap.Butt;
g6.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g6.points = [new Point(0.00, 10.00), new Point(0.00, 190.00)];
g7.strokeThickness = 10;
g7.name = "Toothpick F";
g7.shadowColor = null;
g7.strokeCap = LineCap.Butt;
g7.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g7.points = [new Point(210.00, 400.00), new Point(390.00, 400.00)];
g8.strokeThickness = 10;
g8.name = "Toothpick E";
g8.shadowColor = null;
g8.strokeCap = LineCap.Butt;
g8.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g8.points = [new Point(10.00, 400.00), new Point(190.00, 400.00)];
g10.strokeThickness = 10;
g10.name = "Toothpick C";
g10.shadowColor = null;
g10.strokeCap = LineCap.Butt;
g10.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g10.points = [new Point(10.00, 200.00), new Point(190.00, 200.00)];
g11.strokeThickness = 10;
g11.name = "Toothpick B";
g11.shadowColor = null;
g11.strokeCap = LineCap.Butt;
g11.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g11.points = [new Point(210.00, 0.00), new Point(390.00, 0.00)];
g12.strokeThickness = 10;
g12.name = "Toothpick A";
g12.shadowColor = null;
g12.strokeCap = LineCap.Butt;
g12.strokeColor = Color.RGB(0.647059, 0.647059, 0.647059);
g12.points = [new Point(10.00, 0.00), new Point(190.00, 0.00)];
}
solveToothpickPuzzle2()
omnigraffle://localhost/omnijs-run?script=function%20setupCanvasGrid%28cnvs%29%7B%0A%09cnvs%2EcanvasSizingMode%20%3D%20CanvasSizingMode%2EInfinite%0A%09cnvs%2Egrid%2EmajorSpacing%20%3D%2010%0A%09cnvs%2Egrid%2Espacing%20%3D%2010%0A%09cnvs%2Egrid%2EmajorColor%20%3D%20Color%2Eblue%0A%09cnvs%2Egrid%2EminorColor%20%3D%20Color%2Ewhite%0A%09cnvs%2Egrid%2Esnaps%20%3D%20true%0A%09cnvs%2Egrid%2Evisible%20%3D%20true%0A%09cnvs%2Egrid%2EdrawsInFront%20%3D%20false%0A%7D%0A%0Afunction%20deleteGraphicsFromCanvas%28cnvs%29%7B%0A%09cnvs%2Egraphics%2EforEach%28function%28graphic%29%7B%0A%09%09graphic%2Eremove%28%29%0A%09%7D%29%0A%7D%0A%0Afunction%20solveToothpickPuzzle2%28%29%7B%0A%09var%20cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%3B%0A%09deleteGraphicsFromCanvas%28cnvs%29%3B%0A%09setupCanvasGrid%28cnvs%29%3B%0A%09var%20g1%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g3%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g4%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g5%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g6%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g7%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g8%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g10%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g11%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09var%20g12%20%3D%20cnvs%2EnewLine%28%29%3B%0A%09g1%2EstrokeThickness%20%3D%2010%3B%0A%09g1%2Ename%20%3D%20%22Toothpick%20L%22%3B%0A%09g1%2EshadowColor%20%3D%20null%3B%0A%09g1%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g1%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g1%2Epoints%20%3D%20%5Bnew%20Point%28400%2E00%2C%20210%2E00%29%2C%20new%20Point%28400%2E00%2C%20390%2E00%29%5D%3B%0A%09g3%2EstrokeThickness%20%3D%2010%3B%0A%09g3%2Ename%20%3D%20%22Toothpick%20J%22%3B%0A%09g3%2EshadowColor%20%3D%20null%3B%0A%09g3%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g3%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g3%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%20210%2E00%29%2C%20new%20Point%280%2E00%2C%20390%2E00%29%5D%3B%0A%09g4%2EstrokeThickness%20%3D%2010%3B%0A%09g4%2Ename%20%3D%20%22Toothpick%20I%22%3B%0A%09g4%2EshadowColor%20%3D%20null%3B%0A%09g4%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g4%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g4%2Epoints%20%3D%20%5Bnew%20Point%28400%2E00%2C%2010%2E00%29%2C%20new%20Point%28400%2E00%2C%20190%2E00%29%5D%3B%0A%09g5%2EstrokeThickness%20%3D%2010%3B%0A%09g5%2Ename%20%3D%20%22Toothpick%20H%22%3B%0A%09g5%2EshadowColor%20%3D%20null%3B%0A%09g5%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g5%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g5%2Epoints%20%3D%20%5Bnew%20Point%28200%2E00%2C%2010%2E00%29%2C%20new%20Point%28200%2E00%2C%20190%2E00%29%5D%3B%0A%09g6%2EstrokeThickness%20%3D%2010%3B%0A%09g6%2Ename%20%3D%20%22Toothpick%20G%22%3B%0A%09g6%2EshadowColor%20%3D%20null%3B%0A%09g6%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g6%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g6%2Epoints%20%3D%20%5Bnew%20Point%280%2E00%2C%2010%2E00%29%2C%20new%20Point%280%2E00%2C%20190%2E00%29%5D%3B%0A%09g7%2EstrokeThickness%20%3D%2010%3B%0A%09g7%2Ename%20%3D%20%22Toothpick%20F%22%3B%0A%09g7%2EshadowColor%20%3D%20null%3B%0A%09g7%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g7%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g7%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%20400%2E00%29%2C%20new%20Point%28390%2E00%2C%20400%2E00%29%5D%3B%0A%09g8%2EstrokeThickness%20%3D%2010%3B%0A%09g8%2Ename%20%3D%20%22Toothpick%20E%22%3B%0A%09g8%2EshadowColor%20%3D%20null%3B%0A%09g8%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g8%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g8%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20400%2E00%29%2C%20new%20Point%28190%2E00%2C%20400%2E00%29%5D%3B%0A%09g10%2EstrokeThickness%20%3D%2010%3B%0A%09g10%2Ename%20%3D%20%22Toothpick%20C%22%3B%0A%09g10%2EshadowColor%20%3D%20null%3B%0A%09g10%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g10%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g10%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%20200%2E00%29%2C%20new%20Point%28190%2E00%2C%20200%2E00%29%5D%3B%0A%09g11%2EstrokeThickness%20%3D%2010%3B%0A%09g11%2Ename%20%3D%20%22Toothpick%20B%22%3B%0A%09g11%2EshadowColor%20%3D%20null%3B%0A%09g11%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g11%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g11%2Epoints%20%3D%20%5Bnew%20Point%28210%2E00%2C%200%2E00%29%2C%20new%20Point%28390%2E00%2C%200%2E00%29%5D%3B%0A%09g12%2EstrokeThickness%20%3D%2010%3B%0A%09g12%2Ename%20%3D%20%22Toothpick%20A%22%3B%0A%09g12%2EshadowColor%20%3D%20null%3B%0A%09g12%2EstrokeCap%20%3D%20LineCap%2EButt%3B%0A%09g12%2EstrokeColor%20%3D%20Color%2ERGB%280%2E647059%2C%200%2E647059%2C%200%2E647059%29%3B%0A%09g12%2Epoints%20%3D%20%5Bnew%20Point%2810%2E00%2C%200%2E00%29%2C%20new%20Point%28190%2E00%2C%200%2E00%29%5D%3B%0A%7D%0A%0AsolveToothpickPuzzle2%28%29
Puzzle #2 : remove two toothpicks to leave only two squares:
Toothpick Puzzle #2
Copy Script Setup Puzzle Solve Puzzle