@@ -48,35 +48,34 @@ fun Double.roundedTo(decimals: Int = 3): String {
4848
4949/* *
5050 * Generates g-code for defined operations.
51- * All operations are empty command lists on default and have to be defined explicitly.
5251 */
5352data class Generator (
5453
5554 /* *
5655 * Setup code at the beginning of a file.
5756 */
58- val setup : Commands = emptyList() ,
57+ val setup : Commands ,
5958
6059 /* *
6160 * A move operation to the given location.
6261 */
63- val moveTo : (Vector2 ) -> Commands = { emptyList() } ,
62+ val moveTo : (Vector2 ) -> Commands ,
6463
6564 /* *
66- * Start drawing sequence. Pen down, laser on etc.
65+ * Start drawing sequence. Pen down, laser on, etc.
6766 */
68- val preDraw : Commands = emptyList() ,
67+ val preDraw : Commands ,
6968
7069 /* *
7170 * A draw operation to the given location.
7271 */
73- val drawTo : (Vector2 ) -> Commands = { emptyList() } ,
72+ val drawTo : (Vector2 ) -> Commands ,
7473
7574 /* *
76- * End draw sequence. Lift pen, turn laser off.
75+ * End draw sequence. Lift pen, turn laser off, etc .
7776 * Called after a draw action before a move is performed.
7877 */
79- val postDraw : Commands = emptyList() ,
78+ val postDraw : Commands ,
8079
8180 /* *
8281 * End of file sequence.
@@ -86,9 +85,20 @@ data class Generator(
8685 /* *
8786 * Insert a comment.
8887 */
89- val comment : (String ) -> Commands = { _ -> emptyList() }
88+ val comment : (String ) -> Commands
9089)
9190
91+ /* *
92+ * All operations are empty command lists on default and have to be defined explicitly.
93+ */
94+ fun noopGenerator () = Generator (
95+ setup = emptyList(),
96+ moveTo = { _ -> emptyList() },
97+ preDraw = emptyList(),
98+ drawTo = { _ -> emptyList() },
99+ postDraw = emptyList(),
100+ ) { _ -> emptyList() }
101+
92102/* *
93103 * Creates a [Generator] to be used by grbl controlled pen plotters.
94104 * [drawRate] sets the feed rate used for drawing operations.
0 commit comments