Skip to content

Repository files navigation

gcode_core

example

G-code parsing and visualization package extracted from flutter_study.

Scope

  • Read G-code from strings or files line by line.
  • Parse G0/G1 commands with X/Y/F parameters.
  • Collect parse errors with line metadata.
  • Build incremental or batch toolpath segments.
  • Render toolpaths with Flutter CustomPaint.
  • Render command timelines and playback controls for Flutter frontends.

This package does not open system file pickers or own app-level playback state.

Test

flutter test

Example

Run the Flutter example app:

cd example
flutter run

The example demonstrates local file selection, streaming parse snapshots, GcodeCanvas drawing, CommandTimeline, and PlaybackControls.

Run the console example:

dart run example/gcode_core_example.dart

Minimal usage:

import'package:gcode_core/gcode_core.dart';
Future<void> main() async {
const source ='''G0 X0 Y0G1 X10 Y0 F1200G1 X10 Y10''';
final pipeline =GcodeReadlinePipeline();
awaitfor (final snapshot
in pipeline.load(constStringGcodeLineReader(source))) {
if (snapshot.stage ==GcodeLoadStage.ready) {
print(snapshot.commands.length);
print(snapshot.segments.length);
print(snapshot.errors.length);
}
}
}

About

gcode parses and draws using canvas

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages