Package-level declarations

Types

Link copied to clipboard
abstract class BaseGeneratorContext(val deduplicateCommands: Boolean = true) : GeneratorContext

Base implementation of GeneratorContext that collects commands in a list.

Link copied to clipboard
data class BasicGrblGenerator(val drawRate: Double? = 500.0, val moveRate: Double? = null, val setup: Commands = listOf( "G21", // mm "G90", // Absolute positioning ), val preDraw: Commands = listOf("M3 S255"), val postDraw: Commands = listOf("M3 S0"), val comment: (String) -> Commands = { listOf(";$it") }, val end: Commands = listOf( "G0 X0 Y0", "G90", ), val deduplicateCommands: Boolean = true, val distanceTolerance: Double = 0.5, val minSquaredDistance: Double = 0.5) : Generator
Link copied to clipboard
typealias Command = String

A single G-code command.

Link copied to clipboard
typealias Commands = List<Command>

A list of G-code commands.

Link copied to clipboard
Link copied to clipboard
fun interface Generator

Simple factory for GeneratorContext instances.

Link copied to clipboard

Generates g-code commands for defined operations.

Link copied to clipboard
class GrblGeneratorContext(val drawRate: Double?, val moveRate: Double?, val setup: Commands, val preDraw: Commands, val postDraw: Commands, val comment: (String) -> Commands, val end: Commands, val distanceTolerance: Double, val minSquaredDistance: Double, deduplicateCommands: Boolean = true) : BaseGeneratorContext
Link copied to clipboard
Link copied to clipboard
enum Origin : Enum<Origin>
Link copied to clipboard
class Plot(dimensions: Vector2, var name: String? = null, val origin: Origin = Origin.BOTTOM_LEFT, var generator: Generator = noopGenerator(), var distanceTolerance: Double = 0.5, var layerMode: LayerMode = LayerMode.SINGLE_FILE, var defaultDrawColor: ColorRGBa = ColorRGBa.BLACK, var defaultPenWeight: Double = 1.0, var backgroundColor: ColorRGBa = ColorRGBa.WHITE, val manualRedraw: Boolean = true, var renderMode: RenderMode = RenderMode.AFTER, val gCodeBind: String? = "g", val redrawBind: String? = "r", var folder: String? = "gcode") : Extension

Configuration: When manualRedraw is true, the programs presentation mode is set to Manual on startup. "r" to trigger redraw. When renderMode is set to manual, the plot will not be rendered to the programms drawer. Then render has to be called to draw the plot. origin

Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard

Opens a new GeneratorContext and calls block with it. The context is initialized with GeneratorContext.beginFile and finalized with GeneratorContext.endFile.

Link copied to clipboard

NOOP GCode Generator used as default.

Link copied to clipboard
fun Segment2D.points(distanceTolerance: Double): List<Vector2>

Returns the points of the segment, excluding the start point. Bezier segments are approximated with adaptive positions.

Link copied to clipboard
fun List<Vector2>.removeClosePoints(minSquaredDistance: Double): List<Vector2>
Link copied to clipboard
fun GeneratorContext.render(shape: Shape)

fun GeneratorContext.render(contour: ShapeContour)

Renders the contour to the generator context.

fun GeneratorContext.render(layer: String, composition: Composition)

Renders the composition to the generator context.

Link copied to clipboard
fun Double.roundedTo(decimals: Int = 3): String

Double to String rounded to absolute value of decimals. Helper to be used in generator functions.

Link copied to clipboard

Converts a list of commands to a single string. Newlines separate the commands.

Link copied to clipboard

Consecutive identical commands are removed, ignoring comments. Comments are lines starting with ";" or "(".